Code Monkey home page Code Monkey logo

Comments (23)

wataash avatar wataash commented on July 30, 2024 1

Hi @antonio-petricca,

You have to do debugging by "Extension + Server":

image

and after another vscode launched, please set "debugServer": 4711 in your launch.json, and run it.

Please see official document for details.

from vscode-bash-debug.

antonio-petricca avatar antonio-petricca commented on July 30, 2024 1

@wataash It works, now I can debug it!

from vscode-bash-debug.

rogalmic avatar rogalmic commented on July 30, 2024

Does bashdb work when running it directly from shell commandline?

Please try uninstalling bash and compiling it manually:

wget https://netix.dl.sourceforge.net/project/bashdb/bashdb/4.4-0.94/bashdb-4.4-0.94.tar.gz
tar -xvfz bashdb-*.tar.gz
cd bashdb-*
./configure
make
sudo make install

from vscode-bash-debug.

antonio-petricca avatar antonio-petricca commented on July 30, 2024

I does not work from shell command line too! 👎

I installed it as you suggested me, and now works in shell command line. 👍

I am going to try it inside VS Code...

from vscode-bash-debug.

antonio-petricca avatar antonio-petricca commented on July 30, 2024

Here is my configuration:

        {
            "type": "bashdb",
            "request": "launch",
            "name": "Bash-Debug (hardcoded script name)",
            "cwd": "${workspaceFolder}",
            "program": "${workspaceFolder}/ci/scripts/pipeline-configure",
            "args": []
        }

Here is the screenshot:

pipeline-configure - ci-template - visual studio code - insiders_006

It stucks here, and any of the debugging button work!

from vscode-bash-debug.

rogalmic avatar rogalmic commented on July 30, 2024

Can you try non-insider build for sanity check?

from vscode-bash-debug.

antonio-petricca avatar antonio-petricca commented on July 30, 2024

Sure! I have just tried with Code NON Insider, and it stucks in the same way.

from vscode-bash-debug.

rogalmic avatar rogalmic commented on July 30, 2024

OK, please create separate folder with dummy script.sh:

#!/bin/bash
echo test

And create simplest debug configuration (debug pane -> dropdown -> add configuration)

I want to check if simplest case works at all.

If not, add following to launch.config and send logs from debug console:

            "showDebugOutput": true,
            "trace": true

from vscode-bash-debug.

antonio-petricca avatar antonio-petricca commented on July 30, 2024

I confirm you that script.sh with simplest configuration works!

from vscode-bash-debug.

antonio-petricca avatar antonio-petricca commented on July 30, 2024

Any other solution?!

from vscode-bash-debug.

rogalmic avatar rogalmic commented on July 30, 2024

2 ways to go from this point (assuming everything works correctly from commandline):

  • you can try to narrow down the problem by commenting out parts of code and checking when it starts to work
  • you can post the debug output here and/or provide the script if possible

from vscode-bash-debug.

antonio-petricca avatar antonio-petricca commented on July 30, 2024

Hi, I removed any content inside my script.

I get this log:

7:39:02 AM, 7/16/2018
From client: initialize({"clientID":"vscode","clientName":"Visual Studio Code - Insiders","adapterID":"bashdb","pathFormat":"path","linesStartAt1":true,"columnsStartAt1":true,"supportsVariableType":true,"supportsVariablePaging":true,"supportsRunInTerminalRequest":true,"locale":"en-us"})
To client: {"seq":0,"type":"response","request_seq":1,"command":"initialize","success":true,"body":{"supportsConditionalBreakpoints":false,"supportsConfigurationDoneRequest":false,"supportsEvaluateForHovers":true,"supportsStepBack":false,"supportsSetVariable":false}}
From client: launch({"type":"bashdb","request":"launch","name":"Bash-Debug (hardcoded script name - Test)","cwd":"/home/antonio/projects/sisal/development/ci-template","program":"/home/antonio/projects/sisal/development/ci-template/test.sh","args":[],"showDebugOutput":true,"trace":true,"pathBash":"bash","pathBashdb":"bashdb","pathCat":"cat","pathMkfifo":"mkfifo","pathPkill":"pkill","__sessionId":"3a9abf17-0365-4413-abcc-3c9aa54333d0"})
To client: {"seq":0,"type":"event","event":"output","body":{"category":"console","output":"(/home/antonio/projects/sisal/development/ci-template/test.sh:3):\n3:\techo Test!\n"}}
(/home/antonio/projects/sisal/development/ci-template/test.sh:3):
3: echo Test!
To client: {"seq":0,"type":"event","event":"output","body":{"category":"console","output":"9997\n"}}
9997
To client: {"seq":0,"type":"event","event":"output","body":{"category":"console","output":"############################################################\n"}}
############################################################
To client: {"seq":0,"type":"response","request_seq":2,"command":"launch","success":true}
To client: {"seq":0,"type":"event","event":"output","body":{"category":"telemetry","output":"Sending InitializedEvent"}}
To client: {"seq":0,"type":"event","event":"initialized"}
From client: setBreakpoints({"source":{"name":"pipeline-configure","path":"/home/antonio/projects/sisal/development/ci-template/ci/scripts/pipeline-configure"},"lines":[254],"breakpoints":[{"line":254}],"sourceModified":false})
To client: {"seq":0,"type":"event","event":"output","body":{"category":"telemetry","output":"Sending StoppedEvent"}}
To client: {"seq":0,"type":"event","event":"stopped","body":{"reason":"break","threadId":42}}
To client: {"seq":0,"type":"event","event":"output","body":{"category":"console","output":"delete <>\n"}}
delete <>
To client: {"seq":0,"type":"event","event":"output","body":{"category":"console","output":"I don't understand "load".\n"}}
I don't understand "load".
To client: {"seq":0,"type":"event","event":"output","body":{"category":"console","output":"Please try again entering 'yes' or 'no'.\nI don't understand "print".\nPlease try again entering 'yes' or 'no'.\n"}}
Please try again entering 'yes' or 'no'.
I don't understand "print".
Please try again entering 'yes' or 'no'.
To client: {"seq":0,"type":"event","event":"output","body":{"category":"console","output":"I don't understand "break".\n"}}
I don't understand "break".
To client: {"seq":0,"type":"event","event":"output","body":{"category":"console","output":"Please try again entering 'yes' or 'no'.\n"}}
Please try again entering 'yes' or 'no'.
To client: {"seq":0,"type":"event","event":"output","body":{"category":"console","output":"I don't understand "print".\n"}}
I don't understand "print".
To client: {"seq":0,"type":"event","event":"output","body":{"category":"console","output":"Please try again entering 'yes' or 'no'.\n"}}
Please try again entering 'yes' or 'no'.
From client: threads(undefined)
To client: {"seq":0,"type":"response","request_seq":4,"command":"threads","success":true,"body":{"threads":[{"id":42,"name":"Bash thread"}]}}
From client: stackTrace({"threadId":42,"startFrame":0,"levels":20})
From client: stackTrace({"threadId":42,"startFrame":0,"levels":20})

from vscode-bash-debug.

rogalmic avatar rogalmic commented on July 30, 2024

I am not sure why, but seems that bashdb does not support options 'load' or 'break' in the debugging console. You could try removing breakpoints/variables or installing newest bashdb.

I do not have access to pc, so cannot check this for some time...

from vscode-bash-debug.

antonio-petricca avatar antonio-petricca commented on July 30, 2024

As suggested by you, I have installed BASHDB from sources...

from vscode-bash-debug.

rogalmic avatar rogalmic commented on July 30, 2024

Please check if 'print' or 'break' options work from debugging console, when running bashdb directly...

from vscode-bash-debug.

antonio-petricca avatar antonio-petricca commented on July 30, 2024
$ bashdb pipeline-configure bash debugger, bashdb, release 4.4-0.94

Copyright 2002-2004, 2006-2012, 2014, 2016-2017 Rocky Bernstein
This is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.

(/home/antonio/pipeline-configure:5):
5:	if [ $# -lt 2 ]; then
bashdb<0> l
  1:    #!/bin/bash
  2:    
  3:    # Check parameter(s)
  4:    
  5: => if [ $# -lt 2 ]; then
  6:      SCRIPT_NAME=$(basename $0)
  7:      echo "${SCRIPT_NAME} [Root POM path (e.g. \"sw\")] [Jenkinsfile properties path (e.g. \"ci/settings\")]"
  8:      exit 1
  9:    fi
 10:    
bashdb<1> print $#
0
bashdb<2> break 6
Breakpoint 1 set in file /home/antonio/pipeline-configure, line 6.
bashdb<3>

from vscode-bash-debug.

antonio-petricca avatar antonio-petricca commented on July 30, 2024

I believe on this project, so I am going to take some time to debug your great extension on my development environment...

Edit 1: I setup my workspace following CONTRIBUTING.md. I would debug your extention, so I put some breakpoints into bashDebug.ts file, started the session by F5 (not CTRL-F5), but those BPs become grayed. What is wrong?!

from vscode-bash-debug.

antonio-petricca avatar antonio-petricca commented on July 30, 2024

I found the solution, here is the pull request.

Do you think to make it will be available as update early?

Thank you,
Antonio

from vscode-bash-debug.

rogalmic avatar rogalmic commented on July 30, 2024

Thanks! This needs to be fixed for newest bashdb version, so that is a very good finding.

I took some time and tested this on bashdb, release 4.2-0.8, it works there just giving a warning:

Removed 3 breakpoint(s).
** Undefined command "yes". Try "help".

I think it needs a bit more testing time with different bashdb versions, because I am a bit worried about breaking backwards compatibility.

I think we can merge this, but lets wait with release for now.
@wataash : Do you agree?

from vscode-bash-debug.

wataash avatar wataash commented on July 30, 2024

agree :)

from vscode-bash-debug.

antonio-petricca avatar antonio-petricca commented on July 30, 2024

Hi, have you planned to release this fix?

from vscode-bash-debug.

rogalmic avatar rogalmic commented on July 30, 2024

Yes, I have not noticed any issues so far (though I did not spend much time testing), so we will release it.

I will try to release that this week + I will update the dependencies and Readme (the default supported bashdb version will be 4.4).

from vscode-bash-debug.

antonio-petricca avatar antonio-petricca commented on July 30, 2024

Thank you!

from vscode-bash-debug.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.