This is the mail archive of the gdb@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: "set foo"


>   set main
> 
> A comment there says that this is so some variables from the binary
> are available when .gdbinit is processed.  I understand that this
> command somehow manages to force GDB to read the relevant portions of
> the symbol tables, but what I don't understand is what is the
> semantics of saying "set foo" in GDB where foo is some function.  What
> does this command do, exactly?

I think that "main" is treated as an expression, and this expression
simply returns the address of function main.  For instance, try the
following:

    (gdb) print main

Since it's a "set" command, we then discard the result of the evaluation.

Variable assignments look like they are performed by the "set", but in
reality, it is performed by the language expression evaluator.  You can
obtain just the same effect using a "print" command:

    (top-gdb) print args.argc = 1
    $1 = 1

The latter causes GDB to print the value returned, but that should be
the only difference.

-- 
Joel


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]