Currently, Ada debugging requires the use of certain GNAT-specific
encodings, which are generated by the compiler. These encodings
were created a long time ago to work around the fairly limited
capabilities of the stabs debugging format. With DWARF, the vast
majority of the encodings could be abandoned in favor of a pure
DWARF approach.
In order to make it easier to evaluate the quality of the DWARF
debugging information generated by the compiler, and how the debugger
handles it, we are introducing a small Ada-specific maintenance
setting which changes the debugger's behavior to ignore descriptive
types. Descriptive types are artificial types generated by the
compiler purely to give the debugger hints as to how to properly
decode certain properties of a type. For instance, for array
types, it generates a parallel type whose name is the name of
the array suffixed with ___XA, whose contents tells us what
the array's index type is, and possibly its bounds. See GCC's
gcc/ada/exp_dbug.ads for the full description of all encodings.
This is only a first step, as this setting does not deactivate
all encodings; More settings dedicated to each type of encoding
will likely be implemented in the future, as we make progress.
gdb/ChangeLog:
* ada-lang.c (maint_set_ada_cmdlist, maint_show_ada_cmdlist):
New static globals.
(maint_set_ada_cmd, maint_show_ada_cmd): New functions.
(ada_ignore_descriptive_types_p): New static global.
(find_parallel_type_by_descriptive_type): Return immediately
if ada_ignore_descriptive_types_p is set.
(_initialize_ada_language): Register new commands "maintenance
set ada", "maintenance show ada", "maintenance set ada
ignore-descriptive-types" and "maintenance show ada
ignore-descriptive-types".
* NEWS: Add entry for new "maint ada set/show
ignore-descriptive-types" commands.
gdb/doc/ChangeLog:
* gdb.texinfo (Ada Glitches): Document the new "maint ada set/show
ignore-descriptive-types". commands.
Provide to_resume and to_wait target methods for the btrace record target
to allow reverse stepping and replay support.
Replay is limited in the sense that only stepping and source correlation
are supported. We do not record data and thus can not show variables.
Non-stop mode is not working. Do not allow record-btrace in non-stop mode.
2014-01-16 Markus Metzger <markus.t.metzger@intel.com>
* btrace.h (btrace_thread_flag): New.
(struct btrace_thread_info) <flags>: New.
* record-btrace.c (record_btrace_resume_thread)
(record_btrace_find_thread_to_move, btrace_step_no_history)
(btrace_step_stopped, record_btrace_start_replaying)
(record_btrace_step_thread, record_btrace_decr_pc_after_break)
(record_btrace_find_resume_thread): New.
(record_btrace_resume, record_btrace_wait): Extend.
(record_btrace_can_execute_reverse): New.
(record_btrace_open): Fail in non-stop mode.
(record_btrace_set_replay): Split into this, ...
(record_btrace_stop_replaying): ... this, ...
(record_btrace_clear_histories): ... and this.
(init_record_btrace_ops): Init to_can_execute_reverse.
* NEWS: Announce it.
testsuite/
* gdb.btrace/delta.exp: Check reverse stepi.
* gdb.btrace/tailcall.exp: Update. Add stepping tests.
* gdb.btrace/finish.exp: New.
* gdb.btrace/next.exp: New.
* gdb.btrace/nexti.exp: New.
* gdb.btrace/record_goto.c: Add comments.
* gdb.btrace/step.exp: New.
* gdb.btrace/stepi.exp: New.
* gdb.btrace/multi-thread-step.c: New.
* gdb.btrace/multi-thread-step.exp: New.
* gdb.btrace/rn-dl-bind.c: New.
* gdb.btrace/rn-dl-bind.exp: New.
* gdb.btrace/data.c: New.
* gdb.btrace/data.exp: New.
* gdb.btrace/Makefile.in (EXECUTABLES): Add new.
doc/
* gdb.texinfo: Document limited reverse/replay support
for target record-btrace.
The "record function-call-history" and "record instruction-history" commands
accept a range "begin, end". End is not included in both cases. Include it.
2014-01-16 Markus Metzger <markus.t.metzger@intel.com>
* record-btrace.c (record_btrace_insn_history_range): Include
end.
(record_btrace_insn_history_from): Adjust range.
(record_btrace_call_history_range): Include
end.
(record_btrace_call_history_from): Adjust range.
* NEWS: Announce changes.
testsuite/
* gdb.btrace/function_call_history.exp: Update tests.
* gdb.btrace/instruction_history.exp: Update tests.
doc/
* gdb.texinfo (Process Record and Replay): Update documentation.
Add a new modifier /c to the "record function-call-history" command to
indent the function name based on its depth in the call stack.
Also reorder the optional fields to have the indentation at the very beginning.
Prefix the insn range (/i modifier) with "inst ".
Prefix the source line (/l modifier) with "at ".
Change the range syntax from "begin-end" to "begin,end" to allow copy&paste to
the "record instruction-history" and "list" commands.
Adjust the respective tests and add new tests for the /c modifier.
2014-01-16 Markus Metzger <markus.t.metzger@intel.com>
* record.h (enum record_print_flag)
<record_print_indent_calls>: New.
* record.c (get_call_history_modifiers): Recognize /c modifier.
(_initialize_record): Document /c modifier.
* record-btrace.c (btrace_call_history): Add btinfo parameter.
Reorder fields. Optionally indent the function name. Update
all users.
* NEWS: Announce changes.
testsuite/
* gdb.btrace/function_call_history.exp: Fix expected field
order for "record function-call-history".
Add new tests for "record function-call-history /c".
* gdb.btrace/exception.cc: New.
* gdb.btrace/exception.exp: New.
* gdb.btrace/tailcall.exp: New.
* gdb.btrace/x86-tailcall.S: New.
* gdb.btrace/x86-tailcall.c: New.
* gdb.btrace/unknown_functions.c: New.
* gdb.btrace/unknown_functions.exp: New.
* gdb.btrace/Makefile.in (EXECUTABLES): Add new.
doc/
* gdb.texinfo (Process Record and Replay): Document new /c
modifier accepted by "record function-call-history".
Add /i modifier to "record function-call-history" example.
This patch fixes the grammar, and tries to do it in a way that makes
the logic behind the current implementation a little clearer.
gdb/doc/ChangeLog:
(from Yuanhui Zhang <asmwarrior@gmail.com>)
(from Joel Brobecker <brobecker@adacore.com>)
* gdb.texinfo (GDB/MI Output Syntax): Add some missing "nl"
markers. Remove one that was misplaced.
gdb/doc/
2014-01-10 Pedro Alves <palves@redhat.com>
* gdb.texinfo (Your Program's Environment) <set environment>:
Mention the shell, and point at 'set exec-wrapper'.
Consider the following declarations:
typedef long our_time_t;
our_time_t current_time = 1384395743;
The purpose of this patch is to allow the use of a pretty-printer
for variables of type our_time_t. Normally, pretty-printing sniffers
use the tag name in order to determine which, if any, pretty-printer
should be used. But in the case above, the tag name is not set, since
it does not apply to integral types.
This patch extends the gdb.Type list of attributes to also include
the name of the type, thus allowing the sniffer to match against
that name. With that change, I was able to write a pretty-printer
which displays our variable as follow:
(gdb) print current_time
$1 = Thu Nov 14 02:22:23 2013 (1384395743)
gdb/ChangeLog:
* python/py-type.c (typy_get_name): New function.
(type_object_getset): Add entry for attribute "name".
* NEWS: Add entry mentioning this new attribute.
gdb/doc/ChangeLog:
* gdb.texinfo (Types In Python): Document new attribute Types.name.
gdb/testsuite:
* gdb.python/py-pp-integral.c: New file.
* gdb.python/py-pp-integral.py: New file.
* gdb.python/py-pp-integral.exp: New file.
Tested on x86_64-linux.
The following patch ...
| commit 14e75d8ea4
| Date: Wed Apr 18 06:46:47 2012 +0000
|
| gdb/
| PR symtab/7259:
| [...]
... discussed under ...
[PATCH] Allow 64-bit enum values
http://www.sourceware.org/ml/gdb-patches/2012-03/msg00772.html
... introduced a change in the gdb.Fields API without documenting it:
| I took a separate approach from the one I took in:
|
| http://sourceware.org/ml/gdb-patches/2012-02/msg00403.html
|
| and removed the overloaded meaning of the bitpos location variable to
| fix PR symtab/7259. In the following patch, I introduce a separate
| field_location union member 'enumval' which can accept LONGEST and
| hence expand enum values to 64-bit signed values. With this change,
| bitpos now only is used for (non-negative) offsets into structures,
| since the other overload of bitpos (range bounds) were already
| separated into struct range_bound.
This patch updates the documentation to reflect that change.
gdb/doc/ChangeLog:
* gdb.texinfo (Types In Python): Fix the documentation of
attribute "bitpos" in class gdb.Field for enum types. Add
documentation for attribute "enumval" in that same class.
This is to make it easier to discover the various options displayed
by the -list-features command.
gdb/doc/ChangeLog:
* gdb.texinfo (GDB/MI Support Commands): Change @table into
@ftable.
* gdb.texinfo (Auto-loading): Move menu up. Move discussion of
auto-loaded objfile scripts and .debug_gdb_scripts section to their
corresponding section in Extending GDB.
(Extending GDB): Move menu up. New menu item "Auto-loading
extensions".
(Sequences): New menu item "Auto-loading sequences".
(Auto-loading sequences): New node.
(Python): Rename section from Scripting GDB to Extending GDB.
(Python Auto-loading): Update xref, refer to "Auto-loading extensions".
Move docs on ways to auto-load extensions to ...
(Auto-loading extensions): ... here. New node.
A number of commands provide the capability to query the debugger
about support for various features, and one of them in particular
(-list-features), is expected to grow as new features get added.
-list-target-features should also grow a bit over time, but probably
slower.
These commands deserve their own section and @node.
gdb/doc/ChangeLog:
* gdb.texinfo (GDB/MI): Add "GDB/MI Support Commands" entry
in menu.
(GDB/MI Variable Objects): Adjust reference to "-list-features"
command, now in a new node.
(GDB/MI Support Commands): New node, with its contents being
extracted from the "GDB/MI Miscellaneous Commands" node.
A small paragraph introducing the section is also added at
the start.
(GDB/MI Miscellaneous Commands): Delete the description of the
-info-gdb-mi-command, -list-features and -list-target-features
commands, now hosted in the "GDB/MI Support Commands" node.
PR python/16113
* NEWS (Python Scripting): Add entry for the new feature and the
new attribute of gdb.Field objects.
* python/py-type.c (gdbpy_is_field): New function
(convert_field): Add 'parent_type' attribute to gdb.Field
objects.
* python/py-value.c (valpy_getitem): Allow subscript value to be
a gdb.Field object.
(value_has_field): New function
(get_field_flag): New function
* python/python-internal.h (gdbpy_is_field): Add declaration.
testsuite/
* gdb.python/py-value-cc.cc: Improve test case.
* gdb.python/py-value-cc.exp: Add new tests to test usage of
gdb.Field objects as subscripts on gdb.Value objects.
doc/
* gdb.texinfo (Values From Inferior): Add a note about using
gdb.Field objects as subscripts on gdb.Value objects.
(Types In Python): Add description about the new attribute
"parent_type" of gdb.Field objects.
This adds "exec-run-start-option" in the output of the -list-features
commands, allowing front-ends to easily determine whether -exec-run
supports the --start option.
gdb/ChangeLog:
* mi/mi-main.c (mi_cmd_list_features): add "exec-run-start-option".
* NEWS: Expand the entry documenting the new -exec-run --start
option to mention the corresponding new entry in the output of
"-list-features".
gdb/doc/ChangeLog:
* gdb.texinfo (GDB/MI Miscellaneous Commands): Document the new
"exec-run-start-option" entry in the output of the "-list-features"
command.
gdb/testsuite/ChangeLog:
* gdb.mi/mi-start.exp: Add test verifying that -list-features
contains "exec-run-start-option".
I wanted to find the docs for "catch load" the other day, and I found
out that this isn't in the index. It seems to me that each command
ought to be in the index for quick reference like this, so this patch
adds an @kindex (chosen because it seems to be what the rest of the
manual does) for each "catch" subcommand.
2013-12-03 Tom Tromey <tromey@redhat.com>
* gdb.texinfo (Set Catchpoints): Add @kindex for each command
documented here.
I happened to notice that the gdbserver program doesn't appear in the
top-level "dir" file. This adds an entry for it to the gdb manual.
2013-12-03 Tom Tromey <tromey@redhat.com>
* gdb.texinfo (@direntry): Add menu item for gdbserver.
Now that the -info-gdb-mi-command is available, there is no need for
this entry. The entry and associated new commands were added recently
enough that no front-end out there should be depending on it yet.
gdb/ChangeLog:
* mi/mi-main.c (mi_cmd_list_features): Remove "ada-exceptions".
gdb/doc/ChangeLog:
* gdb.texinfo (GDB/MI Miscellaneous Commands): Remove the
documentation of the "ada-exceptions" entry.
... when trying to execute an undefined GDB/MI command. When trying
to execute a GDB/MI command which does not exist, the current error
result record looks like this:
-unsupported
^error,msg="Undefined MI command: unsupported"
The only indication that the command does not exist is the error
message. It would be a little fragile for a consumer to rely solely
on the contents of the error message in order to determine whether
a command exists or not.
This patch improves the situation by adding concept of error
code, starting with one well-defined error code ("undefined-command")
identifying errors due to a non-existant command. Here is the new
output:
-unsupported
^error,msg="Undefined MI command: unsupported",code="undefined-command"
This error code is only displayed when the corresponding error
condition is met. Otherwise, the error record remains unchanged.
For instance:
-symbol-list-lines foo.adb
^error,msg="-symbol-list-lines: Unknown source file name."
For frontends to be able to know whether they can rely on this
variable, a new entry "undefined-command-error-code" has been
added to the "-list-features" command. Another option would be
to always generate an error="..." variable (for the default case,
we could decide for instance that the error code is the empty string).
But it seems more efficient to provide that info in "-list-features"
and then only add the error code when meaningful.
gdb/ChangeLog:
(from Pedro Alves <palves@redhat.com>)
(from Joel Brobecker <brobecker@adacore.com>)
* exceptions.h (enum_errors) <UNDEFINED_COMMAND_ERROR>: New enum.
* mi/mi-parse.c (mi_parse): Throw UNDEFINED_COMMAND_ERROR instead
of a regular error when the GDB/MI command does not exist.
* mi/mi-main.c (mi_cmd_list_features): Add
"undefined-command-error-code".
(mi_print_exception): Print an "undefined-command"
error code if EXCEPTION.ERROR is UNDEFINED_COMMAND_ERROR.
* NEWS: Add entry documenting the new "code" variable in
"^error" result records.
gdb/doc/ChangeLog:
* gdb.texinfo (GDB/MI Result Records): Fix the syntax of the
"^error" result record concerning the error message. Document
the error code that may also be part of that result record.
(GDB/MI Miscellaneous Commands): Document the
"undefined-command-error-code" element in the output of
the "-list-features" GDB/MI command.
gdb/testsuite/ChangeLog:
* gdb.mi/mi-undefined-cmd.exp: New testcase.
This patch adds a new GDB/MI command meant for graphical frontends
trying to determine whether a given GDB/MI command exists or not.
Examples:
-info-gdb-mi-command unsupported-command
^done,command={exists="false"}
(gdb)
-info-gdb-mi-command symbol-list-lines
^done,command={exists="true"}
(gdb)
At the moment, this is the only piece of information that this
command returns.
Eventually, and if needed, we can extend it to provide
command-specific pieces of information, such as updates to
the command's syntax since inception. This could become,
for instance:
-info-gdb-mi-command symbol-list-lines
^done,command={exists="true",features=[]}
(gdb)
-info-gdb-mi-command catch-assert
^done,command={exists="true",features=["conditions"]}
In the first case, it would mean that no extra features,
while in the second, it announces that the -catch-assert
command in this version of the debugger supports a feature
called "condition" - exact semantics to be documented with
combined with the rest of the queried command's documentation.
But for now, we start small, and only worry about existance.
And to bootstrap the process, I have added an entry in the
output of the -list-features command as well ("info-gdb-mi-command"),
allowing the graphical frontends to go through the following process:
1. Send -list-features, collect info from there as before;
2. Check if the output contains "info-gdb-mi-command".
If it does, then support for various commands can be
queried though -info-gdb-mi-command. Newer commands
will be expected to always be checked via this new
-info-gdb-mi-command.
gdb/ChangeLog:
* mi/mi-cmds.h (mi_cmd_info_gdb_mi_command): Declare.
* mi/mi-cmd-info.c (mi_cmd_info_gdb_mi_command): New function.
* mi/mi-cmds.c (mi_cmds): Add -info-gdb-mi-command command.
* mi/mi-main.c (mi_cmd_list_features): Add "info-gdb-mi-command"
field to output of "-list-features".
* NEWS: Add entry for new -info-gdb-mi-command.
gdb/doc/ChangeLog:
* gdb.texinfo (GDB/MI Miscellaneous Commands): Document
the new -info-gdb-mi-command GDB/MI command. Document
the meaning of "-info-gdb-mi-command" in the output of
-list-features.
gdb/testsuite/ChangeLog:
* gdb.mi/mi-i-cmd.exp: New file.
Unfortunately, UNWIND_NULL_ID is exported to Python as
gdb.FRAME_UNWIND_NULL_ID so we can't really eliminate it.
(I'd assume scripts just check the result of Frame.unwind_stop_reason,
and compare it to gdb.FRAME_UNWIND_NO_REASON. That at most, they'll
pass the result of Frame.unwind_stop_reason to
gdb.frame_stop_reason_string. I'd prefer to just get rid of it, but
because we make an API promise, we get to keep this around for
compatibility, in case a script does refer to gdb.FRAME_UNWIND_NULL_ID
directly.)
gdb/
2013-11-29 Pedro Alves <palves@redhat.com>
* unwind_stop_reasons.def (UNWIND_NULL_ID): Update comment.
gdb/doc/
2013-11-29 Pedro Alves <palves@redhat.com>
* gdb.texinfo (Frames In Python) <gdb.FRAME_UNWIND_NULL_ID>:
Update comment.
Similar to stack cache, in this patch, we add
TARGET_OBJECT_CODE_MEMORY to read code from target and add a new
option "set code-cache on|off" to optimize code accesses by
using the target memory cache.
In V4:
- Remove "without affecting correctness" from NEWS and doc.
- Replace "ON" with "on" in doc.
- "access" -> "accesses".
In V3:
- Rename functions and variables.
- Update command help, doc and NEWS entry.
- Invalidate cache on option transitions, to align with
the behaviour of "stack-cache". Since cache invalidation is
transparent to users, users don't know option "stack-cache"
transitions cause code cache invalidation.
V2 was reviewed by Doug. There are some changes in V3, so I post it
here.
gdb:
2013-11-24 Yao Qi <yao@codesourcery.com>
* NEWS: Add note on new "set code-cache" option.
* target-dcache.c (code_cache_enabled_1): New variable.
(code_cache_enabled): New variable.
(show_code_cache, set_code_cache): New function.
(code_cache_enabled_p): New function.
(_initialize_target_dcache): Register command.
* target-dcache.h (code_cache_enabled_p): Declare.
* target.c (memory_xfer_partial_1):Handle
TARGET_OBJECT_CODE_MEMORY and code_cache_enabled.
(target_read_code): New function.
* target.h (enum target_object) <TARGET_OBJECT_CODE_MEMORY>:
New.
(target_read_code): Declare.
gdb/doc:
2013-11-24 Yao Qi <yao@codesourcery.com>
* gdb.texinfo (Caching Remote Data): Document new
"set/show stack-cache" option.
gdb/doc:
2013-11-24 Yao Qi <yao@codesourcery.com>
* gdb.texinfo (Caching Target Data): Replace "ON" with "on".
(Maintenance Commands): Replace "ON" and "OFF" with "on" and
"off" respectively.
Hi,
When using command -var-list-children, "displayhint" appears in the result of
each child, shown as the following output.
-var-list-children ss1 ^M
^done,numchild="2",displayhint="pp_ss",children=[child={name="ss1.a",exp="a",numchild="0",type="struct s",thread-id="1",displayhint="pp_s",dynamic="1"},child={name="ss1.b",exp="b",numchild="0",type="struct s",thread-id="1",displayhint="pp_s",dynamic="1"}],has_more="0"
Current doc on command -var-list-children doesn't reflect this. This
patch is to fix it.
gdb/doc:
2013-11-23 Yao Qi <yao@codesourcery.com>
* gdb.texinfo (GDB/MI Variable Objects): Add the description
of "displayhint" to the table about child results.
Hi,
I find "dynamic=1" appear in the result of each child of the output of
-var-list-children,
-var-list-children ss1
^done,numchild="2",children=[child={name="ss1.a",exp="a",numchild="0",type="struct s",thread-id="1",dynamic="1"},child={name="ss1.b",exp="b",numchild="0",type="struct s",thread-id="1",dynamic="1"}],has_more="0"
but the doc doesn't mention this. This patch is to copy the description
of "dynamic=1" here.
gdb/doc:
2013-11-21 Yao Qi <yao@codesourcery.com>
* gdb.texinfo (GDB/MI Variable Objects): Add attribute 'dynamic'
for the output of command -var-list-children.
Looks "see" is unnecessary before @pxref.
gdb/doc:
2013-11-21 Yao Qi <yao@codesourcery.com>
* gdb.texinfo (Caching Target Data): Remove "see" before
@pxref.
Hi,
Nowadays, 'target_dcache' is a global variable in GDB, which is not
necessary. It can be a per-address-space variable. In this patch, we
associate target_dcache to address_space.
gdb/doc:
2013-11-20 Yao Qi <yao@codesourcery.com>
* gdb.texinfo (Caching Target Data): Update doc for
per-address-space dcache.
gdb:
2013-11-20 Yao Qi <yao@codesourcery.com>
* progspace.h (struct address_space_data): Declare.
* target-dcache.c: Include "progspace.h".
(target_dache): Remove.
(target_dcache_aspace_key): New.
(target_dcache_cleanup): New function.
(target_dcache_init_p): Get data through
target_dcache_aspace_key.
(target_dcache_invalidate): Likewise.
(target_dcache_get): Likewise.
(target_dcache_get_or_init): Likewise.
(_initialize_target_dcache): Initialize
target_dcache_aspace_key.
When I try to describe the cache and its related commands (in a
cache-per-address-space world), I find hard to add, because
existing doc is focused on remote debugging, while data cache is used
regardless of the target. More precisely, GDB cache target data,
instead of remote data.
gdb/doc:
2013-11-20 Yao Qi <yao@codesourcery.com>
* gdb.texinfo (Data): Rename menu item.
(Caching Remote Data): Rename to ...
(Caching Target Data): ... it. Update.
Following the addition of the --language optiton to all GDB/MI
commands, I realized that there was no easy way for front-ends
to figure out whether this features is available or not. So I added
a "language-option" entry to -list-features.
gdb/ChangeLog:
* mi/mi-main.c (mi_cmd_list_features): Add "language-options"
to -list-features output.
gdb/doc/ChangeLog:
* gdb.texinfo (GDB/MI Miscellaneous Commands): Document the new
"language-option" entry in the output of the "-list-features"
command.
This patch fixes PR c++/16117.
gdb has an extension so that users can use expressions like FILE::NAME
to choose a variable of the given name from the given file. The bug
is that this extension takes precedence over ordinary C++ expressions
of the same form. You might think this is merely hypothetical, but
now that C++ headers commonly do not use an extension, it is more
common.
This patch fixes the bug by making two related changes. First, it
changes gdb to prefer the ordinary C++ meaning of a symbol over the
extended meaning. Second, it arranges for single-quoting of the
symbol to indicate a preference for the extension.
Built and regtested on x86-64 Fedora 18.
New test case included.
2013-11-15 Tom Tromey <tromey@redhat.com>
PR c++/16117:
* c-exp.y (lex_one_token): Add "is_quoted_name" argument.
(classify_name): Likewise. Prefer a field of "this" over a
filename.
(classify_inner_name, yylex): Update.
2013-11-15 Tom Tromey <tromey@redhat.com>
* gdb.texinfo (Variables): Note gdb rules for ambiguous cases.
Add example.
2013-11-15 Tom Tromey <tromey@redhat.com>
* gdb.cp/includefile: New file.
* gdb.cp/filename.exp: New file.
* gdb.cp/filename.cc: New file.
This patch fixes a buglet in the manual.
It's wrong to say that a method is defined "as" a subclass.
Instead it should say that a method is defined "in" a subclass.
I'm checking this in under the obvious rule.
2013-11-14 Tom Tromey <tromey@redhat.com>
* gdb.texinfo (Breakpoints In Python): Replace "as" with "in".
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.
Rather than having -list-features report support for the GDB/MI
commands providing access to Ada exception catchpoints with one entry,
and the GDB/MI command providing the list of Ada exceptions with
a second entry, this patch merges it all within one single entry.
This is OK, because all these commands were added within a short
amount of time, and within the same release cycle; and it reduces
a bit the size of the output.
gdb/ChangeLog:
* mi/mi-main.c (mi_cmd_list_features): Replace "info-ada-exceptions"
entry with "ada-exceptions".
gdb/doc/ChangeLog:
* gdb.texinfo (GDB/MI Miscellaneous Commands): Delete
the documentation of "info-ada-exceptions" in the output
of the "-list-features" command. Add the documentation
of the "ada-exception" entry instead.
gdb/doc/ChangeLog:
* gdb.texinfo (Ada): Add entry in menu for new "Ada Exceptions" node.
(Ada Exceptions): New node.
(GDB/MI): Add entry in menu for new "GDB/MI Ada Exceptions
Commands" node.
(GDB/MI Ada Exceptions Commands): New node.
(GDB/MI Miscellaneous Commands): Document new "info-ada-exceptions"
field in the output of the "-list-features" command.
* NEWS: Add entry for the new "info exceptions" CLI command,
and for the new "-info-ada-exceptions" GDB/MI command.
* dwarf2read.c (dwarf2_read_debug): Change to unsigned int.
(create_debug_types_hash_table): Only print debugging messages for
each TU if dwarf2-read >= 2.
(process_queue): Ditto.
(_initialize_dwarf2_read): Make "set debug dwarf2-read" a zuinteger.
Update doc string.
doc/
* gdb.texinfo (Debugging Output): Update text for
"set debug dwarf2-read".
* python/py-breakpoint.c (bppy_get_temporary): New function.
(bppy_init): New keyword: temporary. Parse it and set breakpoint
to temporary if True.
2013-11-07 Phil Muldoon <pmuldoon@redhat.com>
* gdb.python/py-breakpoint.exp: Add temporary breakpoint tests.
2013-11-07 Phil Muldoon <pmuldoon@redhat.com>
* gdb.texinfo (Breakpoints In Python): Document temporary
option in breakpoint constructor, and add documentation to the
temporary attribute.
This patch does some cleanups, removing some language-related stuff.
Note that mi_cmd_var_info_expression uses varobj_language_string,
which is redundant, because we can get language name from
lang->la_natural_name.
varobj_language_string doesn't have "Ada", which looks like a bug to
me. With this patch applied, this problem doesn't exist, because the
language name is got from the same place (field la_natural_name).
gdb:
2013-11-07 Yao Qi <yao@codesourcery.com>
* mi/mi-cmd-var.c: Include "language.h".
(mi_cmd_var_info_expression): Get language name from
language_defn.
* varobj.c (varobj_language_string): Remove.
(variable_language): Remove declaration.
(languages): Remove.
(varobj_get_language): Change the type of return value.
(variable_language): Remove.
* varobj.h (enum varobj_languages): Remove.
(varobj_language_string): Remove declaration.
(varobj_get_language): Update declaration.
gdb/doc:
2013-11-07 Yao Qi <yao@codesourcery.com>
* gdb.texinfo (GDB/MI Variable Objects): Update doc about the
output of "-var-info-expression".
When Bash is started non-interactively, it runs the script pointed by
the BASH_ENV environment variable, not .bashrc. While at it, mention
Z shell in the warning too, and mention non-interactive mode
explicitly.
gdb/doc/
2013-11-06 Pedro Alves <palves@redhat.com>
* gdb.texinfo (Starting) <set/show startup-with-shell>: Mention
non-interactive mode.
(Environment) <shell startup files warning>: Mention
non-interactive mode. Mention .zshenv for Z shell, and talk about
BASH_ENV instead of .bashrc for BASH.
Occasionaly we hear about people having problems with GDB not being
able to start programs (with "run"/"start"). GDB spawns a shell to
start the program, and most often, it'll be the case that the problem
is actually with the user's shell setup.
GDB has code to disable the use of the shell to start programs.
That's the STARTUP_WITH_SHELL macro that native targets could set to 0
in their nm.h file (though no target actually uses it nowadays).
This patch makes that setting a run-time knob instead. This will be
useful to quickly diagnose such shell issues, and might also come in
handy at other times (such as when debugging the shell itself, if you
don't have a different shell handy).
gdb/
2013-10-24 Pedro Alves <palves@redhat.com>
* NEWS (New options): Mention set/show startup-with-shell.
* config/alpha/nm-osf3.h (START_INFERIOR_TRAPS_EXPECTED): Set to 2
instead of 3.
* fork-child.c (fork_inferior, startup_inferior): Handle 'set
startup-with-shell'.
(show_startup_with_shell): New function.
(_initialize_fork_child): Register the set/show startup-with-shell
commands.
* inf-ptrace.c (inf_ptrace_create_inferior): Remove comment.
* inf-ttrace.c (inf_ttrace_him): Remove comment.
* procfs.c (procfs_init_inferior): Remove comment.
* infcmd.c (startup_with_shell): New global.
* inferior.h (startup_with_shell): Declare global.
(STARTUP_WITH_SHELL): Delete.
(START_INFERIOR_TRAPS_EXPECTED): Set to 1 by default instead of 2.
gdb/doc/
2013-10-24 Pedro Alves <palves@redhat.com>
* gdb.texinfo (Starting): Document set/show startup-with-shell.