Code Monkey home page Code Monkey logo

Comments (23)

rogalmic avatar rogalmic commented on June 28, 2024 1

Some changes that might help (updated):
bash-debug-0.2.2.vsix.zip

Please test via "install from vsix" option and give feedback:
image

from vscode-bash-debug.

HexenZ avatar HexenZ commented on June 28, 2024

Any help please? Still looking for a solution

from vscode-bash-debug.

rogalmic avatar rogalmic commented on June 28, 2024

Sorry for late response:

  1. why there is space between dots?
    . ./file2.sh
  2. try :
    source ./file2.sh
    or
    source ../file2.sh
    depending the file location

from vscode-bash-debug.

HexenZ avatar HexenZ commented on June 28, 2024

Hi, thanks for answering. I'm really new to bash and I'm a bit lost with it. Anyway, the first "." of . ./file2.sh is similar to source (I don't know the difference and source ./file2.sh doesn't works neither). And I cannot replace because I have to maintain bash scripts of thousands lines that are using that "." not the example itself.

The thing is that . ./file2.sh actually works but the debugger won't stop at break points leading me to dismiss the tool for working until the problem is solved.

from vscode-bash-debug.

rogalmic avatar rogalmic commented on June 28, 2024

You are correct, dot works as well...

Which version of bashdb/bash do you have? (I successfully tried on 4.4.0-94 and also build 91 + bash 4.4.19)

You could try installing newest bashdb:
#67

from vscode-bash-debug.

HexenZ avatar HexenZ commented on June 28, 2024

I'm using

bash: GNU bash, versión 4.4.19(1)-release (x86_64-pc-linux-gnu)
bashdb: bashdb, release 4.4-0.94

We're using the same or am I wrong?

from vscode-bash-debug.

rogalmic avatar rogalmic commented on June 28, 2024

Yes, we are using the same - this is interesting ...

Are you able to provide some snapshots + exact reproduction steps. Screen record would be ok as well. Can there be some issues with accessing the "sourced" file?

from vscode-bash-debug.

HexenZ avatar HexenZ commented on June 28, 2024

shot1
shot2
shot3

The steps are:

  1. Click 'Debug' -> 'Start Debugging'
  2. Press F5 (Continue)
  3. The script finishes and the result is printed:

shot4

As I allready said it stops at the first breakpoint placed at a1.sh line 3 (echo hello) but it doesn't at the second a2.sh line 3 (echo world).

I suppose that if there were problems accesing the file it wouldn't work with absolute path neither, maybe I'm wrong with that.

from vscode-bash-debug.

rogalmic avatar rogalmic commented on June 28, 2024

OK, so the reason is now obvious. When setting breakpoint source path when debugging, it does not accept paths with spaces nor slashes "-".

I am talking "load" and "break" commands from http://bashdb.sourceforge.net/bashdb.html.

Unfortunately wrapping path in " or ' or ` does not seem to help when i change code of extension... Need to investigate more...

Please use path without "-" to verify this finding.

Just to keep as evidence, the failing call in different flavours:

** Expecting one filename parameter, Got 3.
bashdb<24> load "/mnt/c/Users/[aaa]/Documents/src/vscode-bash debug/tes-t me/test.sh"
** Expecting one filename parameter, Got 3.
bashdb<25> load '/mnt/c/Users/[aaa]/Documents/src/vscode-bash debug/tes-t me/test.sh'
** Expecting one filename parameter, Got 3.
bashdb<26> load `/mnt/c/Users/[aaa]/Documents/src/vscode-bash debug/tes-t me/test.sh`
** Expecting one filename parameter, Got 3.
bashdb<27> load `/mnt/c/Users/[aaa]/Documents/src/vscode-bash\ debug/tes-t\ me/test.sh`
** Expecting one filename parameter, Got 3.
bashdb<28> load (/mnt/c/Users/[aaa]/Documents/src/vscode-bash debug/tes-t me/test.sh)
** Expecting one filename parameter, Got 3.

(https://sourceforge.net/p/bashdb/code/ci/release-4.4-0.94/tree/command/load.sh) (line 30)

bashdb<13> load "/mnt/c/Users/[aaa]/Documents/src/vscode-bash-debug/tes-tme/aaa.sh"
File  loaded.
bashdb<14> info files
Source files which we have recorded info about:
  /mnt/c/Users/[aaa]/Documents/src/vscode-bash-debug/tes-tme/test.sh: /mnt/c/Users/[aaa]/Documents/src/vscode-bash-debug/tes-tme/test.sh, 1 lines
bashdb<15> break /mnt/c/Users/[aaa]/Documents/src/vscode-bash-debug/tes-tme/aaa.sh:3
** File "" not found in read-in files.
** See 'info files' for a list of known files and
** 'load' to read in a file.

from vscode-bash-debug.

rogalmic avatar rogalmic commented on June 28, 2024

Issue reported:
https://sourceforge.net/p/bashdb/bugs/54/

from vscode-bash-debug.

HexenZ avatar HexenZ commented on June 28, 2024

I've changed the path name from "/home/adrian/test-shell" to "/home/adrian/testshell" and still having the same issue, it stops at the first break point but ignores the second.

There must be something else.

from vscode-bash-debug.

rogalmic avatar rogalmic commented on June 28, 2024

Please attach debug console output, when launch.json configuration has :
"showDebugOutput": true,

from vscode-bash-debug.

HexenZ avatar HexenZ commented on June 28, 2024

This is the console output:

(/home/adrian/testshell/a1.sh:3):
3: echo hello
21518
############################################################
delete <>
** Undefined command "yes". Try "help".
File /home/adrian/testshell/a1.sh loaded.
</home/adrian/testshell/a1.sh:3>
Breakpoint 1 set in file /home/adrian/testshell/a1.sh, line 3.
</home/adrian/testshell/a1.sh:5>
Breakpoint 2 set in file /home/adrian/testshell/a1.sh, line 5.
############################################################
delete <>
** Undefined command "yes". Try "help".
File /home/adrian/testshell/a2.sh loaded.
</home/adrian/testshell/a2.sh:3>
Breakpoint 3 set in file /home/adrian/testshell/a2.sh, line 3.
############################################################
backtrace
->0 in file /home/adrian/testshell/a1.sh' at line 3 ##1 source("/home/adrian/testshell/a1.sh") called from file /usr/bin/bashdb' at line 99
##2 main("--quiet", "--tty", "/tmp/vscode-bash-debug-fifo-11391", "--", "/home/adrian/testshell/a1.sh") called from file /usr/bin/bashdb' at line 0 ############################################################ backtrace ->0 in file /home/adrian/testshell/a1.sh' at line 3
##1 source("/home/adrian/testshell/a1.sh") called from file /usr/bin/bashdb' at line 99 ##2 main("--quiet", "--tty", "/tmp/vscode-bash-debug-fifo-11391", "--", "/home/adrian/testshell/a1.sh") called from file /usr/bin/bashdb' at line 0
############################################################
Program stopped.
It stopped after being stepped.
Next statement to be run is:
echo hello
<$PWD>
/home/adrian/testshell
<$EUID>
1000
<$#>
1
<$0>
/usr/bin/bashdb
<$->
hBET
############################################################
continue
hello
Breakpoint 2 hit (1 times).
(/home/adrian/testshell/a1.sh:5):
5: . ./a2.sh
############################################################
backtrace
->0 in file /home/adrian/testshell/a1.sh' at line 5 ##1 source("/home/adrian/testshell/a1.sh") called from file /usr/bin/bashdb' at line 99
##2 main("--quiet", "--tty", "/tmp/vscode-bash-debug-fifo-11391", "--", "/home/adrian/testshell/a1.sh") called from file /usr/bin/bashdb' at line 0 ############################################################ backtrace ->0 in file /home/adrian/testshell/a1.sh' at line 5
##1 source("/home/adrian/testshell/a1.sh") called from file /usr/bin/bashdb' at line 99 ##2 main("--quiet", "--tty", "/tmp/vscode-bash-debug-fifo-11391", "--", "/home/adrian/testshell/a1.sh") called from file /usr/bin/bashdb' at line 0
############################################################
continue
Breakpoint 3 hit (1 times).
(/home/adrian/testshell/a2.sh:3):
3: echo 'world'
############################################################
backtrace
->0 in file ./a2.sh' at line 3 ##1 source("./a2.sh") called from file /home/adrian/testshell/a1.sh' at line 5
##2 source("/home/adrian/testshell/a1.sh") called from file /usr/bin/bashdb' at line 99 ##3 main("--quiet", "--tty", "/tmp/vscode-bash-debug-fifo-11391", "--", "/home/adrian/testshell/a1.sh") called from file /usr/bin/bashdb' at line 0
############################################################
backtrace
->0 in file ./a2.sh' at line 3 ##1 source("./a2.sh") called from file /home/adrian/testshell/a1.sh' at line 5
##2 source("/home/adrian/testshell/a1.sh") called from file /usr/bin/bashdb' at line 99 ##3 main("--quiet", "--tty", "/tmp/vscode-bash-debug-fifo-11391", "--", "/home/adrian/testshell/a1.sh") called from file /usr/bin/bashdb' at line 0
############################################################
Program stopped.
It stopped at breakpoint 3.
Next statement to be run is:
echo 'world'
<$PWD>
/home/adrian/testshell
<$EUID>
1000
<$#>
1
<$0>
/usr/bin/bashdb
<$->
hBET
############################################################
continue
world
Debugged program terminated normally. Use q to quit or R to restart.
bash: línea 18: 21520 Terminado (killed) "cat" "/tmp/vscode-bash-debug-fifo-11391" 1>&3 (dir ahora: ~)
bash: línea 18: 21521 Terminado (killed) "cat"
21522 | "bashdb" --quiet --tty "/tmp/vscode-bash-debug-fifo-11391" -- "/home/adrian/testshell/a1.sh"

from vscode-bash-debug.

rogalmic avatar rogalmic commented on June 28, 2024

Hmm, this is weird. Bashdb actually stops, and "continue" is sent by debugger:

Breakpoint 3 hit (1 times).
(/home/adrian/testshell/a2.sh:3):
3: echo 'world'
############################################################
backtrace
->0 in file ./a2.sh' at line 3 ##1 source("./a2.sh") called from file/home/adrian/testshell/a1.sh' at line 5
##2 source("/home/adrian/testshell/a1.sh") called from file /usr/bin/bashdb' at line 99 ##3 main("--quiet", "--tty", "/tmp/vscode-bash-debug-fifo-11391", "--", "/home/adrian/testshell/a1.sh") called from file/usr/bin/bashdb' at line 0
############################################################
backtrace
->0 in file ./a2.sh' at line 3 ##1 source("./a2.sh") called from file/home/adrian/testshell/a1.sh' at line 5
##2 source("/home/adrian/testshell/a1.sh") called from file /usr/bin/bashdb' at line 99 ##3 main("--quiet", "--tty", "/tmp/vscode-bash-debug-fifo-11391", "--", "/home/adrian/testshell/a1.sh") called from file/usr/bin/bashdb' at line 0
############################################################
Program stopped.
It stopped at breakpoint 3.

Can you see callstack when debugger stops and console shows:

->0 in file ./a2.sh' at line 3 ?

from vscode-bash-debug.

HexenZ avatar HexenZ commented on June 28, 2024

Yes, I've noticed that bashdb actually stops at the breakpoint and it seems that vs-code sends a "continue" instruction even if I'm running the option "Debug step by step".

Here's the callstack output:

->0 in file ./a2.sh' at line 3 (Unknown origin:3) ##1 source("./a2.sh") called from file /home/adrian/testshell/a1.sh' at line 5 (/home/adrian/testshell/a1.sh:5)
##2 source("/home/adrian/testshell/a1.sh") called from file /usr/bin/bashdb' at line 99 (/usr/bin/bashdb:99) ##3 main("--quiet", "--tty", "/tmp/vscode-bash-debug-fifo-13145", "--", "/home/adrian/testshell/a1.sh") called from file /usr/bin/bashdb' at line 0 (/usr/bin/bashdb:0)

I'm wondering... could it be an error with using $0 internally?

I got these vars at the watch list:

$PWD=/home/adrian/testshell
$0=/usr/bin/bashdb

from vscode-bash-debug.

rogalmic avatar rogalmic commented on June 28, 2024

I am a bit confused, since continue can only be sent by vscode to extension, there is no other path for that.

So it seems that vscode calls the extension's callback containing "continue" by itself, without any user action?

Are you using mouse to click the debugger buttons or "F5"/"F10"/"F11" ?

from vscode-bash-debug.

HexenZ avatar HexenZ commented on June 28, 2024

I'm using F5 most of the time or the "play like" arrow:
shot6
Anyway, every time I'm testing, I try every button or F* key.

from vscode-bash-debug.

rogalmic avatar rogalmic commented on June 28, 2024

What is the platform/system and VS code version?

I mean everything looks ok from debug session point of view, so we need to look for problem higher in stack...

from vscode-bash-debug.

HexenZ avatar HexenZ commented on June 28, 2024

SO: Ubuntu 18.04.1 LTS
VScode: 1.26.1

If you need any other info let me know :)

from vscode-bash-debug.

rogalmic avatar rogalmic commented on June 28, 2024

I installed Ubuntu on VM, i think i am able to reproduce the problem:
screenshot_20180824_121255

Notice that the uppermost element in callstack is grayed out, which means that relative path './a2.sh' is not working in linux. Seems that vscode working dir is different on linux. I will try to find a solution, possibly try to recover full path.

from vscode-bash-debug.

rogalmic avatar rogalmic commented on June 28, 2024

Preparing for release, here is test version:
https://github.com/rogalmic/vscode-bash-debug/releases/download/untagged-eccd51e3096d87c7b498/bash-debug-0.2.2.vsix

from vscode-bash-debug.

HexenZ avatar HexenZ commented on June 28, 2024

Some changes that might help (updated):
bash-debug-0.2.2.vsix.zip

Please test via "install from vsix" option and give feedback:

Sorry for the late reply, I've been on a trip and had no time. The vsix is working like a miracle!

Really... really thank you a lot for all your help and patience rogalmic.

from vscode-bash-debug.

rogalmic avatar rogalmic commented on June 28, 2024

I should thank you for patience :). Anyway, now the changes are released.

For spaces to work in script path, bashdb upgrade will be needed, after it's next release (those scripts can also be updated manually with code fixes in /usr/share/bashdb/* ).

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.