From: Joel Brobecker <brobecker@adacore.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: gdb@sourceware.org
Subject: Re: "set foo"
Date: Sat, 24 Apr 2010 21:21:00 -0000 [thread overview]
Message-ID: <20100424212118.GW13204@adacore.com> (raw)
In-Reply-To: <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
next prev parent reply other threads:[~2010-04-24 21:21 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-04-24 20:52 Eli Zaretskii
2010-04-24 21:21 ` Joel Brobecker [this message]
2010-04-25 13:40 ` Eli Zaretskii
2010-04-25 14:43 ` Joel Brobecker
2010-04-25 15:10 ` Eli Zaretskii
2010-04-26 16:24 ` Tom Tromey
2010-04-26 17:45 ` Eli Zaretskii
2010-04-26 17:51 ` Paul Koning
2010-04-26 19:46 ` Tom Tromey
2010-04-26 20:17 ` Eli Zaretskii
2010-04-27 3:11 ` Tom Tromey
2010-04-27 17:04 ` Eli Zaretskii
2010-04-27 17:25 ` Tom Tromey
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20100424212118.GW13204@adacore.com \
--to=brobecker@adacore.com \
--cc=eliz@gnu.org \
--cc=gdb@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox