This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: "set foo"
- From: Joel Brobecker <brobecker at adacore dot com>
- To: Eli Zaretskii <eliz at gnu dot org>
- Cc: gdb at sourceware dot org
- Date: Sat, 24 Apr 2010 17:21:18 -0400
- Subject: Re: "set foo"
- References: <8339yk1skw.fsf@gnu.org>
> 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