old-cross-binutils/gdb/testsuite/gdb.mi
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
..
array.f
basics.c
ChangeLog-1999-2003
dw2-ref-missing-frame-func.c
dw2-ref-missing-frame-main.c
dw2-ref-missing-frame.exp
dw2-ref-missing-frame.S
gdb669.exp
gdb680.exp
gdb701.c
gdb701.exp
gdb792.cc
gdb792.exp
gdb2549.exp * gdb.mi/gdb2549.exp (register_tests): Expect any decimal for 2013-07-06 02:32:31 +00:00
Makefile.in 2013-05-21 Hui Zhu <hui@codesourcery.com> 2013-05-21 04:18:55 +00:00
mi-async.exp
mi-basics.exp gdb/testsuite/ 2013-07-24 09:17:15 +00:00
mi-break.exp create_breapoint / explicit mode: Error out if there's garbage after the breakpoint location. 2013-04-08 14:09:30 +00:00
mi-breakpoint-changed.exp * gdb.mi/mi-breakpoint-changed.exp (test_insert_delete_modify): 2013-10-17 22:02:29 +00:00
mi-catch-load-so.c
mi-catch-load.c gdb/testsuite/ 2013-10-11 07:27:46 +00:00
mi-catch-load.exp gdb/testsuite/ 2013-10-11 07:27:46 +00:00
mi-cli.exp
mi-cmd-param-changed.exp fix up gdb.mi 2013-11-04 11:02:06 -07:00
mi-console.c gdb.mi/mi-console.c, gdb.mi/mi-stack.c: Remove local emacs variables defining change-log-default-name. 2013-10-29 13:48:25 +00:00
mi-console.exp
mi-disassemble.exp
mi-dprintf.c 2013-05-21 Hui Zhu <hui@codesourcery.com> 2013-05-21 04:18:55 +00:00
mi-dprintf.exp 2013-07-19 Hui Zhu <hui@codesourcery.com> 2013-07-19 07:26:46 +00:00
mi-eval.exp
mi-file-transfer.exp fix up gdb.mi 2013-11-04 11:02:06 -07:00
mi-file.exp
mi-fill-memory.exp
mi-fullname-deleted.exp
mi-hack-cli.exp
mi-info-os.exp
mi-inheritance-syntax-error.cc
mi-inheritance-syntax-error.exp
mi-language.exp GDB/MI: Add new "--language LANG" command option. 2013-11-14 14:36:18 +04:00
mi-logging.exp fix up gdb.mi 2013-11-04 11:02:06 -07:00
mi-memory-changed.exp
mi-nonstop-exit.exp
mi-nonstop.exp
mi-ns-stale-regcache.exp
mi-nsintrall.exp
mi-nsmoribund.exp
mi-nsthrexec.exp
mi-pending.c
mi-pending.exp
mi-pendshr.c
mi-pthreads.exp
mi-read-memory.c
mi-read-memory.exp
mi-record-changed.exp
mi-reg-undefined.c Resue 'z' formatter from mi register display code. 2013-07-25 10:39:39 +00:00
mi-reg-undefined.exp Print registers not saved in the frame as "<not saved>" instead of "<optimized out>". 2013-10-02 16:15:46 +00:00
mi-reg-undefined.S Resue 'z' formatter from mi register display code. 2013-07-25 10:39:39 +00:00
mi-regs.exp
mi-return.exp
mi-reverse.exp Remove superfluous semicolons from testsuite throughout. 2013-06-07 17:31:09 +00:00
mi-simplerun.exp
mi-solib.exp
mi-stack.c gdb.mi/mi-console.c, gdb.mi/mi-stack.c: Remove local emacs variables defining change-log-default-name. 2013-10-29 13:48:25 +00:00
mi-stack.exp
mi-start.c Add support for --start option in -exec-run GDB/MI command. 2013-10-04 08:35:31 +00:00
mi-start.exp Add support for --start option in -exec-run GDB/MI command. 2013-10-04 08:35:31 +00:00
mi-stepi.exp
mi-stepn.c Fix formating in copyright headers. 2013-06-07 14:39:33 +00:00
mi-stepn.exp
mi-syn-frame.c
mi-syn-frame.exp
mi-until.exp
mi-var-block.exp
mi-var-child-f.exp * gdb.mi/mi-var-child-f.exp: Pass f90 to gdb_compile instead 2013-07-26 18:15:07 +00:00
mi-var-child.c
mi-var-child.exp
mi-var-cmd.exp gdb/testsuite/ 2013-07-24 09:17:15 +00:00
mi-var-cp.cc Fix formating in copyright headers. 2013-06-07 14:39:33 +00:00
mi-var-cp.exp
mi-var-create-rtti.c
mi-var-create-rtti.exp * gdb.mi/mi-var-create-rtti.exp: Create a variable of 2013-04-18 10:08:08 +00:00
mi-var-display.exp
mi-var-invalidate.exp
mi-var-rtti.cc Fix formating in copyright headers. 2013-06-07 14:39:33 +00:00
mi-var-rtti.exp
mi-watch-nonstop.exp
mi-watch.exp
mi2-amd64-entry-value.c
mi2-amd64-entry-value.exp
mi2-amd64-entry-value.s
mi2-prompt.exp
mi2-var-child.exp
non-stop-exit.c
non-stop.c
ns-stale-regcache.c Fix formating in copyright headers. 2013-06-07 14:39:33 +00:00
nsintrall.c
nsmoribund.c
nsthrexec.c
pending.c
pendshr1.c
pendshr2.c
pr11022.c Fix formating in copyright headers. 2013-06-07 14:39:33 +00:00
pr11022.exp
pthreads.c
solib-lib.c Fix formating in copyright headers. 2013-06-07 14:39:33 +00:00
solib-main.c Fix formating in copyright headers. 2013-06-07 14:39:33 +00:00
testcmds
until.c
var-cmd.c
watch-nonstop.c