Skip to content

gdbgui --args does not function as expected #272

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
zhidvegi opened this issue Apr 30, 2019 · 5 comments
Open

gdbgui --args does not function as expected #272

zhidvegi opened this issue Apr 30, 2019 · 5 comments

Comments

@zhidvegi
Copy link

zhidvegi commented Apr 30, 2019

There was already an issue with a fix for that, #194, but apparently this still does not work. The options after --args are still parsed somehow. E.g.
gdbgui --args your_program -msg
This will cause the gdb process to die, and nothing can be debugged. Using
gdbgui --args your_program '"-msg"'
works. This actually shows an other issue, with gdb --args, all args after --args are passed unmodified to gdb. But with gdbbui --args the args following --args are joined with spaces and used like the args for the gdb run command, which undergoes an other shell expansion step, so any space, quotes, backslashes, dollar signs etc. are shell expanded. I an not good enough python coder to fix this, for my workaround I wrote a shell script wrapper to gdbgui that adds the necessary quoting to the parms following --args to faithfully emulate gdb --args and it works well enough for me, but it took me a while to figure out what was the issue, I was almost ready to give up completely on gdbgui. Incidentally the quoting also fixes the option parsing issues, since the -msg parm becomes '-msg' which no longer starts with a dash, and the extra quotes are stripped during the second shell expansion (the first shell expansion happens when you enter the gdbgui args on the command line).

@sammcdsam
Copy link

I am also having this issue with gdbgui --args

@jhgoebbert
Copy link
Contributor

I have a similar problem with "--args" running the following command:
gdbgui -r --port 5454 --user user1 --password debug --args /tmp/bin/pvserver -v=9 -l=/tmp/pvserver_log_9.out,9 -l=/tmp/pvserver_log_1.out,0 --disable-xdisplay-test --use-offscreen-rendering --server-port=12113

gdbgui runs then the following command:
/usr/bin/gdb /tmp/bin/pvserver -v=9 -l=/tmp/pvserver_log_9.out,9 -l=/tmp/pvserver_log_1.out,0 --disable-xdisplay-test --use-offscreen-rendering --server-port=15090 --interpreter=mi2

but it should be IMHO:
/usr/bin/gdb --interpreter=mi2 --args /tmp/bin/pvserver -v=9 -l=/tmp/pvserver_log_9.out,9 -l=/tmp/pvserver_log_1.out,0 --disable-xdisplay-test --use-offscreen-rendering --server-port=15090

@cs01
Copy link
Owner

cs01 commented Oct 4, 2019

Sorry for the inconvenience. If you have the time/ability please submit a PR. Otherwise I will get to it when I can.

@jhgoebbert
Copy link
Contributor

I love gdbgui. Using gdb in the browser is a big step forward making debugging on remote machines much easier. Many thanks for this great work.

I had a look in the code. Especially this lines in statemachine.py

            gdb_args = (
                deepcopy(self.config["initial_binary_and_args"])
                + deepcopy(self.config["gdb_args"])
                + REQUIRED_GDB_FLAGS
            )

which could be changed to

            gdb_args = (
                REQUIRED_GDB_FLAGS
                + self.config["gdb_args"]
                + ["--args"]
                + self.config["initial_binary_and_args"]
            )

But give me a little more time and I send you a PR.

@jhgoebbert
Copy link
Contributor

Here's a suggestion on how to solve it: #296

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants