c++gdbcommand-line-argumentsgflags

How to pass google command line flags as an argument to GDB


I understand that to pass an argument to a gdb program I can run

r arg1 arg2 arg3

But I want to pass a GFLAG which has a name associated with an argument. Something like

r arg1="hi" arg2="there"

Solution

  • I want to pass a GFLAG which has a name associated with an argument.

    What's stopping you?

    This works:

    gdb --args /path/to/binary --flag1=foo --flag2=bar --flag3="hi there"
    

    So does this:

    (gdb) run --flag1=foo --flag2=bar --flag3="hi there"
    (gdb) run --flag1 foo --flag2 bar --flag3 "hi there"