gdbgui icon indicating copy to clipboard operation
gdbgui copied to clipboard

gdbgui --args does not function as expected

Open zhidvegi opened this issue 5 years ago • 5 comments

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

zhidvegi avatar Apr 30 '19 20:04 zhidvegi

I am also having this issue with gdbgui --args

sammcdsam avatar Jun 05 '19 15:06 sammcdsam

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

jhgoebbert avatar Oct 04 '19 13:10 jhgoebbert

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

cs01 avatar Oct 04 '19 16:10 cs01

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 avatar Oct 05 '19 08:10 jhgoebbert

Here's a suggestion on how to solve it: https://github.com/cs01/gdbgui/pull/296

jhgoebbert avatar Oct 05 '19 13:10 jhgoebbert