403cb6b138
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. |
||
---|---|---|
.. | ||
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 | ||
Makefile.in | ||
mi-async.exp | ||
mi-basics.exp | ||
mi-break.exp | ||
mi-breakpoint-changed.exp | ||
mi-catch-load-so.c | ||
mi-catch-load.c | ||
mi-catch-load.exp | ||
mi-cli.exp | ||
mi-cmd-param-changed.exp | ||
mi-console.c | ||
mi-console.exp | ||
mi-disassemble.exp | ||
mi-dprintf.c | ||
mi-dprintf.exp | ||
mi-eval.exp | ||
mi-file-transfer.exp | ||
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 | ||
mi-logging.exp | ||
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 | ||
mi-reg-undefined.exp | ||
mi-reg-undefined.S | ||
mi-regs.exp | ||
mi-return.exp | ||
mi-reverse.exp | ||
mi-simplerun.exp | ||
mi-solib.exp | ||
mi-stack.c | ||
mi-stack.exp | ||
mi-start.c | ||
mi-start.exp | ||
mi-stepi.exp | ||
mi-stepn.c | ||
mi-stepn.exp | ||
mi-syn-frame.c | ||
mi-syn-frame.exp | ||
mi-until.exp | ||
mi-var-block.exp | ||
mi-var-child-f.exp | ||
mi-var-child.c | ||
mi-var-child.exp | ||
mi-var-cmd.exp | ||
mi-var-cp.cc | ||
mi-var-cp.exp | ||
mi-var-create-rtti.c | ||
mi-var-create-rtti.exp | ||
mi-var-display.exp | ||
mi-var-invalidate.exp | ||
mi-var-rtti.cc | ||
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 | ||
nsintrall.c | ||
nsmoribund.c | ||
nsthrexec.c | ||
pending.c | ||
pendshr1.c | ||
pendshr2.c | ||
pr11022.c | ||
pr11022.exp | ||
pthreads.c | ||
solib-lib.c | ||
solib-main.c | ||
testcmds | ||
until.c | ||
var-cmd.c | ||
watch-nonstop.c |