binutils-gdb/gdb/doc
Joel Brobecker 403cb6b138 GDB/MI: Add new "--language LANG" command option.
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:

    -data-evaluate-expression --language c "sizeof (void*)"
    ^done,value="4"

gdb/ChangeLog:

        * mi/mi-parse.h (struct mi_parse) <language>: New field.
        * 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.

        * NEWS: Add entry mentioning the new "--language" command option.

gdb/testsuite/ChangeLog:

        * gdb.mi/mi-language.exp: New file.

gdb/doc/ChangeLog:

        * gdb.texinfo (Show): Add xref anchor for "show language" command.
        (Context management): Place current subsection text into its own
        subsubsection.  Add new subsubsection describing the "--language"
        command option.
2013-11-14 14:36:18 +04:00
..
ChangeLog GDB/MI: Add new "--language LANG" command option. 2013-11-14 14:36:18 +04:00
Makefile.in * README: Update references to writing code for GDB. 2013-09-16 18:00:34 +00:00
a4rc.sed
agentexpr.texi Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
all-cfg.texi Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
annotate.texinfo Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
fdl.texi
gdb.texinfo GDB/MI: Add new "--language LANG" command option. 2013-11-14 14:36:18 +04:00
gpl.texi
lpsrc.sed
observer.texi New remove-symbol-file command. 2013-10-29 10:56:07 +01:00
psrc.sed
refcard.tex Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
stabs.texinfo Update years in copyright notice for the GDB files. 2013-01-01 06:33:28 +00:00
stack_frame.eps
stack_frame.pdf
stack_frame.png
stack_frame.svg
stack_frame.txt