Age | Commit message (Collapse) | Author | Files | Lines |
|
Readline 8.0 has a feature that lets an application name a keymap.
This in turn makes it simpler for users to bind keys in keymaps in
their .inputrc.
This patch gives a name to the TUI SingleKey keymap, so that
additional bindings can be made there. For example:
$if gdb
set keymap SingleKey
"X": "echo hello\\n\n"
$endif
The call to rl_initialize, in tui_initialize_readline, had to be
removed so that .inputrc was not read too early. Note that Readline
explicitly documents that this call is not needed.
gdb/ChangeLog
2019-09-18 Tom Tromey <tom@tromey.com>
* NEWS: Add entry.
* tui/tui.c (tui_initialize_readline): Set name of keymap. Do not
call rl_initialize.
(tui_enable): Do not call rl_initialize.
gdb/doc/ChangeLog
2019-09-18 Tom Tromey <tom@tromey.com>
* gdb.texinfo (Editing): Document readline application name.
(TUI Single Key Mode): Document TUI SingleKey keymap name.
|
|
The 'directory' command allows the user to provide a list of filesystem
directories in which to search for source code. The directories in this
search path are used as the base directory for the source filename from
the debug information (DW_AT_name). Thus the directory search path
provides alternatives to the existing compilation directory from the
debug information (DW_AT_comp_dir). Generally speaking, DW_AT_name
stores the filename argument passed to the compiler (including any
directory components), and DW_AT_comp_dir stores the current working
directory from which the compiler was executed. For example:
$ cd /path/to/project/subdir1
$ gcc -c a/test.c -g
The corresponding debug information will look like this:
DW_AT_name : a/test.c
DW_AT_comp_dir : /path/to/project/subdir1
When compiling with the -fdebug-prefix-map GCC option, the compilation
directory can be arbitrarily rewritten. In the above example, we may
rewrite the compilation directory as follows:
$ gcc -c a/test.c -g -fdebug-prefix-map=/path/to/project=
In this case, the corresponding debug information will look like:
DW_AT_name : a/test.c
DW_AT_comp_dir : /subdir1
This prevents GDB from finding the corresponding source code based on
the debug information alone. In some cases, a substitute-path command
can be used to re-map a consistent prefix in the rewritten compilation
directory to the real filesystem path. However, there may not be a
consistent prefix remaining in the debug symbols (for example in a
project that has source code in many subdirectories under the project's
root), thereby requiring multiple substitute-path rules. In this case,
it is easier to add the missing prefix to the directory search path via
the 'directory' command.
The function find_and_open_source currently searches in:
SEARCH_PATH/FILENAME
where SEARCH_PATH corresponds to each individual entry in the directory
search path (which is guaranteed to contain the compilation directory
from the debug information, as well as the current working directory).
FILENAME corresponds to the source filename (DW_AT_name), which may have
directory components in it. In addition, GDB searches in:
SEARCH_PATH/FILE_BASENAME
where FILE_BASENAME is the basename of the DW_AT_name entry.
This change modifies find_and_open_source to additionally search in:
SEARCH_PATH/COMP_DIR/FILENAME
where COMP_DIR is the compilation directory from the debug symbols. In
the example given earlier, running:
(gdb) directory /path/to/project
will now allow GDB to correctly locate the source code from the debug
information.
gdb/ChangeLog:
* source.c (prepare_path_for_appending): New function.
(openp): Make use of new function.
(find_and_open_source): Search for the compilation directory and
source file as a relative path beneath the directory search path.
gdb/doc/ChangeLog:
* gdb.texinfo (Source Path): Additional text to better describe
how the source path directory list is used when searching for
source files.
gdb/testsuite/ChangeLog:
* gdb.base/source-dir.exp: Add extra test for mapped compilation
directory.
|
|
With this patch, we e.g. get:
[Switching to task 2 "task_list(1)"]
[Current task is 2 "task_list(1)"]
instead of
[Switching to task 2]
[Current task is 2]
The logic to produce the taskno optionally followed
by the task name has been factorized in the task_to_str function.
Task names are output between double quotes in the new messages,
similarly to what GDB does for thread names.
However, no quotes are put around task names in 'info tasks' Name column.
This was discussed with Tom, that preferred no quotes there, while I
was more in favour of visual consistency.
I discussed with a few more users, which led to (exactly) 50% preferring
quotes and 50% preferring no quotes :).
To arrive to the decision to remove the quotes, the following "killing args"
were used:
* To have quotes or to not have quotes, that is the question; yes
but not *THE* question :).
* If there is not a clear majority that prefers quotes, better to
not disturb the existing user basis for a (somewhat) irrelevant
aspect.
* The opinion of the reviewer has more weight.
So, compared to the previous version, this version remotes the quotes
in 'info tasks'.
It improves the alignement of 'info tasks' output.
With this patch, we get:
(gdb) info task
ID TID P-ID Pri State Name
* 1 555555759030 48 Runnable main_task
2 555555759e30 1 48 Selective Wait mit
(gdb)
instead of
(gdb) info task
ID TID P-ID Pri State Name
* 1 555555759030 48 Runnable main_task
2 555555759e30 1 48 Selective Wait mit
(gdb)
(e.g. the first one properly shows parent and priority under the
correct header).
This is version 4 of the 'task name' patch.
Compared to version 3, the changes are:
output task names between quotes but not in 'info tasks'
gdb/ChangeLog
2019-09-12 Philippe Waroquiers <philippe.waroquiers@skynet.be>
* NEWS: Announce that Ada task names are now shown at more places,
and between quotes (except in info task output).
* gdb/ada-tasks.c (task_to_str): New function.
(display_current_task_id): Call task_to_str.
(task_command_1): Likewise.
(print_ada_task_info): In non-mi mode, Properly align headers and data
when task-id length is > 9 (9 is the default for a 32 bits CORE_ADDR).
gdb/doc/ChangeLog
2019-09-12 Philippe Waroquiers <philippe.waroquiers@skynet.be>
* gdb.texinfo (Ada Tasks): Tell the task name is printed, update
examples.
gdb/testsuite/ChangeLog
2019-09-12 Philippe Waroquiers <philippe.waroquiers@skynet.be>
* gdb.ada/rdv_wait.exp: Update to new task names.
* gdb.base/task_switch_in_core.exp: Likewise.
* gdb.base/info_sources_base.c: Likewise.
|
|
This updates the "save gdb-index" documentation to reflect the new
state of Ada support. It also corrects an existing grammatical error.
gdb/doc/ChangeLog
2019-09-10 Tom Tromey <tromey@adacore.com>
* gdb.texinfo (Index Files): Update Ada text.
|
|
The 'info variables', its alias 'whereis', and 'info functions' all
include non-debug symbols in the output by default. The list of
non-debug symbols can sometimes be quite long, resulting in the
debug symbol based results being scrolled off the screen.
This commit adds a '-n' flag to all of the commands listed above that
excludes the non-debug symbols from the results, leaving just the
debug symbol based results.
gdb/ChangeLog:
* cli/cli-utils.c (info_print_options_defs): Delete.
(make_info_print_options_def_group): Delete.
(extract_info_print_options): Delete.
(info_print_command_completer): Delete.
(info_print_args_help): Add extra parameter, and optionally
include text about -n flag.
* cli/cli-utils.h (struct info_print_options): Delete.
(extract_info_print_options): Delete declaration.
(info_print_command_completer): Delete declaration.
(info_print_args_help): Add extra parameter, extend header
comment.
* python/python.c (gdbpy_rbreak): Pass additional parameter to
search_symbols.
* stack.c (struct info_print_options): New type.
(info_print_options_defs): New file scoped variable.
(make_info_print_options_def_group): New static function.
(info_print_command_completer): New static function.
(info_locals_command): Update to use new local functions.
(info_args_command): Likewise.
(_initialize_stack): Add extra parameter to calls to
info_print_args_help.
* symtab.c (search_symbols): Add extra parameter, use this to
possibly excluse non-debug symbols.
(symtab_symbol_info): Add extra parameter, which is passed on to
search_symbols.
(struct info_print_options): New type.
(info_print_options_defs): New file scoped variable.
(make_info_print_options_def_group): New static function.
(info_print_command_completer): New static function.
(info_variables_command): Update to use local functions, and pass
extra parameter through to symtab_symbol_info.
(info_functions_command): Likewise.
(info_types_command): Pass additional argument through to
symtab_symbol_info.
(rbreak_command): Pass extra argument to search_symbols.
(_initialize_symtab): Add extra arguments for calls to
info_print_args_help, and update help text for 'info variables',
'whereis', and 'info functions' commands.
* symtab.h (search_symbols): Add extra argument to declaration.
* NEWS: Mention new flags.
gdb/doc/ChangeLog:
* gdb.texinfo (Symbols): Add information about the -n flag to
"info variables" and "info functions".
gdb/testsuite/ChangeLog:
* gdb.base/info-fun.exp: Extend to test the -n flag for 'info
functions'. Reindent as needed.
* gdb.base/info-var-f1.c: New file.
* gdb.base/info-var-f2.c: New file.
* gdb.base/info-var.exp: New file.
* gdb.base/info-var.h: New file.
|
|
gdb/ChangeLog
2019-08-25 Yoshinori Sato <ysato@users.sourceforge.jp>
* gdb/rx-tdep.c (rx_register_names): New.
(rx_register_name): Delete.
(rx_psw_type): Delete.
(rx_fpsw_type): Delete.
(rx_register_type): Delete.
(rx_gdbarch_init): Convert target-descriptions.
(_initialize_rx_tdep): Add initialize_tdesc_rx.
* gdb/features/Makefile: Add rx.xml.
* gdb/features/rx.xml: New.
* gdb/features/rx.c: Generated.
* gdb/NEWS: Mention target description support.
gdb/doc/ChangeLog:
2019-08-25 Yoshinori Sato <ysato@users.sourceforge.jp>
* gdb.texinfo (Standard Target Features): Add RX Features sub-section.
|
|
Add a new print_pc which prints both the PC and a new field addr_flags.
Call this wherever the PC is printed in stack.c.
Add a new gdbarch method get_pc_address_flags to obtain the addr_flag
contents. By default returns an empty string, on AArch64 this returns
PAC if the address has been masked in the frame.
Document this in the manual and NEWS file.
gdb/ChangeLog:
* NEWS (Other MI changes): New subsection.
* aarch64-tdep.c (aarch64_get_pc_address_flags): New function.
(aarch64_gdbarch_init): Add aarch64_get_pc_address_flags.
* arch-utils.c (default_get_pc_address_flags): New function.
* arch-utils.h (default_get_pc_address_flags): New declaration.
* gdbarch.sh: Add get_pc_address_flags.
* gdbarch.c: Regenerate.
* gdbarch.h: Likewise.
* stack.c (print_pc): New function.
(print_frame_info) (print_frame): Call print_pc.
gdb/doc/ChangeLog:
* gdb.texinfo (AArch64 Pointer Authentication)
(GDB/MI Breakpoint Information) (Frame Information): Document
addr_field.
|
|
This changes gdb to require readline 7 or newer at build time.
gdb/ChangeLog
2019-08-12 Tom Tromey <tom@tromey.com>
* configure: Rebuild.
* configure.ac: Check for readline 7.
* NEWS: Mention readline 7 requirement.
* README: Update.
gdb/doc/ChangeLog
2019-08-12 Tom Tromey <tom@tromey.com>
* gdb.texinfo (Configure Options): Document minimum version of
readline.
|
|
gdb/doc/ChangeLog:
* gdb.texinfo (AArch64 Pointer Authentication): Fix typo.
|
|
Armv8.3-a Pointer Authentication causes the function return address to be
obfuscated on entry to some functions. GDB must unmask the link register in
order to produce a backtrace.
The following patch adds markers of [PAC] to the bracktrace, to indicate
which addresses needed unmasking. This includes the backtrace when using MI.
For example, consider the following backtrace:
(gdb) bt
0 0x0000000000400490 in puts@plt ()
1 0x00000000004005dc in foo ("hello") at cbreak-lib.c:6
2 0x0000000000400604 [PAC] in bar () at cbreak-lib.c:12
3 0x0000000000400620 [PAC] in main2 () at cbreak.c:17
4 0x00000000004005b4 in main () at cbreak-3.c:10
The functions in cbreak-lib use pointer auth, which masks the return address
to the previous function, causing the addresses of bar (in the library) and main2
(in the main binary) to require unmasking in order to unwind the backtrace.
An extra bool is added alongside the prev_pc in the frame structure. At the
point at which the link register is unmasked, the AArch64 port calls into frame
to sets the bool. This is the most efficient way of doing it.
The marker is also added to the python frame printer, which is always printed if
set. The marker is not explicitly exposed to the python code.
I expect this will potentially cause issues with some tests in the testsuite
when Armv8.3 pointer authentication is used. This should be fixed up in the
the future once real hardware is available for full testsuite testing.
gdb/ChangeLog:
* NEWS: Expand the Pointer Authentication entry.
* aarch64-tdep.c (aarch64_frame_unmask_address): Rename from this.
(aarch64_frame_unmask_lr): ... to this.
(aarch64_prologue_prev_register, aarch64_dwarf2_prev_register):
Call aarch64_frame_unmask_lr.
* frame.c (struct frame_info): Add "masked" variable.
(frame_set_previous_pc_masked) (frame_get_pc_masked): New functions.
(fprint_frame): Check for masked pc.
* frame.h (frame_set_previous_pc_masked) (frame_get_pc_masked): New
declarations.
* python/py-framefilter.c (py_print_frame): Check for masked pc.
* stack.c (print_frame): Check for masked pc.
gdb/doc/ChangeLog:
* gdb.texinfo (AArch64 Pointer Authentication): New subsection.
|
|
Currently we support iteration on blocks; this patch extends that to make
subscript access work as well.
gdb/ChangeLog:
2019-08-05 Christian Biesinger <cbiesinger@google.com>
* NEWS: Mention dictionary access on blocks.
* python/py-block.c (blpy_getitem): New function.
(block_object_as_mapping): New struct.
(block_object_type): Use new struct for tp_as_mapping field.
gdb/doc/ChangeLog:
2019-08-05 Christian Biesinger <cbiesinger@google.com>
* python.texi (Blocks In Python): Document dictionary access on blocks.
gdb/testsuite/ChangeLog:
2019-08-05 Christian Biesinger <cbiesinger@google.com>
* gdb.python/py-block.exp: Test dictionary access on blocks.
|
|
gdb/ChangeLog
2019-08-03 Philippe Waroquiers <philippe.waroquiers@skynet.be>
* NEWS: Mention changes to "info sources" command.
gdb/doc/ChangeLog
2019-08-03 Philippe Waroquiers <philippe.waroquiers@skynet.be>
* gdb.texinfo (Symbols): Document new args -dirname and -basename
of "info sources" command.
|
|
Similar to lookup_global_symbol, except that it checks the
STATIC_SCOPE.
gdb/ChangeLog:
2019-07-30 Christian Biesinger <cbiesinger@google.com>
PR/24474: Add a function to lookup static variables.
* NEWS: Mention this new function.
* python/py-symbol.c (gdbpy_lookup_static_symbol): New function.
* python/python-internal.h (gdbpy_lookup_static_symbol): New function.
* python/python.c (python_GdbMethods): Add new function.
gdb/doc/ChangeLog:
2019-07-30 Christian Biesinger <cbiesinger@google.com>
* python.texi (Symbols In Python): Document new function
gdb.lookup_static_symbol.
gdb/testsuite/ChangeLog:
2019-07-30 Christian Biesinger <cbiesinger@google.com>
* gdb.python/py-symbol.c: Add a static variable and one in an anonymous
namespace.
* gdb.python/py-symbol.exp: Test gdb.lookup_static_symbol.
|
|
This is essentially the inverse of Symbol.objfile. This allows
handling different symbols with the same name (but from different
objfiles) and can also be faster if the objfile is known.
gdb/ChangeLog:
2019-07-29 Christian Biesinger <cbiesinger@google.com>
* NEWS: Mention new functions Objfile.lookup_{global,static}_symbol.
* python/py-objfile.c (objfpy_lookup_global_symbol): New function.
(objfpy_lookup_static_symbol): New function.
(objfile_object_methods): Add new functions.
gdb/doc/ChangeLog:
2019-07-29 Christian Biesinger <cbiesinger@google.com>
* python.texi (Objfiles In Python): Document new functions
Objfile.lookup_{global,static}_symbol.
gdb/testsuite/ChangeLog:
2019-07-29 Christian Biesinger <cbiesinger@google.com>
* gdb.python/py-objfile.c: Add global and static vars.
* gdb.python/py-objfile.exp: Test new functions Objfile.
lookup_global_symbol and lookup_static_symbol.
|
|
gdb/ChangeLog
2019-06-19 Philippe Waroquiers <philippe.waroquiers@skynet.be>
* NEWS: Mention 'set|show print frame-info'. Mention new
'presence' value for 'frame-arguments'. Mention new '-frame-info'
backtrace argument. Mention that python frame filtering code
is now consistent with what 'backtrace' command prints.
gdb/doc/ChangeLog
2019-07-29 Philippe Waroquiers <philippe.waroquiers@skynet.be>
* gdb.texinfo (Backtrace): Document the new '-frame-info'
backtrace option. Reference 'set print frame-info'.
(Print Settings): Document 'set|show print frame-info'.
Document new 'presence' value for 'set print frame-arguments.
|
|
Adds a new -q flag to "info types" using the gdb::option framework.
This -q flag is similar to the -q flag already present for "info
variables" and "info functions".
gdb/ChangeLog:
* NEWS: Mention adding -q option to "info types".
* symtab.c (struct info_types_options): New struct.
(info_types_options_defs): New variable.
(make_info_types_options_def_group): New function.
(info_types_command): Use gdb::option framework to parse options.
(info_types_command_completer): New function.
(_initialize_symtab): Extend the help text on "info types" and
register command completer.
gdb/doc/ChangeLog:
* gdb.texinfo (Symbols): Add information about -q flag to "info
types".
|
|
The example in the documentation for the "python" command shows GDB
outputting instructions for how to terminate a sequence of python
commands entered from the command line. The documentation shows that
the following two lines are being output, though this does not occur
when actually using the "python" command from GDB:
Type python script
End with a line saying just "end".
While display of this text might be helpful, GDB has several other
commands which also use the "end" terminator that offer no such text.
Examples include the "if" and "while" commands. For example,
(gdb) if 1==1
>print "a"
>end
$1 = "a"
This seems similar to doing:
(gdb) python
>print 23
>end
23
If we decide that we want the "python" command to print such a message,
we should also adjust the behavior for other GDB commands which also use
"end" to terminate a command list. I.e, if this decision is made, the
"if" and "while" commands ought to also print similar messages.
So, for the moment anyway, this commit adjusts the documentation of the
python command to match its implementation.
This patch was taken from a larger body of work originating from the
Archer project. I haven't been able to determine its original author,
though I did find a commit log from Jan Kratochvil (in the Archer
repository) which suggests that the change had originally been made to
gdb.texinfo, but got inadvertently dropped when the python related
documentation was split out to python.texi.
gdb/doc/ChangeLog:
* python.texi (python command): Revise example to match
command behavior.
|
|
Currently, with:
(gdb) catch catch
Catchpoint 1 (catch)
(gdb) catch throw
Catchpoint 2 (throw)
(gdb) catch rethrow
Catchpoint 3 (rethrow)
You get:
(gdb) info breakpoints
Num Type Disp Enb Address What
1 breakpoint keep y 0x0000000000b122af exception catch
2 breakpoint keep y 0x0000000000b1288d exception throw
3 breakpoint keep y 0x0000000000b12931 exception rethrow
I think it doesn't make much sense usability-wise, to show a
catchpoint as a breakpoint. The fact that GDB sets a breakpoint at
some magic address in the C++ run time is an implementation detail,
IMO. And as seen in the previous patch, such a catchpoint can end up
with more than one location/address even, so showing a single address
isn't entirely accurate.
This commit hides the addresses from view, and makes GDB show
"catchpoint" for type as well:
(gdb) info breakpoints
Num Type Disp Enb Address What
1 catchpoint keep y exception catch
2 catchpoint keep y exception throw
3 catchpoint keep y exception rethrow
This comment in the code seems telling:
/* We need to reset 'type' in order for code in breakpoint.c to do
the right thing. */
cp->type = bp_breakpoint;
It kind of suggests that the reason catchpoints end up shown as
breakpoints was that it was easier to implement them that way, rather
than a desired property.
This commit fixes things up to make it possible to have bp_catch
breakpoints have software/hardware breakpoint locations, thus
eliminating the need for that hack:
- redo breakpoint_address_is_meaningful in terms of the location's
type rather than breakpoint type.
- teach bpstat_what about stepping over the catchpoint locations.
- install a allocate_location method for "catch catch/throw/rethrow",
one that forces the location type.
Note that this also reverts the gdb hunk from:
commit 2a8be20359dba9cc684fd3ffa222d985399f3b18
Commit: Tom Tromey <tom@tromey.com>
CommitDate: Sat Oct 6 22:17:45 2018 -0600
Fix Python gdb.Breakpoint.location crash
because now "catch throw" catchpoints hit the
if (obj->bp->type != bp_breakpoint)
Py_RETURN_NONE;
check above, and, adjusts the testcase to no longer expect to see the
catchpoint in the gdb.breakpoints() list.
(Note: might make sense to do the same to Ada exception catchpoints.)
gdb/ChangeLog:
2019-07-09 Pedro Alves <palves@redhat.com>
* break-catch-throw.c (print_one_exception_catchpoint): Skip the
"addr" field.
(allocate_location_exception_catchpoint): New.
(handle_gnu_v3_exceptions): Don't reset 'type' to bp_breakpoint.
(initialize_throw_catchpoint_ops): Install
allocate_location_exception_catchpoint as allocate_location
method.
* breakpoint.c (bpstat_what) <bp_catch>: Set action to
BPSTAT_WHAT_SINGLE if not stopping and the location's type is not
bp_loc_other.
(breakpoint_address_is_meaningful): Delete.
(bl_address_is_meaningful): New.
(breakpoint_locations_match): Adjust comment.
(bp_location_from_bp_type): New, factored out of...
(bp_location::bp_location(breakpoint *)): ... this.
(bp_location::bp_location(breakpoint *, bp_loc_type)): New,
factored out of...
(bp_location::bp_location(breakpoint *)): ... this. Reimplement.
(bp_loc_is_permanent): Use bl_address_is_meaningful instead of
breakpoint_address_is_meaningful.
(bp_locations_compare): Adjust comment.
(update_global_location_list): Use bl_address_is_meaningful
instead of breakpoint_address_is_meaningful.
* breakpoint.h (bp_location::bp_location(breakpoint *)): New
explicit.
(bp_location::bp_location(breakpoint *, bp_loc_type)): Declare.
* python/py-breakpoint.c (bppy_get_location): No longer check
whether location is null.
gdb/doc/ChangeLog:
2019-07-09 Pedro Alves <palves@redhat.com>
* gdb.texinfo (C++ Exception GDB/MI Catchpoint Commands): Adjust
examples to show type=catchpoint instead of type=breakpoint and an
address.
gdb/testsuite/ChangeLog:
2019-07-09 Pedro Alves <palves@redhat.com>
* gdb.cp/catch-multi-stdlib.exp: Adjust expected "info
breakpoints" output.
* gdb.cp/exception.exp: Adjust expected "info breakpoints" output.
* gdb.python/py-breakpoint.exp: No longer expect that "catch
throw" creates breakpoint.
* gdb.mi/mi-catch-cpp-exceptions.exp (setup_catchpoint): Expect
'type="catchpoint"'.
|
|
( See original discussion and prototype here:
https://sourceware.org/ml/gdb-patches/2019-05/msg00570.html )
(gdb) help with
Temporarily set SETTING to VALUE, run COMMAND, and restore SETTING.
Usage: with SETTING [VALUE] [-- COMMAND]
Usage: w SETTING [VALUE] [-- COMMAND]
With no COMMAND, repeats the last executed command.
SETTING is any setting you can change with the "set" subcommands.
E.g.:
with language pascal -- print obj
with print elements unlimited -- print obj
As can be seen above, the "with" command is just like "set", but
instead of setting the setting permanently, it sets the setting, runs
a command and then restores the setting.
(gdb) p g_s
$1 = {a = 1, b = 2, c = 3}
(gdb) with language ada -- print g_s
$2 = (a => 1, b => 2, c => 3)
Warning: the current language does not match this frame.
(gdb) show language
The current source language is "auto; currently c".
(gdb) with print elements 100 -- with print object on -- print 1
$3 = 1
You can shorten things a bit though, as long as unambiguous. So this:
(gdb) with print elements 100 -- with print object off -- print 1
is the same as:
(gdb) w p el 100 -- w p o 0 -- p 1
Note that the patch adds a "w" alias for "with", as "w" is not
currently taken:
(gdb) w
Ambiguous command "w": watch, wh, whatis, where, while, while-stepping, winheight, ws.
Let me know if you'd prefer to reserve "w" for one of the other
commands above. IMHO, this command will end up being used frequently
enough that it deserves the "w" shorthand.
A nice feature is that this is fully integrated with TAB-completion:
(gdb) with p[TAB]
pagination print prompt python
(gdb) with print [TAB]
address max-depth static-members
array max-symbolic-offset symbol
array-indexes null-stop symbol-filename
asm-demangle object symbol-loading
demangle pascal_static-members thread-events
elements pretty type
entry-values raw union
frame-arguments repeats vtbl
inferior-events sevenbit-strings
(gdb) with print [TAB]
(gdb) with print elements unlimited -- thread apply all -[TAB]
-ascending -c -q -s
(gdb) with print elements unlimited -- print -[TAB]
-address -max-depth -repeats -vtbl
-array -null-stop -static-members
-array-indexes -object -symbol
-elements -pretty -union
The main advantage of this new command compared to command options,
like the new "print -OPT", is that this command works with any
setting, and, it works nicely when you want to override a setting
while running a user-defined command, like:
(gdb) with print pretty -- usercmd
The disadvantage is that it isn't as compact or easy to type. I think
of command options and this command as complementary. I think that
even with this new command, it makes sense to continue developing the
command options in the direction of exposing most-oft-used settings as
command options.
Inspired by Philippe's "/" command proposal, if no command is
specified, then the last command is re-invoked, under the overridden
setting:
(gdb) p g_s
$1 = {a = 1, b = 2, c = 3}
(gdb) with language ada
$2 = (a => 1, b => 2, c => 3)
Warning: the current language does not match this frame.
Note: "with" requires "--" to separate the setting from the command.
It might be possible to do without that, but, I haven't tried it yet,
and I think that this can go in without it. We can always downgrade
to making "--" optional if we manage to make it work.
On to the patch itself, the implementation of the command is simpler
than one might expect. A few details:
- I factored out a bit from pipe_command into repeat_previous
directly, because otherwise I'd need to copy&paste the same code and
same error message in the with command.
- The parse_cli_var_uinteger / parse_cli_var_zuinteger_unlimited /
do_set_command changes are necessary since we can now pass an empty
string as argument.
- do_show_command was split in two, as a FIXME comment suggests, but
for a different reason: we need to get a string version of a "set"
command's value, and we already had code for that in
do_show_command. That code is now factored out to the new
get_setshow_command_value_string function.
- There's a new "maint with" command added too:
(gdb) help maint with
Like "with", but works with "maintenance set" variables.
Usage: maintenance with SETTING [VALUE] [-- COMMAND]
With no COMMAND, repeats the last executed command.
SETTING is any setting you can change with the "maintenance set"
subcommands.
"with" and "maint with" share 99% of the implementation.
This might be useful on its own, but it's also useful for testing,
since with this, we can use the "maint set/show test-settings"
settings for exercising the "with" machinery with all the command
type variants (all enum var_types). This is done in the new
gdb/base/with.exp testcase.
The documentation bits are originally based on Philippe's docs for the
"/" command, hence the attribution in the ChangeLog.
gdb/ChangeLog:
2019-07-03 Pedro Alves <palves@redhat.com>
* NEWS (New commands): Mention "with" and "maint with".
* cli/cli-cmds.c (with_command_1, with_command_completer_1)
(with_command, with_command_completer): New.
(pipe_command): Adjust to new repeat_previous
interface.
(_initialize_cli_cmds): Install the "with" command and its "w"
alias.
* cli/cli-cmds.h (with_command_1, with_command_completer_1): New
declarations.
* cli/cli-setshow.c (parse_cli_var_uinteger)
(parse_cli_var_zuinteger_unlimited, do_set_command): Handle empty
argument strings for all var_types.
(get_setshow_command_value_string): New, factored out from ...
(do_show_command): ... this.
* cli/cli-setshow.h: Include <string>.
(get_setshow_command_value_string): Declare.
* command.h (repeat_previous): Now returns const char *. Adjust
comment.
* maint.c: Include "cli/cli-cmds.h".
(maintenance_with_cmd, maintenance_with_cmd_completer): New.
(_initialize_maint_cmds): Register the "maintenance with" command.
* top.c (repeat_previous): Move bits from pipe_command here:
Return the saved command line, if any; error out if there's no
command to relaunch.
gdb/doc/ChangeLog:
2019-07-03 Pedro Alves <palves@redhat.com>
Philippe Waroquiers <philippe.waroquiers@skynet.be>
* gdb.texinfo (Command Settings): New node documenting the general
concept of settings, how to change them, and the new "with"
command.
(Maintenance Commands): Document "maint with".
gdb/testsuite/ChangeLog:
2019-07-03 Pedro Alves <palves@redhat.com>
* gdb.base/with.c: New file.
* gdb.base/with.exp: New file.
|
|
This commit renames "maint test-settings set/show" to "maint set/show
test-settings".
This helps the following patch, which introduce a "maint with" command
what works with all "maint set" settings.
gdb/ChangeLog:
2019-07-03 Pedro Alves <palves@redhat.com>
* NEWS (New commands): Mention "maint set/show test-settings"
instead of "maint test-settings".
* maint-test-settings.c (maintenance_test_settings_list): Delete.
(maintenance_test_settings_set_list): Rename to ...
(maintenance_set_test_settings_list): ... this.
(maintenance_test_settings_show_list): Rename to ...
(maintenance_show_test_settings_list): ... this.
(maintenance_test_settings_cmd): Delete.
(maintenance_test_settings_set_cmd): ...
(maintenance_set_test_settings_cmd): ... this.
(maintenance_test_settings_show_cmd): ...
(maintenance_show_test_settings_cmd): ... this.
(maintenance_test_settings_show_value_cmd):
(maintenance_show_test_settings_value_cmd): ... this.
(_initialize_maint_test_settings): No longer install the "maint
test-settings" prefix command. Rename "maint test-settings set"
to "maint set test-settings", and "maint test-settings show" to
"maint show test-settings". Adjust all subcommands.
gdb/doc/ChangeLog:
2019-07-03 Pedro Alves <palves@redhat.com>
* gdb.texinfo (Maintenance Commands): Document "maint set/show
test-settings" instead of "maint test-settings set/show".
gdb/testsuite/ChangeLog:
2019-07-03 Pedro Alves <palves@redhat.com>
* gdb.base/settings.exp: Replace all references to "maint
test-settings set" with references to "maint set test-settings",
and all references to "maint test-settings show" with references
to "maint show test-settings".
|
|
Section "Invoking GDB" of the manual states that if you try to launch
gdb with:
gdb program 1234
it will try to attach to the process with id 1234, unless there is a
file named 1234 in the current working directory, in which case it will
try to open that file as a core. In fact, when the second argument
starts with a digit, GDB tries to attach to process 1234 first, before
trying to open file 1234 as a core. So that last remark is not true and
therefore this patch removes it.
The same remark is present in the man page, so it is removed there too.
Section "Choosing Files" correctly states:
If the second argument begins with a decimal digit, GDB will first
attempt to attach to it as a process, and if that fails, attempt to
open it as a corefile.
so it is unchanged.
Finally, the man page has an additional detail compared to section
"Invoking GDB", regarding the use of the -p switch, so I added the same
detail to the "Invoking GDB" section.
gdb/doc/ChangeLog:
* gdb.texinfo (Invoking GDB): Remove sentence about how GDB
deals with a file that has the same name as the specified pid to
attach to. Add example using -p option.
(gdb man): Remove same sentence as in previous item.
|
|
Adds some MI commands to catch C++ exceptions. The new commands are
-catch-throw, -catch-rethrow, and -catch-catch, these all correspond
to the CLI commands 'catch throw', 'catch rethrow', and 'catch catch'.
Each MI command takes two optional arguments, '-t' has the effect of
calling 'tcatch' instead of 'catch', for example:
(gdb)
-catch-throw -t
Is the same as:
(gdb) tcatch throw
There is also a '-r REGEXP' argument that can supply a regexp to match
against the exception type, so:
(gdb)
-catch-catch -r PATTERN
Is the same as:
(gdb) catch catch PATTERN
The change in print_mention_exception_catchpoint might seem a little
strange; changing the output from using ui_out::field_int and
ui_out::text to using ui_out::message.
The print_mention_exception_catchpoint is used as the 'print_mention'
method for the exception catchpoint breakpoint object. Most of the
other 'print_mention' methods (see breakpoint.c) use either
printf_filtered, of ui_out::message. Using field_int was causing an
unexpected field to be added to the MI output. Here's the output
without the change in print_mention_exception_catchpoint:
(gdb)
-catch-throw
^done,bkptno="1",bkpt={number="1",type="breakpoint",disp="keep",
enabled="y",addr="0x00000000004006c0",
what="exception throw",catch-type="throw",
thread-groups=["i1"],times="0"}
Notice the breakpoint number appears in both the 'bkptno' field, and
the 'number' field within the 'bkpt' tuple. Here's the output with
the change in print_mention_exception_catchpoint:
(gdb)
-catch-throw
^done,bkpt={number="1",type="breakpoint",disp="keep",
enabled="y",addr="0x00000000004006c0",
what="exception throw",catch-type="throw",
thread-groups=["i1"],times="0"}
gdb/ChangeLog:
* NEWS: Mention new MI commands.
* break-catch-throw.c (enum exception_event_kind): Move to
breakpoint.h.
(print_mention_exception_catchpoint): Output text as a single
message.
(catch_exception_command_1): Rename to...
(catch_exception_event): ...this, make non-static, update header
command, and change some parameter types.
(catch_catch_command): Update for changes to
catch_exception_command_1.
(catch_throw_command): Likewise.
(catch_rethrow_command): Likewise.
* breakpoint.c (enum exception_event_kind): Delete.
* breakpoint.h (enum exception_event_kind): Moved here from
break-catch-throw.c.
(catch_exception_event): Declare.
* mi/mi-cmd-catch.c (mi_cmd_catch_exception_event): New function.
(mi_cmd_catch_throw): New function.
(mi_cmd_catch_rethrow): New function.
(mi_cmd_catch_catch): New function.
* mi/mi-cmds.c (mi_cmds): Add 'catch-throw', 'catch-rethrow', and
'catch-catch' entries.
* mi/mi-cmds.h (mi_cmd_catch_throw): Declare.
(mi_cmd_catch_rethrow): Declare.
(mi_cmd_catch_catch): Declare.
gdb/doc/ChangeLog:
* gdb.texinfo (GDB/MI Catchpoint Commands): Add menu entry to new
node.
(C++ Exception GDB/MI Catchpoint Commands): New node to describe
new MI commands.
gdb/testsuite/ChangeLog:
* gdb.mi/mi-catch-cpp-exceptions.cc: New file.
* gdb.mi/mi-catch-cpp-exceptions.exp: New file.
* lib/mi-support.exp (mi_expect_stop): Handle 'exception-caught'
as a stop reason.
|
|
gdb/ChangeLog:
2019-06-13 Pedro Alves <palves@redhat.com>
* NEWS (New commands): Mention "maint test-options
require-delimiter", "maint test-options unknown-is-error", "maint
test-options unknown-is-operand" and "maint show
test-options-completion-result".
(New command options, command completion): New section.
(Completion improvements): New section.
Mention that you can abbreviate "unlimited".
gdb/doc/ChangeLog:
2019-06-13 Pedro Alves <palves@redhat.com>
* gdb.texinfo (Command Completion): Mention command options too.
(Command Options): New node.
(Threads): Add anchors. Extend descriptions of the "taas" and
"tfaas" commands.
(Backtrace): Describe new options of the "backtrace" command. Add
anchors.
(Frame Apply): Describe new options of the "frame apply" and
"faas" commands. Add anchors.
(Data): Describe new options of the "print" command. Add anchors.
(Compiling and Injecting Code): Mention options of the "compile
print" command.
(Maintenance Commands): Mention "maint test-options" subcommands
and the "maint show test-options-completion-result" command.
|
|
A following patch will introduce options for the "backtrace" command,
based on some "set print" and "set backtrace" settings. There's one
setting in particular that is a bit annoying if we want to describe
the backtrace options and the settings commands using the same data
structures:
"set print raw frame-arguments"
The problem is that space between "raw" and "frame-arguments".
Calling the option
"bt -raw frame-arguments"
would be odd. So I'm calling the option
"bt -raw-frame-arguments"
instead.
And for consistency, this patch renames the set/show commands to:
"set print raw-frame-arguments"
"show print raw-frame-arguments"
I.e., dash instead of space. The old commands are left in place, but
marked deprecated.
We need to adjust a couple testcases, because the relevant tests use
gdb_test_no_output and the old commands are no longer silent:
(gdb) set print raw frame-arguments on
Warning: command 'set print raw frame-arguments' is deprecated.
Use 'set print raw-frame-arguments'.
gdb/ChangeLog:
2019-06-13 Pedro Alves <palves@redhat.com>
* NEWS (Changed commands): Mention set/show print raw-frame-arguments,
and that "set/show print raw frame-arguments" are now deprecated.
* cli/cli-decode.c (add_setshow_boolean_cmd): Now returns the
command.
* command.h (add_setshow_boolean_cmd): Return cmd_list_element *.
* stack.c (_initialize_stack): Install "set/show print
raw-frame-arguments", and deprecate "set/show print raw
frame-arguments".
* valprint.c (_initialize_valprint): Deprecate "set/show print
raw".
gdb/doc/ChangeLog:
2019-06-13 Pedro Alves <palves@redhat.com>
* gdb.texinfo (Print Settings): Document "set/show print
raw-frame-arguments" instead of "set/show print raw
frame-arguments".
gdb/testsuite/ChangeLog:
2019-06-13 Pedro Alves <palves@redhat.com>
* gdb.guile/scm-frame-args.exp: Use "set print
raw-frame-arguments" instead of "set print raw frame-arguments".
* gdb.python/py-frame-args.exp: Likewise.
|
|
This commit adds new representative commands for all types of settings
commands supported by gdb (enum var_types), and then uses them to
exercise settings parsing and completion.
(gdb) maint test-settings s[TAB]
set show
(gdb) maint test-settings set [TAB]
auto-boolean integer uinteger
boolean optional-filename zinteger
enum string zuinteger
filename string-noescape zuinteger-unlimited
(gdb) maint test-settings set enum [TAB]
xxx yyy zzz
etc.
This is basically unit testing, except that it goes fully via GDB. It
must be done this way in order to exercise TAB completion properly,
which must go via readline.
gdb/ChangeLog:
2019-06-13 Pedro Alves <palves@redhat.com>
* Makefile.in (COMMON_SFILES): Add maint-test-settings.c.
* NEWS: Mention maint test-settings KIND.
* maint-test-settings.c: New file.
gdb/doc/ChangeLog:
2019-06-13 Pedro Alves <palves@redhat.com>
* gdb.texinfo (Maintenance Commands): Document "maint
test-settings" commands.
gdb/testsuite/ChangeLog:
2019-06-13 Pedro Alves <palves@redhat.com>
* gdb.base/settings.c: New file.
* gdb.base/settings.exp: New file.
|
|
gdb/ChangeLog
2019-04-26 Amos Bird <amosbird@gmail.com>
* annotate.c (annotate_thread_exited): Add "thread-exited"
annotation.
gdb/doc/ChangeLog
2019-06-06 Amos Bird <amosbird@gmail.com>
* annotate.texinfo (Multi-threaded Apps): Add entry for thread-exited
annotation.
gdb/testsuite/ChangeLog
2019-06-06 Amos Bird <amosbird@gmail.com>
* gdb.base/annota1.exp (thread_switch): Add test for
thread-exited annotation.
|
|
|
|
This allows users of the Python API to find the objfile where a type
was defined.
gdb/ChangeLog:
gdb/ChangeLog
2019-06-04 Christian Biesinger <cbiesinger@google.com>
Add objfile property to gdb.Type.
* gdb/NEWS: Mention Python API addition.
* gdb/python/py-type.c (typy_get_objfile): New method.
gdb/doc/ChangeLog
2019-06-04 Christian Biesinger <cbiesinger@google.com>
* gdb/doc/python.texi: Document new gdb.Type.objfile property.
gdb/testsuite/ChangeLog
2019-06-04 Christian Biesinger <cbiesinger@google.com>
* gdb/testsuite/gdb.python/py-type.exp: Test for new
gdb.Type.objfile property.
|
|
|
|
gdb/ChangeLog
* NEWS: Mention new pipe command and new convenience variables.
gdb/doc/ChangeLog
* gdb.texinfo (Shell Commands): Document pipe command.
(Logging Output): Add a reference to pipe command.
(Convenience Variables): Document $_shell_exitcode and
$_shell_exitstatus.
|
|
A user wanted to be able to disable the display of the value when
using "finish" -- but still have the value entered into the value
history in case it was useful later on. Part of the rationale here is
that sometimes the value might be quite large, or expensive to display
(in their case this was compounded by a rogue pretty-printer).
This patch implements this idea.
gdb/ChangeLog
2019-05-29 Tom Tromey <tromey@adacore.com>
* NEWS: Add entry.
* infcmd.c (print_return_value_1): Handle finish_print
option.
(show_print_finish): New function.
(_initialize_infcmd): Add "set/show print finish" commands.
* valprint.c (user_print_options): Initialize new member.
* valprint.h (struct value_print_options) <finish_print>: New
member.
gdb/doc/ChangeLog
2019-05-29 Tom Tromey <tromey@adacore.com>
* gdb.texinfo (Continuing and Stepping): Document new
commands.
gdb/testsuite/ChangeLog
2019-05-29 Tom Tromey <tromey@adacore.com>
* gdb.base/finish.exp (finish_no_print): New proc.
(finish_tests): Call it.
|
|
Add missing documentation for the debugredirect setting.
Add description and uses of gdb.in/gdb.cmd to the testsuite README.
Mention this in the NEWS file.
gdb/ChangeLog:
* NEWS: Add debugredirect and testsuite sections.
gdb/doc/ChangeLog:
* gdb.texinfo (Shell Commands): Add debugredirect.
gdb/testsuite/ChangeLog:
* README (Re-running Tests Outside The Testsuite): New section.
|
|
gdb/doc/Changelog:
* gdb.texinfo: Minor formatting fixes.
|
|
There is a CLI command 'complete' intended to use with emacs. Such a command
would also be useful for MI frontends, when separate CLI and MI channels cannot
be used. For example, on Windows (because of lack of PTYs) or when GDB is used
through SSH session.
This commit adds a new '-complete' MI command.
gdb/Changelog:
2019-01-28 Jan Vrany <jan.vrany@fit.cvut.cz>
* mi/mi-cmds.h (mi_cmd_complete): New function.
* mi/mi-main.c (mi_cmd_complete): Likewise.
* mi/mi-cmds.c: Define new MI command -complete.
* NEWS: Mention new -complete command.
gdb/doc/ChangeLog:
2019-01-28 Jan Vrany <jan.vrany@fit.cvut.cz>
* gdb.texinfo (Miscellaneous GDB/MI Commands): Document new
MI command -complete.
gdb/testsuite/ChangeLog:
2019-01-28 Jan Vrany <jan.vrany@fit.cvut.cz>
* gdb.mi/mi-complete.exp: New file.
* gdb.mi/mi-complete.cc: Likewise.
|
|
The "automatic symbol index cache" entry in the docs is missing entries in the
concept and command indices. Add them.
gdb/doc/ChangeLog:
2019-05-14 Tom de Vries <tdevries@suse.de>
* gdb.texinfo (Automatic symbol index cache): Add concept and command
index entries.
|
|
Currently, the entry for the command "maint info selftests" in the Command,
Variable, and Function Index is listed at '"', rather than next to the other
"maint info" commands.
Fix this by removing the superfluous quoting in the @kindex entry.
gdb/doc/ChangeLog:
2019-05-14 Tom de Vries <tdevries@suse.de>
* gdb.texinfo (Maintenance Commands): Remove superfluous
quoting on command index entry for "maint info selftests".
|
|
I found out recently that some users didn't know that the Python
pretty-printers "children" method should compute its result lazily.
This has been a good idea since the earliest days, but wasn't
mentioned in the docs. This patch adds some text to this effect.
gdb/doc/ChangeLog
2019-05-10 Tom Tromey <tromey@adacore.com>
* python.texi (Pretty Printing API): Mention lazy computation for
"children".
|
|
This patch makes a few minor improvements to the catchpoint
documentation:
* "catch exception" and "catch handlers" now mention the argument in
the @item.
* "catch exception unhandled" is moved to be closer to "catch
exception", rather than after "catch handlers".
* "catch load" and "catch unload" now wrap the argument in @var.
gdb/doc/ChangeLog
2019-05-10 Tom Tromey <tromey@adacore.com>
* gdb.texinfo (Set Catchpoints): Add text for parameter to "catch
exception" and "catch handlers". Move "catch exception unhandled"
text. Use @var for "catch load" and "catch unload"
|
|
Consider this short C example:
struct inner
{
unsigned x;
unsigned y : 3;
unsigned z : 3;
};
struct outer
{
unsigned char o : 3;
struct inner i __attribute__ ((packed));
};
When I use "ptype/o" on this, I get:
(gdb) ptype/o struct outer
/* offset | size */ type = struct outer {
/* 0: 5 | 1 */ unsigned char o : 3;
/* XXX 5-bit hole */
/* 1 | 8 */ struct inner {
/* 1 | 4 */ unsigned int x;
/* 5:29 | 4 */ unsigned int y : 3;
/* 5:26 | 4 */ unsigned int z : 3;
/* XXX 2-bit padding */
/* XXX 3-byte padding */
/* total size (bytes): 8 */
} i;
/* total size (bytes): 9 */
}
In the location of "o" ("0: 5"), the "5" means "there are 5 bits left
relative to the size of the underlying type.
I find this very difficult to follow. On irc, Sergio said that this
choice came because it is what pahole does. However, I think it's not
very useful, and maybe is just an artifact of the way that
DW_AT_bit_offset was defined in DWARF 3.
This patch changes ptype/o to print the offset of a bitfield in a more
natural way, that is, using the bit number according to the platform's
bit numbering.
With this patch, the output is now:
(gdb) ptype/o struct outer
/* offset | size */ type = struct outer {
/* 0: 0 | 1 */ unsigned char o : 3;
/* XXX 5-bit hole */
/* 1 | 8 */ struct inner {
/* 1 | 4 */ unsigned int x;
/* 5: 0 | 4 */ unsigned int y : 3;
/* 5: 3 | 4 */ unsigned int z : 3;
/* XXX 2-bit padding */
/* XXX 3-byte padding */
/* total size (bytes): 8 */
} i;
/* total size (bytes): 9 */
}
This is better, IMO, because now the "offset" of a bitfield is
consistent with the offset of an ordinary member, referring to its
offset from the start of the structure.
gdb/ChangeLog
2019-05-08 Tom Tromey <tromey@adacore.com>
* typeprint.c (print_offset_data::update): Print the bit offset,
not the number of bits remaining.
gdb/doc/ChangeLog
2019-05-08 Tom Tromey <tromey@adacore.com>
* gdb.texinfo (Symbols): Document change to ptype/o.
gdb/testsuite/ChangeLog
2019-05-08 Tom Tromey <tromey@adacore.com>
* gdb.base/ptype-offsets.exp: Update tests.
|
|
If you put the separate debug file in a global debug directory, GDB on
MS-Windows would fail to find it. This happens because we obtain the
directory to look up the debug file by concatenating the debug
directory name with the leading directories of the executable, and the
latter includes the drive letter on MS-Windows. So we get an invalid
file name like
d:/usr/lib/debug/d:/usr/bin/foo.debug
This commit fixes that by removing the colon of the drive letter,
thus producing
d:/usr/lib/debug/d/usr/bin/foo.debug
gdb/ChangeLog:
2019-05-03 Eli Zaretskii <eliz@gnu.org>
* symfile.c (find_separate_debug_file): Remove colon from the
drive spec of DOS/Windows file names of the target, so that the
file name produced from DEBUGDIR and the target's directory will
be valid on DOS/Windows systems.
gdb/doc/ChangeLog:
2019-05-03 Eli Zaretskii <eliz@gnu.org>
* gdb.texinfo (Separate Debug Files): Document how the
subdirectory of the global debug directory is computed on
MS-Windows/MS-DOS.
|
|
Introduce a new print setting max-depth which can be set with 'set
print max-depth DEPTH'. The default value of DEPTH is 20, but this
can also be set to unlimited.
When GDB is printing a value containing nested structures GDB will
stop descending at depth DEPTH. Here is a small example:
typedef struct s1 { int a; } s1;
typedef struct s2 { s1 b; } s2;
typedef struct s3 { s2 c; } s3;
typedef struct s4 { s3 d; } s4;
s4 var = { { { { 3 } } } };
The following table shows how various depth settings affect printing
of 'var':
| Depth Setting | Result of 'p var' |
|---------------+--------------------------------|
| Unlimited | $1 = {d = {c = {b = {a = 3}}}} |
| 4 | $1 = {d = {c = {b = {a = 3}}}} |
| 3 | $1 = {d = {c = {b = {...}}}} |
| 2 | $1 = {d = {c = {...}}} |
| 1 | $1 = {d = {...}} |
| 0 | $1 = {...} |
Only structures, unions, and arrays are replaced in this way, scalars
and strings are not replaced.
The replacement is counted from the level at which you print, not from
the top level of the structure. So, consider the above example and
this GDB session:
(gdb) set print max-depth 2
(gdb) p var
$1 = {d = {c = {...}}}
(gdb) p var.d
$2 = {c = {b = {...}}}
(gdb) p var.d.c
$3 = {b = {a = 3}}
Setting the max-depth to 2 doesn't prevent the user from exploring
deeper into 'var' by asking for specific sub-fields to be printed.
The motivation behind this feature is to try and give the user more
control over how much is printed when examining large, complex data
structures.
The default max-depth of 20 means that there is a change in GDB's
default behaviour. Someone printing a data structure with 20 levels
of nesting will now see '{...}' instead of their data, they would need
to adjust the max depth, or call print again naming a specific field
in order to dig deeper into their data structure. If this is
considered a problem then we could increase the default, or even make
the default unlimited.
This commit relies on the previous commit, which added a new field to
the language structure, this new field was a string that contained the
pattern that should be used when a structure/union/array is replaced
in the output, this allows languages to use a syntax that is more
appropriate, mostly this will be selecting the correct types of
bracket '(...)' or '{...}', both of which are currently in use.
This commit should have no impact on MI output, expressions are
printed through the MI using -var-create and then -var-list-children.
As each use of -var-list-children only ever displays a single level of
an expression then the max-depth setting will have no impact.
This commit also adds the max-depth mechanism to the scripting
language pretty printers following basically the same rules as for the
built in value printing.
One quirk is that when printing a value using the display hint 'map',
if the keys of the map are structs then GDB will hide the keys one
depth level after it hides the values, this ensures that GDB produces
output like this:
$1 = map_object = {[{key1}] = {...}, [{key2}] = {...}}
Instead of this less helpful output:
$1 = map_object = {[{...}] = {...}, [{...}] = {...}}
This is covered by the new tests in gdb.python/py-nested-maps.exp.
gdb/ChangeLog:
* cp-valprint.c (cp_print_value_fields): Allow an additional level
of depth when printing anonymous structs or unions.
* guile/scm-pretty-print.c (gdbscm_apply_val_pretty_printer):
Don't print either the top-level value, or the children if the
max-depth is exceeded.
(ppscm_print_children): When printing the key of a map, allow one
extra level of depth.
* python/py-prettyprint.c (gdbpy_apply_val_pretty_printer): Don't
print either the top-level value, or the children if the max-depth
is exceeded.
(print_children): When printing the key of a map, allow one extra
level of depth.
* python/py-value.c (valpy_format_string): Add max_depth keyword.
* valprint.c: (PRINT_MAX_DEPTH_DEFAULT): Define.
(user_print_options): Initialise max_depth field.
(val_print_scalar_or_string_type_p): New function.
(val_print): Check to see if the max depth has been reached.
(val_print_check_max_depth): Define new function.
(show_print_max_depth): New function.
(_initialize_valprint): Add 'print max-depth' option.
* valprint.h (struct value_print_options) <max_depth>: New field.
(val_print_check_max_depth): Declare new function.
* NEWS: Document new feature.
gdb/doc/ChangeLog:
* gdb.texinfo (Print Settings): Document 'print max-depth'.
* guile.texi (Guile Pretty Printing API): Document that 'print
max-depth' can effect the display of a values children.
* python.texi (Pretty Printing API): Likewise.
(Values From Inferior): Document max_depth keyword.
gdb/testsuite/ChangeLog:
* gdb.base/max-depth.c: New file.
* gdb.base/max-depth.exp: New file.
* gdb.python/py-nested-maps.c: New file.
* gdb.python/py-nested-maps.exp: New file.
* gdb.python/py-nested-maps.py: New file.
* gdb.python/py-format-string.exp (test_max_depth): New proc.
(test_all_common): Call test_max_depth.
* gdb.fortran/max-depth.exp: New file.
* gdb.fortran/max-depth.f90: New file.
* gdb.go/max-depth.exp: New file.
* gdb.go/max-depth.go: New file.
* gdb.modula2/max-depth.exp: New file.
* gdb.modula2/max-depth.c: New file.
* lib/gdb.exp (get_print_expr_at_depths): New proc.
|
|
Inferior function calls are powerful but might lead to undesired
results such as crashes when calling nested functions (frequently
used in particular in Ada).
This implements a GDB setting to disable calling inferior functions.
Note: the idea is that if/when the 'slash command' patch is pushed,
that this setting can be changed e.g. by using the shortcut /c.
This is version 2 of the patch. It handles all the received comments,
mostly replace 'can-call' by 'may-call', and avoid using
'inferior function call' in factor of 'calling function in the program'.
2019-04-26 Philippe Waroquiers <philippe.waroquiers@skynet.be>
gdb/ChangeLog
* NEWS: Mention the new set|show may-call-functions.
* infcall.c (may_call_functions_p): New variable.
(show_may_call_functions_p): New function.
(call_function_by_hand_dummy): Throws an error if not
may-call-functions.
(_initialize_infcall): Call add_setshow_boolean_cmd for
may-call-functions.
gdb/testsuite/ChangeLog
* gdb.base/callexit.exp: Test may-call-functions off.
gdb/doc/ChangeLog
* gdb.texinfo (Calling): Document the new
set|show may-call-functions.
|
|
gdb/doc/ChangeLog:
2019-04-22 Pedro Alves <palves@redhat.com>
* gdb.texinfo (Reverse Execution): Mention and xref process record
and replay. Mention remote and system emulators.
(Process Record and Replay): List supported architectures.
Mention that "record btrace" is only supported on Intel
processors.
|
|
Add command line option to send all debug output to a given file.
Always default back to stderr.
Add matching monitor command. Add documentation.
gdb/doc/ChangeLog:
* gdb.texinfo
(Other Command-Line Arguments for gdbserver): Add debug-file
option.
(Monitor Commands for gdbserver): Likewise.
(gdbserver man): Likewise.
gdb/gdbserver/ChangeLog:
* debug.c (debug_set_output): New function.
(debug_vprintf): Send output to debug_file.
(debug_flush): Likewise.
* debug.h (debug_set_output): New declaration.
* server.c (handle_monitor_command): Add debug-file option.
(captured_main): Likewise.
|
|
This renaming was done to stay consistent with the naming of the new
gdb.InferiorThread.handle method. I had initially named it "thread_handle"
but Tom Tromey suggested just "handle".
The old name (thread_from_thread_handle) still works, but is marked as
deprecated in comments in the code as well as in the documentation.
I have some code which uses these functions. I very much like the
brevity of the new names.
gdb/doc/ChangeLog:
* python.texi (Inferiors In Python): Rename
Inferior.thread_from_thread_handle to Inferior.thread_from_handle.
Add note about the former being deprecated.
gdb/ChangeLog:
* python/py-inferior.c (infpy_thread_from_thread_handle):
Adjust comments to reflect renaming of thread_from_thread_handle
to thread_from_handle. Adjust keywords. Fix type error message.
(inferior_object_methods): Add thread_from_handle. Retain
thread_from_thread_handle, but mark it as deprecated.
testsuite/ChangeLog:
* gdb.python/py-thrhandle.exp: Adjust tests to call
thread_from_handle instead of thread_from_thread_handle.
|
|
gdb/doc/ChangeLog:
* python.texi (Threads In Python): Add description for method
InferiorThread.handle.
|
|
I've broken "make info" a couple of times now, because I sometimes
forget to run "make info" after modifying a Texinfo file.
I don't know why gdb's "make all" doesn't build the info pages. I
suspect this was some Cygnus-local oddity back in the day.
This patch changes doc/Makefile.in so that the info pages are built by
"make all". As a point of reference, Automake has essentially always
worked this way. According to the Automake manual (I didn't
double-check) this is required by the GNU coding standards.
The first time I sent this patch, I mentioned that I wanted to look
into some existing bugs in bugzilla about missing "makeinfo".
However, today I tried and I discovered that BFD requires makeinfo,
and builds its info file as part of "all". So, I think this change
doesn't worsen the situation for users in any way, and can simply go
in.
gdb/doc/ChangeLog
2019-04-07 Tom Tromey <tom@tromey.com>
* Makefile.in (all): Depend on "info".
|
|
Add two new internal functions $_cimag and $_creal that extract the
imaginary and real parts of a complex value.
These internal functions can take a complex value of any type 'float
complex', 'double complex', or 'long double complex' and return a
suitable floating point value 'float', 'double', or 'long double'.
So we can now do this:
(gdb) p z1
$1 = 1.5 + 4.5 * I
(gdb) p $_cimag (z1)
$4 = 4.5
(gdb) p $_creal (z1)
$4 = 1.5
The components of a complex value are not strictly named types in
DWARF, as the complex type is itself the base type. However, once we
are able to extract the components it makes sense to be able to ask
what the type of these components is and get a sensible answer back,
rather than the error we would currently get. Currently GDB says:
(gdb) ptype z1
type = complex double
(gdb) p $_cimag (z1)
$4 = 4.5
(gdb) ptype $
type = <invalid type code 9>
With the changes in dwarf2read.c, GDB now says:
(gdb) ptype z1
type = complex double
(gdb) p $_cimag (z1)
$4 = 4.5
(gdb) ptype $
type = double
Which seems to make more sense.
gdb/ChangeLog:
* NEWS: Mention new internal functions.
* dwarf2read.c (dwarf2_init_complex_target_type): New function.
(read_base_type): Use dwarf2_init_complex_target_type.
* value.c (creal_internal_fn): New function.
(cimag_internal_fn): New function.
(_initialize_values): Register new internal functions.
gdb/doc/ChangeLog:
* gdb.texinfo (Convenience Funs): Document '$_creal' and
'$_cimag'.
gdb/testsuite/ChangeLog:
* gdb.base/complex-parts.c: New file.
* gdb.base/complex-parts.exp: New file.
|
|
The str () function, called on a gdb.Value instance, produces a string
representation similar to what can be achieved with the print command,
but it doesn't allow to specify additional formatting settings, for
instance disabling pretty printers.
This patch introduces a new format_string () method to gdb.Value which
allows specifying more formatting options, thus giving access to more
features provided by the internal C function common_val_print ().
gdb/ChangeLog:
2019-04-01 Marco Barisione <mbarisione@undo.io>
Add gdb.Value.format_string ().
* python/py-value.c (copy_py_bool_obj):
(valpy_format_string): Add gdb.Value.format_string ().
* NEWS: Document the addition of gdb.Value.format_string ().
gdb/doc/ChangeLog:
2019-04-01 Marco Barisione <mbarisione@undo.io>
* python.texi (Values From Inferior): Document
gdb.Value.format_string ().
gdb/testsuite/ChangeLog:
2019-04-01 Marco Barisione <mbarisione@undo.io>
Test gdb.Value.format_string ().
* gdb.python/py-format-string.exp: New test.
* gdb.python/py-format-string.c: New file.
* gdb.python/py-format-string.py: New file.
|
|
gdb/ChangeLog:
2019-03-30 Eli Zaretskii <eliz@gnu.org>
* NEWS: Announce $_gdb_major and $_gdb_minor.
* top.c (init_gdb_version_vars): New function.
(gdb_init): Call init_gdb_version_vars.
gdb/testsuite/ChangeLog:
2019-03-30 Simon Marchi <simark@simark.ca>
* gdb.base/default.exp: Add values for $_gdb_major and
$_gdb_minor.
gdb/doc/ChangeLog:
2019-03-30 Eli Zaretskii <eliz@gnu.org>
* gdb.texinfo (Convenience Vars): Document $_gdb_major and
$_gdb_minor.
|