From: Pedro Alves <palves@redhat.com>
To: Joel Brobecker <brobecker@adacore.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [RFC 3/3] GDB/MI: Add new "--language LANG" command option.
Date: Wed, 13 Nov 2013 19:49:00 -0000 [thread overview]
Message-ID: <5283D47A.4060900@redhat.com> (raw)
In-Reply-To: <1384151855-12926-3-git-send-email-brobecker@adacore.com>
On 11/11/2013 06:37 AM, Joel Brobecker wrote:
> Hello,
>
> Frontend sometimes need to evaluate expressions that are
> language-specific. For instance, Eclipse uses the following
> expression to determine the size of an address on the target:
>
> -data-evaluate-expression "sizeof (void*)"
>
> Unfortunately, if the main of the program being debugged is not C,
> this may not work. For instance, if the main is in Ada, you get...
>
> -data-evaluate-expression "sizeof (void*)"
> ^error,msg="No definition of \"sizeof\" in current context."
>
> ... and apparently decides to stop the debugging session as a result.
> The recommendation sent was to specifically set the language to C
> before trying to evaluate the expression. Something such as:
>
> 1. save current language
> 2. set language c
> 3. -data-evaluate-expression "sizeof (void*)"
> 4. Restore language
>
> This has the same disadvantages as the ones outlined in the "Context
> Management" section of the GDB/MI documentation regarding setting
> the current thread or the current frame, thus recommending the use of
> general command-line switches such as --frame, or --thread instead.
>
> This patch follows the same steps for the language, adding a similar
> new command option: --language LANG. Example of use:
Makes sense to me. I skimmed the patch and it looked fine.
>
> -data-evaluate-expression --language c "sizeof (void*)"
> ^done,value="4"
>
> gdb/ChangeLog:
>
> * mi/mi-parse.h (struct mi_parse) [language]: New field.
[] is used for conditionally compiled code (#if FOO). For specifying
context, use <>.
> * mi/mi-main.c (mi_cmd_execute): Temporarily set language to
> PARSE->LANGUAGE during command execution, if set.
> * mi/mi-parse.c: Add "language.h" #include.
> (mi_parse): Add parsing of "--language" command option.
--
Pedro Alves
next prev parent reply other threads:[~2013-11-13 19:35 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-11 6:38 [RFA/commit 1/3] language.h: Add "symtab.h" #include Joel Brobecker
2013-11-11 6:39 ` [RFA 2/3] New function cli-utils.c:extract_arg_const Joel Brobecker
2013-11-13 19:35 ` Pedro Alves
2013-11-14 10:55 ` pushed: " Joel Brobecker
2013-11-11 6:55 ` [RFC 3/3] GDB/MI: Add new "--language LANG" command option Joel Brobecker
2013-11-11 7:02 ` Joel Brobecker
2013-11-11 17:20 ` Eli Zaretskii
2013-11-11 16:29 ` Eli Zaretskii
2013-11-13 19:49 ` Pedro Alves [this message]
2013-11-14 11:17 ` Joel Brobecker
2013-11-13 19:34 ` [PATCH] New "make check-headers" rule. (was: Re: [RFA/commit 1/3] language.h: Add "symtab.h" #include) Pedro Alves
2013-11-14 10:00 ` Joel Brobecker
2013-11-14 21:32 ` [PATCH] New "make check-headers" rule Tom Tromey
2014-01-13 19:42 ` Pedro Alves
2013-11-14 10:55 ` pushed: [RFA/commit 1/3] language.h: Add "symtab.h" #include Joel Brobecker
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=5283D47A.4060900@redhat.com \
--to=palves@redhat.com \
--cc=brobecker@adacore.com \
--cc=gdb-patches@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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).