aboutsummaryrefslogtreecommitdiff
path: root/gdb/doc/ChangeLog
AgeCommit message (Collapse)AuthorFilesLines
2021-05-27Add optional full_window argument to TuiWindow.writeHannes Domani1-0/+5
To prevent flickering when first calling erase, then write, this new argument indicates that the passed string contains the full contents of the window. This fills every unused cell of the window with a space, so it's not necessary to call erase beforehand. gdb/ChangeLog: 2021-05-27 Hannes Domani <ssbssa@yahoo.de> * python/py-tui.c (tui_py_window::output): Add full_window argument. (gdbpy_tui_write): Parse "full_window" argument. gdb/doc/ChangeLog: 2021-05-27 Hannes Domani <ssbssa@yahoo.de> * python.texi (TUI Windows In Python): Document "full_window" argument.
2021-05-27Document gdb.SYMBOL_LOC_LABELHannes Domani1-0/+4
Looks like it was missing from the beginning. gdb/doc/ChangeLog: 2021-05-27 Hannes Domani <ssbssa@yahoo.de> * python.texi (Symbols In Python): Document gdb.SYMBOL_LOC_LABEL.
2021-05-25Fix documentation of gdb.SYMBOL_LOC_COMMON_BLOCKHannes Domani1-0/+4
gdb/doc/ChangeLog: 2021-05-25 Hannes Domani <ssbssa@yahoo.de> * python.texi (Symbols In Python): Fix gdb.SYMBOL_LOC_COMMON_BLOCK.
2021-05-24gdb/doc: add '@:' after 'e.g.' to help texinfoAndrew Burgess1-0/+8
Add '@:' after 'e.g.' to let texinfo know that this is not the end of a sentence. This is only needed when there's a space immediately after the last '.'. gdb/doc/ChangeLog: * gdb.texi (Initialization Files): Add '@:' after 'e.g.'. (Source Path): Likewise. (GDB/MI Development and Front Ends): Likewise. (ARM Features): Likewise. (gdb man): Likewise.
2021-05-14gdb/python: add a 'connection_num' attribute to Inferior objectsTankut Baris Aktemur1-0/+5
Define a 'connection_num' attribute for Inferior objects. The read-only attribute is the ID of the connection of an inferior, as printed by "info inferiors". In GDB's internal terminology, that's the process stratum target of the inferior. If the inferior has no target connection, the attribute is None. gdb/ChangeLog: 2021-05-14 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com> * python/py-inferior.c (infpy_get_connection_num): New function. (inferior_object_getset): Add a new element for 'connection_num'. * NEWS: Mention the 'connection_num' attribute of Inferior objects. gdb/doc/ChangeLog: 2021-05-14 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com> * python.texi (Inferiors In Python): Mention the 'connection_num' attribute. gdb/testsuite/ChangeLog: 2021-05-14 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com> * gdb.python/py-inferior.exp: Add test cases for 'connection_num'.
2021-05-12Revert "[gdb/symtab] Fix infinite recursion in dwarf2_cu::get_builder()"Tom de Vries1-5/+0
This reverts commit 4cf88725da1cb503be04d3237354105ec170bc86. It causes the following regression: ... $ cat shadow.cc namespace A {} int main() { using namespace A; return 0; } $ g++-10 -g shadow.cc -flto -o shadow $ ./gdb -q -batch ./shadow -ex "b main" Aborted (core dumped) ...
2021-05-12Guile: add value-const-valueGeorge Barrett1-0/+5
The Guile API doesn't currently have an equivalent to the Python API's gdb.Value.const_value(). This commit adds a procedure with equivalent semantics to the Guile API. gdb/ChangeLog: * NEWS (Guile API): Note the addition of the new procedure. * guile/scm-value.c (gdbscm_value_const_value): Add implementation of value-const-value procedure. (value_functions): Add value-const-value procedure. gdb/doc/ChangeLog: * guile.texi (Values From Inferior In Guile): Add documentation for value-const-value. gdb/testsuite/ChangeLog: * gdb.guile/scm-value.exp (test_value_in_inferior): Add test for value-const-value.
2021-05-12Guile: add value-{rvalue-,}reference-valueGeorge Barrett1-0/+6
The Guile API doesn't currently have an equivalent to the Python API's Value.reference_value() or Value.rvalue_reference_value(). This commit adds a procedure with equivalent semantics to the Guile API. gdb/ChangeLog: * NEWS (Guile API): Note the addition of new procedures. * guile/scm-value.c (gdbscm_reference_value): Add helper function for reference value creation. (gdbscm_value_reference_value): Add implementation of value-reference-value procedure. (gdbscm_value_rvalue_reference_value): Add implementation of value-rvalue-reference-value procedure. (value_functions): Add value-reference-value procedure. Add value-rvalue-reference-value procedure. gdb/doc/ChangeLog: * guile.texi (Values From Inferior In Guile): Add documentation for value-reference-value. Add documentation for value-rvalue-reference-value. gdb/testsuite/ChangeLog: * gdb.guile/scm-value.exp (test_value_in_inferior): Add test for value-reference-value. Add test for value-rvalue-reference-value.
2021-05-12Guile: improved rvalue reference supportGeorge Barrett1-0/+5
Adds a couple of missing bits to the Guile API to make C++11 rvalue reference values and types usable from Guile scripts. gdb/ChangeLog: * guile/scm-type.c (type_integer_constants): Add binding for TYPE_CODE_RVALUE_REF. * guile/scm-value.c (gdbscm_value_referenced_value): Handle dereferencing of rvalue references. * NEWS (Guile API): Note improvements in rvalue reference support. gdb/doc/ChangeLog: * guile.texi (Types In Guile): Add documentation for TYPE_CODE_RVALUE_REF.
2021-05-10gdb/doc: reword a sentenceAndrew Burgess1-0/+5
Change this: The available watchpoint types represented by constants are defined in the gdb module: to this: The available watchpoint types are represented by constants defined in the gdb module: The new version matches a similar line a few lines up the document which reads: The available types are represented by constants defined in the gdb module: gdb/doc/ChangeLog: * guile.texinfo (Breakpoints In Guile): Reword sentence. * python.texinfo (Breakpoints In Python): Reword sentence.
2021-05-09gdb/doc: document 'set debug py-unwind'Andrew Burgess1-0/+5
When the 'set debug py-unwind' flag was added, it was never documented in the manual. This commit adds some text for this command to the manual. gdb/doc/ChangeLog: * python.texinfo (Python Commands): Document 'set debug py-unwind' and 'show debug py-unwind'.
2021-05-09gdb/py: add some debugging to py-breakpoint.cAndrew Burgess1-0/+5
Adds some new debugging to python/py-breakpoint.c. gdb/ChangeLog: * python/py-breakpoint.c (pybp_debug): New static global. (show_pybp_debug): New function. (pybp_debug_printf): Define. (PYBP_SCOPED_DEBUG_ENTER_EXIT): Define. (gdbpy_breakpoint_created): Add some debugging. (gdbpy_breakpoint_deleted): Likewise. (gdbpy_breakpoint_modified): Likewise. (_initialize_py_breakpoint): New function. gdb/doc/ChangeLog: * python.texinfo (Python Commands): Document 'set debug py-breakpoint' and 'show debug py-breakpoint'.
2021-05-07[gdb/symtab] Fix infinite recursion in dwarf2_cu::get_builder()Tom de Vries1-0/+5
With the test-case attached in PR26327, gdb aborts: ... $ gdb -q -batch 447.dealII -ex "b main" Aborted (core dumped) ... when running out of stack due to infinite recursion: ... #8 0x00000000006aaba6 in dwarf2_cu::get_builder (this=0x35e4b40) at src/gdb/dwarf2/read.c:700 #9 0x00000000006aaba6 in dwarf2_cu::get_builder (this=0x22ee2c0) at src/gdb/dwarf2/read.c:700 #10 0x00000000006aaba6 in dwarf2_cu::get_builder (this=0x35e4b40) at src/gdb/dwarf2/read.c:700 #11 0x00000000006aaba6 in dwarf2_cu::get_builder (this=0x22ee2c0) at src/gdb/dwarf2/read.c:700 ... We're recursing in this code in dwarf2_cu::get_builder(): ... /* Otherwise, search ancestors for a valid builder. */ if (ancestor != nullptr) return ancestor->get_builder (); ... due to the fact that the ancestor chain is a cycle. Higher up in the call stack, we find some code that is responsible for triggering this, in new_symbol: ... case DW_TAG_formal_parameter: { /* If we are inside a function, mark this as an argument. If not, we might be looking at an argument to an inlined function when we do not have enough information to show inlined frames; pretend it's a local variable in that case so that the user can still see it. */ struct context_stack *curr = cu->get_builder ()->get_current_context_stack (); if (curr != nullptr && curr->name != nullptr) SYMBOL_IS_ARGUMENT (sym) = 1; ... This is code that was added to support pre-4.1 gcc, to be able to show arguments of inlined functions as locals, in the absense of sufficiently correct debug information. Removing this code (that is, doing SYMBOL_IS_ARGUMENT (sym) = 1 unconditially), fixes the crash. The ancestor variable also seems to have been added specifically to deal with fallout from this code, so remove that as well. Tested on x86_64-linux: - openSUSE Leap 15.2 with gcc 7.5.0, and - openSUSE Tumbleweed with gcc 10.3.0. gdb/ChangeLog: 2021-05-07 Tom de Vries <tdevries@suse.de> PR symtab/26327 * dwarf2/read.c (struct dwarf2_cu): Remove ancestor. (dwarf2_cu::get_builder): Remove ancestor-related code. (new_symbol): Remove code supporting pre-4.1 gcc that show arguments of inlined functions as locals. (follow_die_offset, follow_die_sig_1): Remove setting of ancestor. gdb/doc/ChangeLog: 2021-05-07 Tom de Vries <tdevries@suse.de> PR symtab/26327 * gdb.texinfo (Inline Functions): Update.
2021-05-06gdb/mi: add a '--force' flag to the '-break-condition' commandTankut Baris Aktemur1-0/+5
Add a '--force' flag to the '-break-condition' command to be able to force conditions. gdb/ChangeLog: 2021-05-06 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com> * mi/mi-cmd-break.c (mi_cmd_break_condition): New function. * mi/mi-cmds.c: Change the binding of "-break-condition" to mi_cmd_break_condition. * mi/mi-cmds.h (mi_cmd_break_condition): Declare. * breakpoint.h (set_breakpoint_condition): Declare a new overload. * breakpoint.c (set_breakpoint_condition): New overloaded function extracted out from ... (condition_command): ... this. * NEWS: Mention the change. gdb/testsuite/ChangeLog: 2021-05-06 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com> * gdb.mi/mi-break.exp (test_forced_conditions): Add a test for the -break-condition command's "--force" flag. gdb/doc/ChangeLog: 2021-05-06 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com> * gdb.texinfo (GDB/MI Breakpoint Commands): Mention the '--force' flag of the '-break-condition' command.
2021-05-06gdb/mi: add a '--force-condition' flag to the '-break-insert' cmdTankut Baris Aktemur1-0/+6
Add a '--force-condition' flag to the '-break-insert' command to be able to force conditions. Because the '-dprintf-insert' command uses the same mechanism as the '-break-insert' command, it obtains the '--force-condition' flag, too. gdb/ChangeLog: 2021-05-06 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com> * mi/mi-cmd-break.c (mi_cmd_break_insert_1): Recognize the '--force-condition' flag to force the condition in the '-break-insert' and '-dprintf-insert' commands. * NEWS: Mention the change. gdb/testsuite/ChangeLog: 2021-05-06 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com> * gdb.mi/mi-break.exp (test_forced_conditions): New proc that is called by the test. gdb/doc/ChangeLog: 2021-05-06 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com> * gdb.texinfo (GDB/MI Breakpoint Commands): Mention the '--force-condition' flag of the '-break-insert' and '-dprintf-insert' commands.
2021-05-04gdb: update Type.fields doc based on actual GDB behaviorSimon Marchi1-0/+6
I noticed two errors in the Type.fields documentation: 1. It is possible to call `fields` on an array type, in which case it returns one field representing the array's range. It is not mentioned. 2. When calling `fields` on a type that doesn't have fields (by nature, like an int), GDB raises a TypeError. It does not return an empty sequence, as currently documented. Fix these, and change the text into a bullet list. I find it easier to read than one big paragraph. The first issue is already tested in gdb.python/py-type.exp, but the second one doesn't seem tested. Add a test in gdb.python/py-type.exp for it. gdb/doc/ChangeLog: * python.texi (Types In Python): Re-organize Type.fields doc. Mention handling of array types. Correct doc for when calling the method on another type. gdb/testsuite/ChangeLog: * gdb.python/py-type.exp (test_fields): Test calling fields on an int type. Change-Id: I11c688177504cb070b81a4446ac91dec50b56a22
2021-04-28gdb/doc: use @env to reference environment variablesAndrew Burgess1-0/+15
Clean up a few places where we are not using @env{...} to reference environment variables. gdb/doc/ChangeLog: * gdb.texinfo (Initialization Files): Use @env when referencing environment variables. (Shell Commands): Likewise. (Starting): Likewise. (Arguments): Likewise. (Environment): Likewise. (Edit): Likewise. (Compiling and Injecting Code): Likewise. (Files): Likewise. (Command History): Likewise. (Screen Size): Likewise. (Emacs): Likewise.
2021-04-28gdb: startup commands to control Python extension languageAndrew Burgess1-0/+4
Add two new commands to GDB that can be placed into the early initialization to control how Python starts up. The new options are: set python ignore-environment on|off set python dont-write-bytecode auto|on|off show python ignore-environment show python dont-write-bytecode These can be used from GDB's startup file to control how the Python extension language behaves. These options are equivalent to the -E and -B flags to python respectively, their descriptions from the Python man page: -E Ignore environment variables like PYTHONPATH and PYTHONHOME that modify the behavior of the interpreter. -B Don't write .pyc files on import. gdb/ChangeLog: * NEWS: Mention new commands. * python/python.c (python_ignore_environment): New static global. (show_python_ignore_environment): New function. (set_python_ignore_environment): New function. (python_dont_write_bytecode): New static global. (show_python_dont_write_bytecode): New function. (set_python_dont_write_bytecode): New function. (_initialize_python): Register new commands. gdb/doc/ChangeLog: * python.texinfo (Python Commands): Mention new commands. gdb/testsuite/ChangeLog: * gdb.python/py-startup-opt.exp: New file.
2021-04-25[PR gdb/22640] ptype: add option to use hexadecimal notationLancelot SIX1-0/+7
This commit adds a flag to the ptype command in order to print the offsets and sizes of struct members using the hexadecimal notation. The 'x' flag ensures use of the hexadecimal notation while the 'd' flag ensures use of the decimal notation. The default is to use decimal notation. Before this patch, gdb only uses decimal notation, as pointed out in PR gdb/22640. Here is an example of this new behavior with hex output turned on: (gdb) ptype /ox struct type_print_options /* offset | size */ type = struct type_print_options { /* 0x0000: 0x0 | 0x0004 */ unsigned int raw : 1; /* 0x0000: 0x1 | 0x0004 */ unsigned int print_methods : 1; /* 0x0000: 0x2 | 0x0004 */ unsigned int print_typedefs : 1; /* 0x0000: 0x3 | 0x0004 */ unsigned int print_offsets : 1; /* 0x0000: 0x4 | 0x0004 */ unsigned int print_in_hex : 1; /* XXX 3-bit hole */ /* XXX 3-byte hole */ /* 0x0004 | 0x0004 */ int print_nested_type_limit; /* 0x0008 | 0x0008 */ typedef_hash_table *local_typedefs; /* 0x0010 | 0x0008 */ typedef_hash_table *global_typedefs; /* 0x0018 | 0x0008 */ ext_lang_type_printers *global_printers; /* total size (bytes): 32 */ } This patch also adds the 'set print type hex' and 'show print type hex' commands in order to set and inspect the default behavior regarding the use of decimal or hexadecimal notation when printing struct sizes and offsets. Tested using on x86_64. gdb/ChangeLog: PR gdb/22640 * typeprint.h (struct type_print_options): Add print_in_hex flag. (struct print_offset_data): Add print_in_hex flag, add a constructor accepting a type_print_options* argument. * typeprint.c (type_print_raw_options, default_ptype_flags): Set default value for print_in_hex. (print_offset_data::indentation): Allow more horizontal space. (print_offset_data::print_offset_data): Add ctor. (print_offset_data::maybe_print_hole, print_offset_data::update): Handle the print_in_hex flag. (whatis_exp): Handle 'x' and 'd' flags. (print_offsets_and_sizes_in_hex): Declare. (set_print_offsets_and_sizes_in_hex): Create. (show_print_offsets_and_sizes_in_hex): Create. (_initialize_typeprint): Update help message for the ptype command, register the 'set print type hex' and 'show print type hex' commands. * c-typeprint.c (c_print_type, c_type_print_base_struct_union) (c_type_print_base): Construct the print_offset_data object using the type_print_optons parameter. * rust-lang.c (rust_language::print_type): Construct the print_offset_data object using the type_print_optons parameter. * NEWS: Mention the new flags of the ptype command. gdb/doc/ChangeLog: PR gdb/22640 * gdb.texinfo (Symbols): Describe the 'x' and 'd' flags of the ptype command, describe 'set print type hex' and 'show print type hex' commands. Update 'ptype/o' examples. gdb/testsuite/ChangeLog: PR gdb/22640 * gdb.base/ptype-offsets.exp: Add tests to verify the behavior of 'ptype/ox' and 'ptype/od'. Check that 'set print type hex' changes the default behavior of 'ptype/o'. Update to take into account new horizontal layout. * gdb.rust/simple.exp: Update ptype test to check new horizontal layout. * gdb.rust/union.exp: Same.
2021-04-21gdb/breakpoint: display "N" on MI for disabled-by-condition locationsTankut Baris Aktemur1-0/+5
For breakpoint locations that are disabled because of an invalid condition, CLI displays "N*" in the 'enabled' field, where '*' refers to the footnote below the table: (*): Breakpoint condition is invalid at this location. This is not necessary for MI, where we shall simply print "N" without the footnote. Update the document to mention the "N" value for the MI. Also remove the line about the 'enable' field, because there is no such field for locations. gdb/ChangeLog: 2021-04-21 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com> * breakpoint.c (print_one_breakpoint_location): Display "N" for disabled-by-condition locations on MI-like output. (breakpoint_1): Do not display the disabled-by-condition footnote if the output is MI-like. gdb/doc/ChangeLog: 2021-04-21 Tankut Baris Aktemur <tankut.baris.aktemur@intel.com> * gdb.texinfo (GDB/MI Breakpoint Information): Update the description for the 'enabled' field of breakpoint locations.
2021-04-15gdb: add "set startup-quietly" commandTom Tromey1-0/+5
This adds a new command to change GDB to behave as though "-quiet" were always given. This new command can be added to the gdbearlyinit file to affect future GDB sessions. gdb/ChangeLog: * NEWS: Add entry. * main.c (captured_main_1): Call check_quiet_mode. * top.c (startup_quiet): New global. (check_quiet_mode): New function. (show_startup_quiet): New function. (init_main): Register new command. * top.h (check_quiet_mode): Declare. gdb/doc/ChangeLog: * gdb.texinfo (Mode Options): Mention "set startup-quietly". gdb/testsuite/ChangeLog: * gdb.base/startup-file.exp: Add more tests.
2021-04-15gdb: process early initialization files and command line optionsAndrew Burgess1-0/+9
Adds the ability to process commands at a new phase during GDB's startup. This phase is earlier than the current initialisation file processing, before GDB has produced any output. The number of commands that can be processed at this early stage will be limited, and it is expected that the only commands that would be processed at this stage will relate to some of the fundamentals of how GDB starts up. Currently the only commands that it makes sense to add to this early initialization file are those like 'set style version ....' as the version string is displayed during startup before the standard initialization files are parsed. As such this commit fully resolved bug cli/25956. This commit adds a mechanism to execute these early initialization files from a users HOME directory, as well as some corresponding command line flags for GDB. The early initialization files that GDB will currently check for are ~/.config/gdb/gdbearlyinit (on Linux like systems) or ~/.gdbearlyinit if the former is not found. The output of 'gdb --help' has been extended to include a list of the early initialization files being processed. gdb/ChangeLog: PR cli/25956 * NEWS: Mention new early init files and command line options. * config.in: Regenerate. * configure: Regenerate. * configure.ac: Define GDBEARLYINIT. * main.c (get_earlyinit_files): New function. (enum cmdarg_kind): Add CMDARG_EARLYINIT_FILE and CMDARG_EARLYINIT_COMMAND. (captured_main_1): Add support for new command line flags, and for processing startup files. (print_gdb_help): Include startup files in the output. gdb/doc/ChangeLog: PR cli/25956 * gdb.texinfo (File Options): Mention new command line options. (Startup): Discuss when early init files are processed. (Initialization Files): Add description of early init files. (Output Styling): Update description of 'version' style. (gdb man): Mention early init files. gdb/testsuite/ChangeLog: PR cli/25956 * gdb.base/early-init-file.c: New file. * gdb.base/early-init-file.exp: New file. * lib/gdb-utils.exp (style): Handle style 'none'.
2021-04-14gdb/doc: add missing parentheses around prompt in some examplesAndrew Burgess1-0/+7
While reading the manual for -info-os I noticed that the GDB prompt is given as 'gdb' when it should really be '(gdb)'. This is because the prompt is created with: '@value{GDBP}'. The GDBP variable (the GDB program name) is intended for use as the prompt string (though this is not used consistently throughout the manual), however it is normally used like '(@value{GDBP})', but in a couple of places the enclosing parentheses are missing. In this commit I do the following: - Change '@value{GDBP}' to '(@value{GDBP})' wherever the variable represents a prompt string. - Replaces '(gdb)' with '(@value{GDBP})' in one example where we are already using '(@value{GDBP})', this makes that one example consistent. I have NOT: - Changed all instances of '(gdb)' with '(@value{GDBP})', this would be a huge change. gdb/doc/ChangeLog: * gdb.texinfo (GDB/MI Miscellaneous Commands): Add missing parentheses to GDB prompt in example, and replace '(gdb)' with '(@value{GDBP})' in one example where the latter was already in use.
2021-03-29Fix memory tagging section typeLuis Machado1-0/+4
It was reported to me that on Ubuntu 14.04 (fairly old) the documentation fails to build with the following: gdb/doc/gdb.texinfo:10888: warning: node `Memory' is up for `Memory Tagging' in sectioning but not in menu gdb/doc/gdb.texinfo:10693: node `Memory' lacks menu item for `Memory Tagging' despite being its Up target Makefile:491: recipe for target 'gdb.info' failed make[3]: *** [gdb.info] Error 1 This doesn't seem to happen on Ubuntu 18.04/20.04, but it does make sense. Fix this by turning @subsection into a @section and adding the "Memory Tagging" entry to the menu. gdb/doc/ChangeLog: 2021-03-29 Luis Machado <luis.machado@linaro.org> * gdb.textinfo (Memory Tagging): Make it a @section.
2021-03-24Document new "x" and "print" memory tagging extensionsLuis Machado1-0/+9
Document the changes to the "print" and "x" commands to support memory tagging. gdb/doc/ChangeLog: 2021-03-24 Luis Machado <luis.machado@linaro.org> * gdb.texinfo (Data): Document memory tagging changes to the "print" command. (Examining Memory): Document memory tagging changes to the "x" command. (Memory Tagging): Update with more information on changes to the "x" and "print" commands.
2021-03-24Documentation for the new mtag commandsLuis Machado1-0/+5
Document the new "memory-tag" command prefix and all of its subcommands. gdb/doc/ChangeLog: 2021-03-24 Luis Machado <luis.machado@linaro.org> * gdb.texinfo (Memory Tagging): New subsection and node. (AArch64 Memory Tagging Extension): New subsection.
2021-03-24Documentation for memory tagging remote packetsLuis Machado1-0/+6
Document the remote packet changes to support memory tagging. gdb/doc/ChangeLog: 2021-03-24 Luis Machado <luis.machado@linaro.org> * gdb.texinfo (General Query Packets): Document qMemTags and QMemTags. Document the "memory-tagging" feature. (ARM-Specific Protocol Details): Document memory tag types.
2021-03-18gdb/doc: fix the example for get_set_string in Python API docsAndrew Burgess1-0/+5
The small example for gdb.Parameter.get_set_string does not return a string. The documentation is very clear that this method must return a string, and indeed, inspecting the code in gdb/python/py-param.c shows that a string return value is required (if an exception is not thrown). While inspecting the code in gdb/python/py-param.c I noticed that the comment for the C++ code that invokes the Python get_set_string method is wrong, so I updated that too. gdb/ChangeLog: * python/py-param.c (get_set_value): Update header comment. gdb/doc/ChangeLog: * python.texinfo (Parameters In Python): Return empty string in small example code.
2021-02-24gdb: add a new 'maint info target-sections' commandAndrew Burgess1-0/+5
We already have a command 'maint info sections', this command prints all sections from all known object files. However, GDB maintains a second section table internally. This section table is used when GDB wants to read directly from an object file rather than actually reading memory on the target. As such only some sections (the allocatable ones) are added to this secondary section table. I recently ran into a situation where some of GDB's optimisations for reading directly from the files were not working. In 'maint info sections' I could see that GDB knew about the object file, and did know about the sections that it _should_ have been reading from. But I couldn't ask GDB which sections it had copied into its secondary section table. This commit adds a new command 'maint info target-sections' that fills this gap. This command lists only those sections that GDB has copied into its secondary table. You'll notice that the testsuite includes a comment indicating that there's a bug in GDB. Normally this is not something I would add to the testsuite, instead we should raise an actual bugzilla bug and then mark an xfail, however, a later patch in this series will remove this comment once the actual bug in GDB is fixed. gdb/ChangeLog: * NEWS: Mention new 'maint info target-sections' command. * maint.c (maintenance_info_target_sections): New function. (_initialize_maint_cmds): Register new command. gdb/doc/ChangeLog: * gdb.texinfo (Files): Document new 'maint info target-sections' command. gdb/testsuite/ChangeLog: * gdb.base/maint-info-sections.exp: Add new tests. (check_maint_info_target_sections_output): New proc.
2021-02-17[PR cli/17290] gdb/doc: Fix show remote interrupt-*.Lancelot SIX1-0/+6
Add the missing 'remote' in: - @item show remote interrupt-sequence - @item show remote interrupt-on-connect
2021-02-11gdb: change 'maint info section' to use command optionsAndrew Burgess1-0/+5
The 'maintenance info sections' command currently takes a list of filters on the command line. It can also accept the magic string 'ALLOBJ' which acts more like a command line flag, telling the command to print information about all objfiles. The manual has this to say about the options and filters: ... In addition, 'maint info sections' provides the following command options (which may be arbitrarily combined): ... Implying (to me at least) that I can do this: (gdb) maint info sections ALLOBJ READONLY to list all the read-only sections from all currently loaded object files. Unfortunately, this doesn't work. The READONLY filter will work, but ALLOBJ will not be detected correctly. It would be fairly simple to fix the ALLOBJ detection. However, I dislike this mixing of command options (ALLOBJ) with command data (the filters, e.g. READONLY, etc). As this is a maintenance command, so not really intended for end users, I think we can be a little more aggressive in "fixing" the option parsing. So that's what I do in this commit. The ALLOBJ mechanism is replaced with a real command option (-all-objects). The rest of the command operates just as before. The example above would now become: (gdb) maint info sections -all-objects READONLY The manual has been updated, and I added a NEWS entry to document the change. gdb/ChangeLog: * NEWS: Mention changes to 'maint info sections'. * maint.c (match_substring): Return a bool, fix whitespace issue. (struct single_bfd_flag_info): New struct. (bfd_flag_info): New static global. (match_bfd_flags): Return a bool, use bfd_flag_info. (print_bfd_flags): Use bfd_flag_info. (maint_print_section_info): Delete trailing whitespace. (struct maint_info_sections_opts): New struct. (maint_info_sections_option_defs): New static global. (maint_info_sections_completer): New function. (maintenance_info_sections): Use option parsing mechanism. (_initialize_maint_cmds): Register command completer. gdb/doc/ChangeLog: * gdb.texinfo (Files): Update documentation for 'maint info sections'. gdb/testsuite/ChangeLog: * gdb.base/maint-info-sections.exp: Update expected output, and add additional tests. Again.
2021-02-08gdb: return true in TuiWindow.is_valid only if TUI is enabledAndrew Burgess1-0/+5
If the user implements a TUI window in Python, and this window responds to GDB events and then redraws its window contents then there is currently an edge case which can lead to problems. The Python API documentation suggests that calling methods like erase or write on a TUI window (from Python code) will raise an exception if the window is not valid. And the description for is_valid says: This method returns True when this window is valid. When the user changes the TUI layout, windows no longer visible in the new layout will be destroyed. At this point, the gdb.TuiWindow will no longer be valid, and methods (and attributes) other than is_valid will throw an exception. From this I, as a user, would expect that if I did 'tui disable' to switch back to CLI mode, then the window would no longer be valid. However, this is not the case. When the TUI is disabled the windows in the TUI are not deleted, they are simply hidden. As such, currently, the is_valid method continues to return true. This means that if the users Python code does something like: def event_handler (e): global tui_window_object if tui_window_object->is_valid (): tui_window_object->erase () tui_window_object->write ("Hello World") gdb.events.stop.connect (event_handler) Then when a stop event arrives GDB will try to draw the TUI window, even when the TUI is disabled. This exposes two bugs. First, is_valid should be returning false in this case, second, if the user forgot to add the is_valid call, then I believe the erase and write calls should be throwing an exception (when the TUI is disabled). The solution to both of these issues is I think bound together, as it depends on having a working 'is_valid' check. There's a rogue assert added into tui-layout.c as part of this commit. While working on this commit I managed to break GDB such that TUI_CMD_WIN was nullptr, this was causing GDB to abort. I'm leaving the assert in as it might help people catch issues in the future. This patch is inspired by the work done here: https://sourceware.org/pipermail/gdb-patches/2020-December/174338.html gdb/ChangeLog: * python/py-tui.c (gdbpy_tui_window) <is_valid>: New member function. (REQUIRE_WINDOW): Call is_valid member function. (REQUIRE_WINDOW_FOR_SETTER): New define. (gdbpy_tui_is_valid): Call is_valid member function. (gdbpy_tui_set_title): Call REQUIRE_WINDOW_FOR_SETTER instead. * tui/tui-data.h (struct tui_win_info) <is_visible>: Check tui_active too. * tui/tui-layout.c (tui_apply_current_layout): Add an assert. * tui/tui.c (tui_enable): Move setting of tui_active earlier in the function. gdb/doc/ChangeLog: * python.texinfo (TUI Windows In Python): Extend description of TuiWindow.is_valid. gdb/testsuite/ChangeLog: * gdb.python/tui-window-disabled.c: New file. * gdb.python/tui-window-disabled.exp: New file. * gdb.python/tui-window-disabled.py: New file.
2021-02-02Inferior without argument prints detail of current inferior.Lancelot SIX1-0/+5
This patch makes the inferior command display information about the current inferior when called with no argument. This behavior is similar to the one of the thread command. Before patch: (gdb) info inferior Num Description Connection Executable * 1 process 19221 1 (native) /home/lsix/tmp/a.out 2 process 19239 1 (native) /home/lsix/tmp/a.out (gdb) inferior 2 [Switching to inferior 2 [process 19239] (/home/lsix/tmp/a.out)] [Switching to thread 2.1 (process 19239)] #0 0x0000000000401146 in main () (gdb) inferior Argument required (expression to compute). After patch: (gdb) info inferior Num Description Connection Executable * 1 process 18699 1 (native) /home/lsix/tmp/a.out 2 process 18705 1 (native) /home/lsix/tmp/a.out (gdb) inferior 2 [Switching to inferior 2 [process 18705] (/home/lsix/tmp/a.out)] [Switching to thread 2.1 (process 18705)] #0 0x0000000000401146 in main () (gdb) inferior [Current inferior is 2 [process 18705] (/home/lsix/tmp/a.out)] gdb/doc/ChangeLog: * gdb.texinfo (Inferiors Connections and Programs): Document the inferior command when used without argument. gdb/ChangeLog: * NEWS: Add entry for the behavior change of the inferior command. * inferior.c (inferior_command): When no argument is given to the inferior command, display info about the currently selected inferior. gdb/testsuite/ChangeLog: * gdb.base/inferior-noarg.c: New test. * gdb.base/inferior-noarg.exp: New test.
2021-01-27Remove extra space after @pxref in gdb.texinfoTom Tromey1-0/+4
Internally at AdaCore, documentation is still built with Texinfo 4.13. This version gave an error when building gdb.texinfo: ../../../binutils-gdb/gdb/doc/gdb.texinfo:27672: @pxref expected braces. ../../../binutils-gdb/gdb/doc/gdb.texinfo:27672: ` {dotdebug_gdb_scripts section,,The @cod...' is too long for expansion; not expanded. ... followed by many more spurious errors that were caused by this one. This patch fix the problem by removing the extra space. I don't know whether it's advisable to try to support this ancient version of Texinfo (released in 2008 apparently); but in this particular case the fix is trivial, so I'm checking it in. gdb/doc/ChangeLog 2021-01-27 Tom Tromey <tromey@adacore.com> * gdb.texinfo (Auto-loading extensions): Remove extraneous space.
2021-01-25gdb/docs: add parentheses in Python examples using printMarco Barisione1-0/+4
This makes the examples work both in Python 2 and 3. gdb/doc/ChangeLog: * python.texi: Add parentheses to print statements/functions. Change-Id: I8571f2ee005acd96c7bb43f9882d19b00b2aa3db
2021-01-25gdb/doc: move @menu blocks to the end of their enclosing @nodeAndrew Burgess1-0/+9
The @menus should be at the end of a @node. We mostly get this right, but there's a few places where we don't. This commit fixes the 5 places we get this wrong. I manually checked the info page and read each of the offending nodes after this change and I believe they all still make sense with the menu moved. gdb/doc/ChangeLog: * gdb.texinfo (Specify Location): Move menu to the end of the node. (Auto-loading): Likewise. (Extending GDB): Likewise. (TUI): Likewise. (Operating System Information): Likewise.
2021-01-22gdb: add new version styleAndrew Burgess1-0/+5
This commit adds a new 'version' style, which replaces the hard coded styling currently used for GDB's version string. GDB's version number is displayed: 1. In the output of 'show version', and 2. When GDB starts up (without the --quiet option). This new style can only ever affect the first of these two cases as the second case is printed before GDB has processed any initialization files, or processed any GDB commands passed on the command line. However, because the first case exists I think this commit makes sense, it means the style is no longer hard coded into GDB, and we can add some tests that the style can be enabled/disabled correctly. This commit is an alternative to a patch Tom posted here: https://sourceware.org/pipermail/gdb-patches/2020-June/169820.html I've used the style name 'version' instead of 'startup' to reflect what the style is actually used for. If other parts of the startup text end up being highlighted I imagine they would get their own styles based on what is being highlighted. I feel this is more inline with the other style names that are already in use within GDB. I also decoupled adding this style from the idea of startup options, and the possibility of auto-saving startup options. Those ideas can be explored in later patches. This commit should probably be considered only a partial solution to issue PR cli/25956. The colours of the style are no longer hard coded, however, it is still impossible to change the styling of the version string displayed during startup, so in one sense, the styling of that string is still "hard coded". A later patch will hopefully extend GDB to allow it to adjust the version styling before the initial version string is printed. gdb/ChangeLog: PR cli/25956 * cli/cli-style.c: Add 'cli/cli-setshow.h' include. (version_style): Define. (cli_style_option::cli_style_option): Add intensity parameter, and use as appropriate. (_initialize_cli_style): Register version style set/show commands. * cli/cli-style.h (cli_style_option): Add intensity parameter. (version_style): Declare. * top.c (print_gdb_version): Use version_stype, and styled_string to print the GDB version string. gdb/doc/ChangeLog: PR cli/25956 * gdb.texinfo (Output Styling): Document version style. gdb/testsuite/ChangeLog: PR cli/25956 * gdb.base/style.exp (run_style_tests): Add version string test. (test_startup_version_string): Use version style name. * lib/gdb-utils.exp (style): Handle version style name.
2021-01-22gdb/doc: don't rely on @menu item within the docsAndrew Burgess1-0/+5
The node 'Auto-loading extensions' currently relies on a @menu item to provide a set of cross-references to different parts of the manual. Additionally the menu is placed part way through the node and the text prior to the menu seems (to me) to assume that the menu will be formatted into the document. This is a bad idea as the menus are not always part of the final document (e.g. pdf output does not include the menu), when compared to the info page the pdf version of this node is less helpful as it lacks proper cross references. Menus should always be placed at the end of a node. In this commit I rewrite a paragraph to add extra cross references inline within the text. I then move the menu to the end of the node. gdb/doc/ChangeLog: * gdb.texinfo (Auto-loading extensions): Add additional cross references and move @menu to the end of the node.
2021-01-22gdb/doc: move @menu to the end of the nodeAndrew Burgess1-0/+4
Commit: commit a72d0f3d69896b5fcdc916e0547fe774dcb58614 Date: Tue Jan 12 13:02:30 2021 +0000 gdb/doc: reorder and group sections relating to aliases Added a @menu block into the wrong place within a @node. This commit moves it to the end of the @node, where it should be been placed. gdb/doc/ChangeLog: * gdb.texinfo (Aliases): Move @menu to the end of the node.
2021-01-22gdb/doc: down case contents of @varAndrew Burgess1-0/+4
After a discussion on a recent patch it was pointed out that the contents of a @var should (generally) be lower case. I took a look through the GDB manual and there are a small number of places where the contents are currently upper case, but one in particular seemed like an obvious candidate for being down cased, so lets do that. gdb/doc/ChangeLog: * gdb.texinfo (PowerPC Embedded): Down case contents of @var.
2021-01-21gdb/doc: reorder and group sections relating to aliasesAndrew Burgess1-0/+13
This started by observing that the section name: Automatically prepend default arguments to user-defined aliases Is very long. When this is rendered in the PDF manual (at least for me), this name is so long that in the table of contents the page number ends up being misaligned. My first thought was we could drop the 'to user-defined aliases' bit if this section became a sub-section of the section on aliases. So then I looked for a section with 'aliases' in its name, and couldn't find one. It turns out that aliases are documented in a section called: Creating new spellings of existing commands Which (to me) seems an odd aspect of aliases to emphasise. So, in this patch I make the following changes: - Move the section on aliases earlier in the manual, this is now immediately after the section about creating user defined commands. This made more sense to me. - Rename the section on aliases from 'Creating new spellings of existing commands' to 'Command Aliases'. - Update the wording of the first paragraph in the 'Command Aliases' section so that it reads better given the new name. - Add a cross-reference from the 'Command Aliases' section to the 'Python' section now that the aliases section comes first. - Down case all the text inside @var within this section as this is the correct style for the GDB manual. - Move the section on default args to become a sub-section of the 'Command Aliases' section, and rename this sub-section from 'Automatically prepend default arguments to user-defined aliases' to 'Default Arguments'. - Add @menu into the 'Command Aliases' section to link to the 'Default Arguments' subsection. - Add a @cindex entry to the default arguments sub-section. gdb/doc/ChangeLog: * gdb.texinfo (Commands): Update menu. (Extending GDB): Likewise. (Command aliases default args): Moved later into the document, added a cindex entry. Renamed the section 'Automatically prepend default arguments to user-defined aliases' to 'Default Arguments'. (Aliases): Moved earlier in the document. Minor rewording of the first paragraph, down-cased the text inside all uses of @var, and added a cross reference to the Python code. Renamed the section 'Creating new spellings of existing commands' to 'Command Aliases'.
2021-01-21Add Python support for hardware breakpointsHannes Domani1-0/+6
This allows the creation of hardware breakpoints in Python with gdb.Breakpoint(type=gdb.BP_HARDWARE_BREAKPOINT) And they are included in the sequence returned by gdb.breakpoints(). gdb/ChangeLog: 2021-01-21 Hannes Domani <ssbssa@yahoo.de> PR python/19151 * python/py-breakpoint.c (bppy_get_location): Handle bp_hardware_breakpoint. (bppy_init): Likewise. (gdbpy_breakpoint_created): Likewise. gdb/doc/ChangeLog: 2021-01-21 Hannes Domani <ssbssa@yahoo.de> PR python/19151 * python.texi (Breakpoints In Python): Document gdb.BP_HARDWARE_BREAKPOINT. gdb/testsuite/ChangeLog: 2021-01-21 Hannes Domani <ssbssa@yahoo.de> PR python/19151 * gdb.python/py-breakpoint.exp: Add tests for hardware breakpoints.
2021-01-01Manual updates of copyright year range not covered by gdb/copyright.pyJoel Brobecker1-0/+4
gdb/ChangeLog: * gdbarch.sh: Update copyright year range. gdb/doc/ChangeLog: * gdb.texinfo, refcard.tex: Update copyright year range.
2020-12-29Fix wrong method nameHannes Domani1-0/+4
The objects returned by FrameDecorator.frame_args need to implement a method named symbol, not argument. gdb/doc/ChangeLog: 2020-12-29 Hannes Domani <ssbssa@yahoo.de> * python.texi (Frame Decorator API): Fix method name.
2020-12-23Clarify language for the '?' packetAlex Bennée1-0/+4
Both QEMU and kgdb make the assumption that the '?' packet is only sent during the initial setup of a gdbstub connection. Both use that knowledge to reset breakpoints and ensure the gdbstub is in a clean-state on a resumed connection. This can cause confusion for others implementing clients that speak to gdbstub devices. To avoid that make the language clearer that this is a start-up query packet that you only expect to see once. Signed-off-by: Alex Bennée <alex.bennee@linaro.org> gdb/doc/ChangeLog: * gdb.texinfo (Packets): Clarify language for ? packet. Change-Id: Iae25d3110fe28b8d2467704962a6889e55224ca5
2020-12-21gdb.texinfo: Document GMP as mandatory requirement to build GDBJoel Brobecker1-0/+4
gdb/doc/ChangeLog * gdb.texinfo (Requirements): Add GMP to list of requirements.
2020-12-18Remove erroneous 'a' in gdb.register_window_type documentationHannes Domani1-0/+4
gdb/doc/ChangeLog: 2020-12-18 Hannes Domani <ssbssa@yahoo.de> * python.texi (TUI Windows In Python): Remove erroneous 'a'.
2020-12-18Add address keyword to Value.format_stringHannes Domani1-0/+4
This makes it possible to disable the address in the result string: const char *str = "alpha"; (gdb) py print(gdb.parse_and_eval("str").format_string()) 0x404000 "alpha" (gdb) py print(gdb.parse_and_eval("str").format_string(address=False)) "alpha" gdb/ChangeLog: 2020-12-18 Hannes Domani <ssbssa@yahoo.de> * python/py-value.c (valpy_format_string): Implement address keyword. gdb/doc/ChangeLog: 2020-12-18 Hannes Domani <ssbssa@yahoo.de> * python.texi (Values From Inferior): Document the address keyword. gdb/testsuite/ChangeLog: 2020-12-18 Hannes Domani <ssbssa@yahoo.de> * gdb.python/py-format-string.exp: Add tests for address keyword.
2020-12-17gdb/doc: fix "show check range" command nameSimon Marchi1-0/+6
gdb/doc/ChangeLog: PR gdb/27088 * gdb.texinfo (Range Checking): Fix "show check range" command name. Change-Id: I0248ef76d205ac49ed71b813aafe3e630c2ffc2e
2020-12-13gdb: new command 'maint flush dcache'Andrew Burgess1-0/+5
Add a new command to flush the dcache. gdb/ChangeLog: * NEWS: Mention new commands. * target-dcache.c: Add 'cli/cli-cmds.h' include. (maint_flush_dcache_command): New function. (_initialize_target_dcache): Create new 'maint flush dcache' command. gdb/doc/ChangeLog: * gdb.texinfo (Caching Target Data): Document 'maint flush dcache'. gdb/testsuite/ChangeLog: * gdb.base/dcache-flush.c: New file. * gdb.base/dcache-flush.exp: New file.