Menu

#54 Source path with space - setting breakpoint fails

v1.0_(example)
closed-fixed
None
5
2018-11-17
2018-08-21
No

I am having issue with properly setting breakpoint using full path, see following outputs from build 91.

  • loading source (space in path basically means problem):
** 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.
  • setting breakpoint (load does not set path with "-", though no error is shown):
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.

The space handling issue is present in build 94 as well, while I am not sure about "-" in path.

Seems to be related to load command argument parsing.

Related

Bugs: #54

Discussion

  • Rocky Bernstein

    Rocky Bernstein - 2018-08-22

    Debugger parsing of any sort of text that has an implied space in it has problems in bashdb.

    I don't have a good solution for it and can't spend the time to work on this. If you or others want to work on this I'll try make time to try to help.

     

    Last edit: Rocky Bernstein 2018-08-22
  • Michał Rogaliński

    I would assume the issue comes from processor.sh line 149:

                if ! read _Dbg_cmd args <&$_Dbg_input_desc 2>&1; then
    

    The info about separate arguments is lost in single string + it seems that there is no simple fix for that, since the "Dbg_input_desc" would require some better interpretation then just separating via IFS.

    Maybe allownig octal character codes via escape character \ would serve as proper workaround? ("\000")

     
  • Rocky Bernstein

    Rocky Bernstein - 2018-08-22

    I think you are correct that the read loses the string boundaries.

    If you want to see if you can work op a solution around using an escape character, go for it and put in a patch or whatever the sourceforge equivalant of a github pull request is.

     

    Last edit: Rocky Bernstein 2018-08-22
  • Michał Rogaliński

    Created initial changes, please take a look at newest commit:
    https://sourceforge.net/u/rogalmic/bashdb/commit_browser

    • The change in load.sh is obvious.
    • Processor.sh must not use read escaping, since then there is no control over using '\'. Requires testing if does not break anything.
    • Filecache.sh was changed, because when i send first character '/' encoded as '\057', then check of first char ${ind_file:0:1} returns '\'. Could be a bad place for this operation...

    I have no idea how to create proper merge request here...

     
  • Rocky Bernstein

    Rocky Bernstein - 2018-08-22

    Thanks. I will try to check that code, test it and merge it if it is fine.

     
  • Rocky Bernstein

    Rocky Bernstein - 2018-08-22

    In commit 91e8afa , I took the changes from filecache.sh and load.sh, however we can't use the processor.sh changes as is: sometimes we want the string interpolation and sometimes we don't.

    What I've done in other debuggers is keep two copies of the read-in line: one that is "raw" and one that isn't. Then in those commands where there could be a raw string needed, such as break or load, the passed in command arguments are ignored and special parsing is done on the raw string.

    You'll know if you succeed if you can run make check and all of the tests succeed.

     

    Last edit: Rocky Bernstein 2018-08-22
  • Michał Rogaliński

    I am wondering how to do that. When i checked with original code, the "\" was beeing removed without the "-r" option in read.

    1. Do you propose to have a "if" only for break and load during read? It cannot be done lower in stack, because of the missing "\" after read.

    2. Perhaps there could be some mode in debugger that enables the raw operation ? Or is the "-r" breaking the core functionality?

     
  • Rocky Bernstein

    Rocky Bernstein - 2018-08-22

    I was suggesting

    1. read raw into variable $_Dbg_cmd_raw
    2. From that variable, interpolate that into variables _Dbg_cmd and args.
    3. proceed as normal in code
    4. In command/load.sh find the end of where the string "load" and trailing space end. And then use the part of $_Dbg_cmd_raw after the space for the file name.

    I should also mention that if bahsdb-supplied builtin readc (a readline completing read) is used, things might get more compilcated.

     
  • Michał Rogaliński

    After quick test maybe we do not need more changes - double "\\040" seems to do the trick (first for read, then for actual octal char code).

    I will verify this tomorrow.

     

    Last edit: Michał Rogaliński 2018-08-22
  • Michał Rogaliński

    Seems to be working with double backslash + octal char code, i see no need to preceed with "-r" option in read.

     
  • Rocky Bernstein

    Rocky Bernstein - 2018-08-23

    Ok. I would be grateful if you would update the documentation in the code to suggest how to do what you just figured out. For example perhaps extending the documentation in "load.sh" line 25 might do it for load.

    In other debuggers I have created a "help" directory in the commands folder and have category information like syntax used in command in general. See for example https://github.com/rocky/python3-trepan/tree/master/trepan/processor/command/help

    But this would mean extending the code in help.sh and I don't have the time or need to do this.

     
  • Michał Rogaliński

    Please take a look at my new commit:
    https://sourceforge.net/u/rogalmic/bashdb/commit_browser

    This should be enough to explain this "almost accidental" feature :).

     
    • Rocky Bernstein

      Rocky Bernstein - 2018-08-23

      Looks great! Would you do the same for the "breakpoint" command?

      If this repo is clean of things outside of this, I'll clone it and merge it
      sometime over the weekend.

      On Thu, Aug 23, 2018 at 7:47 AM, "Michał Rogaliński" rogalmic@users.sourceforge.net wrote:

      Please take a look at my new commit:
      https://sourceforge.net/u/rogalmic/bashdb/commit_browser

      This should be enough to explain this "almost accidental" feature :).

      Status: open
      Group: v1.0_(example)
      Created: Tue Aug 21, 2018 05:00 PM UTC by Michał Rogaliński
      Last Updated: Thu Aug 23, 2018 11:11 AM UTC
      Owner: nobody

      I am having issue with properly setting breakpoint using full path, see
      following outputs from build 91.

      • loading source (space in path basically means problem):

      ** 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.

      • setting breakpoint (load does not set path with "-", though no error
        is shown):

      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.

      The space handling issue is present in build 94 as well, while I am not
      sure about "-" in path.

      Sent from sourceforge.net because you indicated interest in
      https://sourceforge.net/p/bashdb/bugs/54/

      To unsubscribe from further messages, please visit
      https://sourceforge.net/auth/subscriptions/

       

      Related

      Bugs: #54

  • Michał Rogaliński

     
    • Rocky Bernstein

      Rocky Bernstein - 2018-08-23

      Great - thanks! I'll pick up the changes from the repo over the weekend.

      On Thu, Aug 23, 2018 at 9:00 AM, "Michał Rogaliński" rogalmic@users.sourceforge.net wrote:

      Did the same for break.sh:
      https://sourceforge.net/u/rogalmic/bashdb/commit_browser


      Status: open
      Group: v1.0_(example)
      Created: Tue Aug 21, 2018 05:00 PM UTC by Michał Rogaliński
      Last Updated: Thu Aug 23, 2018 11:47 AM UTC
      Owner: nobody

      I am having issue with properly setting breakpoint using full path, see
      following outputs from build 91.

      • loading source (space in path basically means problem):

      ** 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.

      • setting breakpoint (load does not set path with "-", though no error
        is shown):

      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.

      The space handling issue is present in build 94 as well, while I am not
      sure about "-" in path.

      Sent from sourceforge.net because you indicated interest in
      https://sourceforge.net/p/bashdb/bugs/54/

      To unsubscribe from further messages, please visit
      https://sourceforge.net/auth/subscriptions/

       

      Related

      Bugs: #54

  • Michał Rogaliński

    Found additional small issue when showing bactrace and path has multiple spaces in bath:

    https://sourceforge.net/u/rogalmic/bashdb/ci/bdb0836764b24d783de564470b2604e52760fd37/

    I think this fix is trivial and could also be taken.

     
    • Rocky Bernstein

      Rocky Bernstein - 2018-08-25

      Merge now done. However note that your branch was not clean and it is now
      out of date.

      Specifically see
      https://sourceforge.net/u/rogalmic/bashdb/ci/master/tree/lib/processor.sh#l154

      So either remove that, or refresh it, or I won't pull from that in the
      future.

      On Fri, Aug 24, 2018 at 11:47 AM, "Michał Rogaliński" rogalmic@users.sourceforge.net wrote:

      Found additional small issue when showing bactrace and path has multiple
      spaces in bath:

      https://sourceforge.net/u/rogalmic/bashdb/ci/
      bdb0836764b24d783de564470b2604e52760fd37/

      I think this fix is trivial and could also be taken.

      Status: open
      Group: v1.0_(example)
      Created: Tue Aug 21, 2018 05:00 PM UTC by Michał Rogaliński
      Last Updated: Thu Aug 23, 2018 01:00 PM UTC
      Owner: nobody

      I am having issue with properly setting breakpoint using full path, see
      following outputs from build 91.

      • loading source (space in path basically means problem):

      ** 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.

      • setting breakpoint (load does not set path with "-", though no error
        is shown):

      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.

      The space handling issue is present in build 94 as well, while I am not
      sure about "-" in path.

      Sent from sourceforge.net because you indicated interest in
      https://sourceforge.net/p/bashdb/bugs/54/

      To unsubscribe from further messages, please visit
      https://sourceforge.net/auth/subscriptions/

       

      Related

      Bugs: #54

  • Michał Rogaliński

    Great, thank you for your help. I will reset my git fork...

     
  • Rocky Bernstein

    Rocky Bernstein - 2018-11-17
    • status: open --> closed-fixed
    • assigned_to: Rocky Bernstein
     

Log in to post a comment.