gdbgui icon indicating copy to clipboard operation
gdbgui copied to clipboard

Difference between 'gdb --args a.out \~foo' and 'gdbgui --args a.out \~foo'

Open CyrillePierre opened this issue 4 years ago • 0 comments

Describe the bug When using the --args to specify parameters given to the debugged program, there is a difference between gdb --args and gdbgui --args. To avoid that the shell interprets special characters like ~, gdb requires to escape it using a \. For gdbgui it requires at least 2 levels of escape.

To Reproduce

  • Write a file a.c containing:
#include <stdio.h>
int main(int argc, char ** argv) {
	if(argc > 1) puts(argv[1]);
}
  • Compile it using the command gcc -ggdb a.c
  • Debug it using the command gdbgui --args a.out \~foo
  • Run the program using r command in the gdb prompt The program will print the following result:
zsh:1: no such user or named directory: foo

Expected behavior Using the command gdb -q --ex 'r' --ex 'q' --args a.out \~foo, the result is:

Reading symbols from a.out...
Starting program: /tmp/a.out \~foo
~foo
[Inferior 1 (process 325725) exited normally]

As expected, the program print ~foo.

Please complete the following information:

  • OS: Ubuntu 20.04 (Linux 5.11.0-40-generic)
  • gdbgui version (gdbgui -v): 0.15.0.1
  • gdb version (gdb -v): 9.2
  • browser [e.g. chrome, safari]: chromium
  • python packages (pip freeze):

CyrillePierre avatar Nov 19 '21 14:11 CyrillePierre