summaryrefslogtreecommitdiff
path: root/gdb/doc
Commit message (Collapse)AuthorAgeFilesLines
* [gdb] Move ChangeLog entries to their right filesPedro Alves2020-01-161-0/+217
| | | | | | | | | | I spotted a few misplaced entries in the ChangeLog-2019 entries, and went on to fix them. Looking around I saw a good number of other entries in other years. Then OCD got the best of me and I fixed them all. Also fixes cases of wrong paths in entries, like "* gdb/foo.c" instead of "* foo.c".
* Multi-target: NEWS and user manualPedro Alves2020-01-104-44/+114
| | | | | | | | | | | | | | | | | | | | | | | This commit documents the new multi-target features in both NEWS and user manual. gdb/ChangeLog: 2020-01-10 Pedro Alves <palves@redhat.com> * NEWS: Mention multi-target debugging, "info connections", and "add-inferior -no-connection". gdb/doc/ChangeLog: 2020-01-10 Pedro Alves <palves@redhat.com> * gdb.texinfo (Starting): Say "current inferior not connected" instead of "GDB not connected". (Inferiors and Programs): Rename node to ... (Inferiors Connections and Programs): ... this. Update all references. Talk about multiple target connections. Update "info inferiors" info to mention the connections column. Describe "info connections". Document "add-inferior -no-connection". * guile.texi, python.texi: Update cross references.
* Update copyright year in gdbarch.sh doc/gdb.texinfo and doc/refcard.texJoel Brobecker2020-01-013-4/+8
| | | | | | | | | | | | | These are files that need to be updated by hand, because the copyright.py script isn't able to handle them automatically. gdb/ChangeLog: * gdbarch.sh: Update copyright year range of generated files. gdb/doc/ChangeLog: * gdb.texinfo, refcard.tex: Update copyright year range.
* Update copyright year range in all GDB files.Joel Brobecker2020-01-0114-14/+14
| | | | | | gdb/ChangeLog: Update copyright year range in all GDB files.
* gdb/doc: Remove duplicate description of lookup_global_symbolAndrew Burgess2019-12-142-14/+5
| | | | | | | | | | | | | | | | | | | In this commit: commit 086baaf1346f07acfb6708e8c6cb79274241488b Date: Tue Oct 15 16:18:26 2019 +0100 gdb/python: Introduce gdb.lookup_static_symbols A duplicate description of gdb.lookup_global_symbol was accidentally added. This commit corrects this mistake and removes the duplicate. gdb/doc/ChangeLog: * python.texi (Symbols In Python): Remove duplicate description of gdb.lookup_global_symbol. Change-Id: I4457b42cf05bde39e5c0ff39f168af919cad1255
* Fix typo, get_Frame_id -> get_frame_idgdb-9-branchpointSimon Marchi2019-12-112-1/+5
| | | | | | gdb/doc/ChangeLog: * gdb.texinfo (Writing JIT Debug Info Readers): Fix typo.
* Implement 'print -raw-values' and 'set print raw-values on|off'Philippe Waroquiers2019-12-112-10/+52
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The option framework documentation was speaking about a 'print -raw' option, but this option does not exist. This patch implements -raw-values option that tells to ignore the active pretty printers when printing a value. As we already have -raw-frame-arguments, I thought -raw-values was more clear, in particular to differentiate set print raw-values and set print raw-frame-arguments. gdb/doc/ChangeLog 2019-12-11 Philippe Waroquiers <philippe.waroquiers@skynet.be> * gdb.texinfo (Command Options): Use -p and -pretty in the example, as -r is ambiguous. Update the print - TAB TAB completion result. (Data): Document new option -raw-values. Use -p and -pretty in the example, as -r is ambiguous. (Print Settings): Document set print raw values. (Pretty-Printer Commands): Document interaction between enabled pretty printers and -raw-values/-raw-frame-arguments. gdb/ChangeLog 2019-12-11 Philippe Waroquiers <philippe.waroquiers@skynet.be> * NEWS: Document -raw-values option and the related setting commands. * printcmd.c (print_command_parse_format): Do not set opts->raw off, only set it on when /r is given. * valprint.c (value_print_option_defs): New element raw-values. * Makefile.in: Add the new file. gdb/testsuite/ChangeLog 2019-12-11 Philippe Waroquiers <philippe.waroquiers@skynet.be> * gdb.base/options.exp: Add -raw-values in the print completion list. * gdb.python/py-prettyprint.exp: Add tests for -raw-values.
* Minor fix to gdb.prompt documentationTom Tromey2019-12-102-3/+7
| | | | | | | | | | | | | | | I noticed that an example in the gdb.prompt documentation used the wrong kind of quotes -- because it is code, it should use a plain ASCII quotation mark. I also slightly shortened the sample text here, so it would more clearly fit on a single line. gdb/doc/ChangeLog 2019-12-10 Tom Tromey <tom@tromey.com> * python.texi (gdb.prompt): Use correct quotes in example. Shorten sample text. Change-Id: I4153928c0d88001244ad410f3943c952a6ebfeb1
* gdb/mi: Add -max-results parameter to some -symbol-info-* commandsAndrew Burgess2019-12-042-0/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Adds a new parameter -max-results to -symbol-info-functions, -symbol-info-variables, -symbol-info-types, and -symbol-info-modules. This parameter limits the number of results returned. This change still leaves -symbol-info-module-functions and -symbol-info-module-variables always returning all results, fixing these commands is slightly harder. There's currently no mechanism for the user of these commands to know if the result list has been truncated if you get back the maximum number of results, so if there are exactly 10 functions and you call '-symbol-info-functions --max-results 10' the reply would appear no different than if you had 20 functions and called with a max of 10. Right now, if you get back the maximum then you should assume that there might be more results available. One other thing to note is that the global_symbol_searcher::search by default returns SIZE_MAX results, there's no longer a mechanism to return an unlimited number of results, though hopefully this will not be a huge issue. gdb/ChangeLog: * mi/mi-symbol-cmds.c (mi_symbol_info): Take extra parameter, and add it into the search spec. (parse_max_results_option): New function. (mi_info_functions_or_variables): Parse -max-results flag and pass it to mi_symbol_info. (mi_cmd_symbol_info_modules): Likewise. (mi_cmd_symbol_info_types): Likewise. * symtab.c (global_symbol_searcher::add_matching_symbols): Change return type to bool, change result container into a set, and don't add new results if we have enough already. (global_symbol_searcher::add_matching_msymbols): Change return type to bool, and don't add new results if we have enough already. (sort_search_symbols_remove_dups): Delete. (global_symbol_searcher::search): Early exit from search loop when we have enough results. Use a std::set to collect the results from calling add_matching_symbols. * symtab.h (global_symbol_searcher) <set_max_seach_results>: New member function. (global_symbol_searcher) <m_max_search_results>: New member variable. (global_symbol_searcher) <add_matching_symbols>: Update header comment and change return type to bool. (global_symbol_searcher) <add_matching_msymbols>: Update header comment and change return type to bool. gdb/doc/ChangeLog: * doc/gdb.texinfo (GDB/MI Symbol Query): Add documentation of -max-results to some -symbol-info-* commands. gdb/testsuite/ChangeLog: * gdb.mi/mi-sym-info.exp: Add tests for -max-results parameter. Change-Id: I90a28feb55b388fb46461a096c5db08b6b0bd427
* gdb/mi: Add -symbol-info-module-{variables,functions}Andrew Burgess2019-12-042-0/+147
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Two new MI command -symbol-info-module-variables and -symbol-info-module-functions, which are the equivalent of the CLI command 'info module variables' and 'info module functions'. These return information about functions and variables within Fortran modules. gdb/ChangeLog: * mi/mi-cmds.c (mi_cmds): Add -symbol-info-module-functions and -symbol-info-module-variables entries. * mi/mi-cmds.h (mi_cmd_symbol_info_module_functions): Declare. (mi_cmd_symbol_info_module_variables): Declare. * mi/mi-symbol-cmds.c (module_symbol_search_iterator): New typedef. (output_module_symbols_in_single_module_and_file): New function. (output_module_symbols_in_single_module): New function. (mi_info_module_functions_or_variables): New function. (mi_cmd_symbol_info_module_functions): New function. (mi_cmd_symbol_info_module_variables): New function. * NEWS: Mention new MI command. gdb/doc/ChangeLog: * doc/gdb.texinfo (GDB/MI Symbol Query): Document new MI command -symbol-info-module-functions and -symbol-info-module-variables. gdb/testsuite/ChangeLog: * gdb.mi/mi-fortran-modules.exp: Add additional tests for -symbol-info-module-functions and -symbol-info-module-variables. Change-Id: Ic96f12dd14bd7e34774c3cde008fec30a4055bfe
* Add TUI border colorsTom Tromey2019-12-012-0/+19
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds the ability to change the color of the TUI borders, both ordinary and active. Unlike other styling options, this doesn't allow setting the intensity, because that is already done by the TUI in a different way. gdb/ChangeLog 2019-12-01 Tom Tromey <tom@tromey.com> * NEWS: Document new settings. * tui/tui-wingeneral.c (box_win): Apply appropriate border style. * tui/tui-win.c (_initialize_tui_win): Add border style observers. * tui/tui-io.h (tui_apply_style): Declare. * tui/tui-io.c (tui_apply_style): Rename from apply_style. No longer static. (apply_ansi_escape, tui_set_reverse_mode): Update. * cli/cli-style.h (class cli_style_option) <add_setshow_commands>: Add "skip_intensity" parameter. <changed>: New member. <do_set_value>: Declare. (tui_border_style, tui_active_border_style): Declare. * cli/cli-style.c (tui_border_style, tui_active_border_style): New globals. (cli_style_option): Initialize "changed". (cli_style_option::do_set_value): New function. (cli_style_option::add_setshow_commands): Add "skip_intensity" parameter. Update. (STYLE_ADD_SETSHOW_COMMANDS): Add "SKIP" parameter. (_initialize_cli_style): Update. Create TUI border style commands. gdb/doc/ChangeLog 2019-12-01 Tom Tromey <tom@tromey.com> * gdb.texinfo (TUI Configuration): Mention TUI border styles. (Output Styling): Document new settings. Change-Id: Id13e2af0af2a0bde61282752f2c379db3220c9fc
* Allow using less horizontal space in TUI source windowTom Tromey2019-12-012-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The source window currently uses a field width of 6 for line numbers, and it further aligns to the next tab stop. This seemed a bit wasteful of horizontal space to me, so I changed that in an earlier patch. However, that change wasn't universally popular. This patch instead adds the option to use less horizontal space in the TUI source window. gdb/ChangeLog 2019-12-01 Tom Tromey <tom@tromey.com> * tui/tui-winsource.h (tui_copy_source_line): Add "ndigits" parameter. * tui/tui-winsource.c (tui_copy_source_line): Add "ndigits" parameter. * tui/tui-win.h (compact_source): Declare. * tui/tui-win.c (compact_source): New global. (tui_set_compact_source, tui_show_compact_source): New functions. (_initialize_tui_win): Add "compact-source" setting. * tui/tui-source.c (tui_source_window::set_contents): Handle compact_source setting. * tui/tui-disasm.c (tui_disasm_window::set_contents): Update. * NEWS: Document new setting. gdb/doc/ChangeLog 2019-12-01 Tom Tromey <tom@tromey.com> * gdb.texinfo (TUI Configuration): Document new setting. Change-Id: I46ce9a68b12c9c79332d510f9c14b3c84b7efadd
* Document define-prefix command and the use of . in command names.Philippe Waroquiers2019-11-302-2/+48
| | | | | | | | | | | | | gdb/ChangeLog 2019-11-30 Philippe Waroquiers <philippe.waroquiers@skynet.be> * NEWS: Mention define-prefix. Tell that command names can now contain a . character. gdb/doc/ChangeLog 2019-11-30 Philippe Waroquiers <philippe.waroquiers@skynet.be> * gdb.texinfo (Define): Indicate that user-defined prefix can be used in 'define' command. Document 'define-prefix' command.
* gdb/mi: Add -symbol-info-modules commandAndrew Burgess2019-11-272-0/+59
| | | | | | | | | | | | | | | | | | | | | | | | | Add '-symbol-info-modules', an MI version of the CLI 'info modules' command. gdb/ChangeLog: * mi/mi-cmds.c (mi_cmds): Add 'symbol-info-modules' entry. * mi/mi-cmds.h (mi_cmd_symbol_info_modules): Declare. * mi/mi-symbol-cmds.c (mi_cmd_symbol_info_modules): New function. * NEWS: Mention new MI command. gdb/testsuite/ChangeLog: * gdb.mi/mi-fortran-modules-2.f90: New file. * gdb.mi/mi-fortran-modules.exp: New file. * gdb.mi/mi-fortran-modules.f90: New file. gdb/doc/ChangeLog: * doc/gdb.texinfo (GDB/MI Symbol Query): Document new MI command -symbol-info-modules. Change-Id: Ibc618010d1d5f36ae8a8baba4fb9d9d724e62b0f
* gdb/mi: Add new commands -symbol-info-{functions,variables,types}Andrew Burgess2019-11-272-6/+268
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add new MI commands -symbol-info-functions, -symbol-info-variables, and -symbol-info-types which correspond to the CLI commands 'info functions', 'info variables', and 'info types' respectively. gdb/ChangeLog: * mi/mi-cmds.c (mi_cmds): Add '-symbol-info-functions', '-symbol-info-types', and '-symbol-info-variables'. * mi/mi-cmds.h (mi_cmd_symbol_info_functions): Declare. (mi_cmd_symbol_info_types): Declare. (mi_cmd_symbol_info_variables): Declare. * mi/mi-symbol-cmds.c: Add 'source.h' and 'mi-getopt.h' includes. (output_debug_symbol): New function. (output_nondebug_symbol): New function. (mi_symbol_info): New function. (mi_info_functions_or_variables): New function. (mi_cmd_symbol_info_functions): New function. (mi_cmd_symbol_info_types): New function. (mi_cmd_symbol_info_variables): New function. * NEWS: Mention new commands. gdb/testsuite/ChangeLog: * gdb.mi/mi-sym-info-1.c: New file. * gdb.mi/mi-sym-info-2.c: New file. * gdb.mi/mi-sym-info.exp: New file. gdb/doc/ChangeLog: * doc/gdb.texinfo (GDB/MI Symbol Query): Document new MI command -symbol-info-functions, -symbol-info-types, and -symbol-info-variables. Change-Id: Ic2fc6a6750bbce91cdde2344791014e5ef45642d
* Add maint set/show worker-threadsTom Tromey2019-11-262-0/+20
| | | | | | | | | | | | | | | | | | | | | | | | This adds maint commands to control the number of worker threads that gdb can use. 2019-11-26 Tom Tromey <tom@tromey.com> * NEWS: Add entry. * maint.c (_initialize_maint_cmds): Add "worker-threads" maint commands. Call update_thread_pool_size. (update_thread_pool_size, maintenance_set_worker_threads): New functions. (n_worker_threads): New global. gdb/doc/ChangeLog 2019-11-26 Tom Tromey <tom@tromey.com> * gdb.texinfo (Maintenance Commands): Document new maint commands. Change-Id: I4fb514faa05879d8afe62c77036a4469d57dca2a
* [Debugging output] Make remote packet truncation length adjustableLuis Machado2019-11-252-0/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | While debugging, i felt the need to adjust the truncation length of remote packets so i could see more or less data as needed. The default is currently set to 512 bytes. This patch makes this option adjustable through the new "set debug remote-packet-max-chars" command. It can be set to unlimited if we want to completely disable truncation. Update on v5: - Adjusted function and variable documentation, NEWS entry and GDB manual. gdb/ChangeLog: 2019-11-25 Luis Machado <luis.machado@linaro.org> * NEWS (New Commands): Mention "set debug remote-packet-max-chars". * remote.c (REMOTE_DEBUG_MAX_CHAR): Remove. (remote_packet_max_chars): New static global. (show_remote_packet_max_chars): New function. (remote_target::putpkt_binary): Adjust to use new remote_packet_max_chars option. (remote_target::getpkt_or_notif_sane_1): Likewise. (_initialize_remote): Register new remote-packet-max-chars option. gdb/doc/ChangeLog: 2019-11-25 Luis Machado <luis.machado@linaro.org> * gdb.texinfo (Debugging Output): Document set debug remote-packet-max-chars. Change-Id: I2e871b37bfcaa6376537c3fe3db8f016dd806a7c
* [gdb/doc] Fix typosTom de Vries2019-11-144-31/+37
| | | | | | | | | | | | | | Fix typos in gdb docs. gdb/doc/ChangeLog: 2019-11-14 Tom de Vries <tdevries@suse.de> * gdb.texinfo: Fix typos. * python.texi: Same. * stabs.texinfo: Same. Change-Id: I044d6788eeea48e4a9b73ee752e5aaf333e56a46
* Make TUI resizing tests more robustTom Tromey2019-11-122-0/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As Sergio pointed out, the TUI resizing tests are flaky. Debugging this showed three main problems. 1. expect's "stty" command processes its arguments one-by-one. So, rather than requesting a single resize, it sends two separate resize requests (one for rows and one for columns). This means gdb sees two SIGWINCH signals and resizes the terminal twice. I consider this a bug in expect, but I couldn't readily see how to report a bug; and anyway the fix wouldn't propagate very quickly. This patch works around this problem by explicitly doing two separate resizes (so it will be robust if expect ever does change); and then by waiting for each resize to complete before continuing. 2. gdb uses curses to drive the console rendering. Currently the test suite looks for terminal text insertion sequences to decide when a command has completed. However, it turns out that, sometimes, curses can output things in non-obvious ways. I didn't debug into curses but I guess this can happen due to output optimizations. No matter the reason, sometimes the current approach of only tracking text insertions is not enough to detect that gdb has finished rendering. This patch fixes this problem by arranging to detect the termination output after any curses command, not just insertion. 3. Detecting when a resize has completed is tricky. In fact, I could not find a way to reliably do this. This patch fixes this problem by adding a special maint "tui-resize-message" setting to gdb. When this is enabled, gdb will print a message after each SIGWINCH has been fully processed. The test suite enables this mode and then waits for the message in order to know when control can be returned to the calling test. This patch also adds a timeout, to avoid the situation where the terminal code fails to notice a change for some reason. This lets the test at least try to continue. gdb/ChangeLog 2019-11-12 Tom Tromey <tom@tromey.com> * tui/tui-win.c (resize_message): New global. (show_tui_resize_message): New function. (tui_async_resize_screen): Print message if requested. (_initialize_tui_win): Add tui-resize-message setting. * NEWS: Add entry for new commands. gdb/doc/ChangeLog 2019-11-12 Tom Tromey <tom@tromey.com> * gdb.texinfo (Maintenance Commands): Document new command. gdb/testsuite/ChangeLog 2019-11-12 Tom Tromey <tom@tromey.com> * lib/tuiterm.exp (_accept): Add wait_for parameter. Check output after any command. Expect prompt after WAIT_FOR is seen. (enter_tui): Enable resize messages. (command): Expect command in output. (get_line): Avoid error when cursor appears to be off-screen. (dump_screen): Include screen size in title. (_do_resize): New proc, from "resize". (resize): Rewrite. Do resize in two steps. * gdb.tui/empty.exp (layouts): Fix entries. (check_boxes): Remove xfail. (check_text): Dump screen on failure. Change-Id: I420e0259cb99b21adcd28f671b99161eefa7a51d
* Document and extend readline-bindable functionsTom Tromey2019-11-112-0/+19
| | | | | | | | | | | | | | | | | | | | | | | This adds readline-bindable function names to a few gdb functions that already had key bindings. This lets users change the bindings. This also removes the gdb-command function. Due to how this function is implemented, it doesn't make sense to allow binding it. Finally, this updates the documentation to reflect these changes. gdb/ChangeLog 2019-11-11 Tom Tromey <tom@tromey.com> * tui/tui.c (tui_initialize_readline): Add new bindable readline functions. gdb/doc/ChangeLog 2019-11-11 Tom Tromey <tom@tromey.com> * gdb.texinfo (TUI Keys): Document readline function names. Change-Id: I2233779b7aefe372f19bd03c8f325733c3385e72
* Document operate-and-get-nextTom Tromey2019-11-112-0/+11
| | | | | | | | | | | | | This adds some documentation for the operate-and-get-next readline function that gdb supplies. The text is largely taken from the Bash manual. gdb/doc/ChangeLog 2019-11-11 Tom Tromey <tom@tromey.com> * gdb.texinfo (Editing): Document operate-and-get-next. Change-Id: I9adb16d9ce84bfbda5fe8a2828f668ea878c080c
* Fix typo in vFile:pwrite documentationTom Tromey2019-11-112-1/+5
| | | | | | | | | | | | | | A user on irc noticed that the remote protocol documentation mentioned "vFile:write" -- but this is a typo, there is only "vFile:pwrite". This patch fixes the bug. Tested by rebuilding, committing as obvious. gdb/doc/ChangeLog 2019-11-11 Tom Tromey <tromey@adacore.com> * gdb.texinfo (Host I/O Packets): Fix typo in "vFile:pwrite". Change-Id: I2f668a691eed7883ba6bc092471739f44c82301b
* gdb/python: Introduce gdb.lookup_static_symbolsAndrew Burgess2019-11-102-0/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If gdb.lookup_static_symbol is going to return a single symbol then it makes sense (I think) for it to return a context sensitive choice of symbol, that is the global static symbol that would be visible to the program at that point. However, if the user of the python API wants to instead get a consistent set of global static symbols, no matter where they stop, then they have to instead consider all global static symbols with a given name - there could be many. That is what this new API function offers, it returns a list (possibly empty) of all global static symbols matching a given name (and optionally a given symbol domain). gdb/ChangeLog: * python/py-symbol.c (gdbpy_lookup_static_symbols): New function. * python/python-internal.h (gdbpy_lookup_static_symbols): Declare new function. * python/python.c (python_GdbMethods): Add gdb.lookup_static_symbols method. * NEWS: Mention gdb.lookup_static_symbols. gdb/testsuite/ChangeLog: * gdb.python/py-symbol.exp: Add test for gdb.lookup_static_symbols. gdb/doc/ChangeLog: * python.texi (Symbols In Python): Add documentation for gdb.lookup_static_symbols. Change-Id: I1153b0ae5bcbc43b3dcf139043c7a48bf791e1a3
* gdb/python: smarter symbol lookup for gdb.lookup_static_symbolAndrew Burgess2019-11-102-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When using gdb.lookup_static_symbol I think that GDB should find static symbols (global symbol with static linkage) from the current object file ahead of static symbols from other object files. This means that if we have two source files f1.c and f2.c, and both files contains 'static int foo;', then when we are stopped in f1.c a call to 'gdb.lookup_static_symbol ("foo")' will find f1.c::foo, and if we are stopped in f2.c we would find 'f2.c::foo'. Given that gdb.lookup_static_symbol always returns a single symbol, but there can be multiple static symbols with the same name GDB is always making a choice about which symbols to return. I think that it makes sense for the choice GDB makes in this case to match what a user would get on the command line if they asked to 'print foo'. gdb/testsuite/ChangeLog: * gdb.python/py-symbol.c: Declare and call function from new py-symbol-2.c file. * gdb.python/py-symbol.exp: Compile both source files, and add new tests for gdb.lookup_static_symbol. * gdb.python/py-symbol-2.c: New file. gdb/doc/ChangeLog: * python.texi (Symbols In Python): Extend documentation for gdb.lookup_static_symbol. gdb/ChangeLog: * python/py-symbol.c (gdbpy_lookup_static_symbol): Lookup in static block of current object file first. Also fix typo in header comment. Change-Id: Ie55dbeb8806f35577b46015deecde27a0ca2ab64
* gdb: Add new commands to list module variables and functionsAndrew Burgess2019-10-312-0/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch adds two new commands "info module functions" and "info module variables". These commands list all of the functions and variables grouped by module and then by file. For example: (gdb) info module functions All functions in all modules: Module "mod1": File /some/path/gdb/testsuite/gdb.fortran/info-types.f90: 35: void mod1::__copy_mod1_M1t1(Type m1t1, Type m1t1); 25: void mod1::sub_m1_a(integer(kind=4)); 31: integer(kind=4) mod1::sub_m1_b(void); Module "mod2": File /some/path/gdb/testsuite/gdb.fortran/info-types.f90: 41: void mod2::sub_m2_a(integer(kind=4), logical(kind=4)); 49: logical(kind=4) mod2::sub_m2_b(real(kind=4)); The new commands take set of flags that allow the output to be filtered, the user can filter by variable/function name, type, or containing module. As GDB doesn't currently track the relationship between a module and the variables or functions within it in the symbol table, so I filter based on the module prefix in order to find the functions or variables in each module. What this makes clear is that a user could get this same information using "info variables" and simply provide the prefix themselves, for example: (gdb) info module functions -m mod1 _a All functions matching regular expression "_a", in all modules matching regular expression "mod1": Module "mod1": File /some/path/gdb/testsuite/gdb.fortran/info-types.f90: 25: void mod1::sub_m1_a(integer(kind=4)); Is similar to: (gdb) info functions mod1::.*_a.* All functions matching regular expression "mod1::.*_a": File /some/path/gdb/testsuite/gdb.fortran/info-types.f90: 25: void mod1::sub_m1_a(integer(kind=4)); The benefits I see for a separate command are that the user doesn't have to think (or know) about the module prefix format, nor worry about building a proper regexp. The user can also easily scan across modules without having to build complex regexps. The new function search_module_symbols is extern in this patch despite only being used within symtab.c, this is because a later patch in this series will also be using this function from outside symtab.c. This patch is a new implementation of an idea originally worked on by Mark O'Connor, Chris January, David Lecomber, and Xavier Oro from ARM. gdb/ChangeLog: * symtab.c (info_module_cmdlist): New variable. (info_module_command): New function. (search_module_symbols): New function. (info_module_subcommand): New function. (struct info_modules_var_func_options): New struct. (info_modules_var_func_options_defs): New variable. (make_info_modules_var_func_options_def_group): New function. (info_module_functions_command): New function. (info_module_variables_command): New function. (info_module_var_func_command_completer): New function. (_initialize_symtab): Register new 'info module functions' and 'info module variables' commands. * symtab.h (typedef symbol_search_in_module): New typedef. (search_module_symbols): Declare new function. * NEWS: Mention new commands. gdb/doc/ChangeLog: * gdb.texinfo (Symbols): Document new 'info module variables' and 'info module functions' commands. gdb/testsuite/ChangeLog: * gdb.fortran/info-modules.exp: Update expected results, and add additional tests for 'info module functinos', and 'info module variables'. * gdb.fortran/info-types.exp: Update expected results. * gdb.fortran/info-types.f90: Extend testcase with additional module variables and functions. Change-Id: I8c2960640e2e101b77eff54027d687e21ec22e2b
* gdb/fortran: Add new 'info modules' commandAndrew Burgess2019-10-312-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add a new command 'info modules' that lists all of the modules GDB knows about from the debug information. A module is a debugging entity in the DWARF defined with DW_TAG_module, currently Fortran is known to use this tag for its modules. I'm not aware of any other language that currently makes use of DW_TAG_module. The output style is similar to the 'info type' output: (gdb) info modules All defined modules: File info-types.f90: 16: mod1 24: mod2 (gdb) Where the user is told the file the module is defined in and, on the left hand side, the line number at which the module is defined along with the name of the module. This patch is a new implementation of an idea originally worked on by Mark O'Connor, Chris January, David Lecomber, and Xavier Oro from ARM. gdb/ChangeLog: * dwarf2read.c (dw2_symtab_iter_next): Handle MODULE_DOMAIN. (dw2_expand_marked_cus): Handle MODULES_DOMAIN. (dw2_debug_names_iterator::next): Handle MODULE_DOMAIN and MODULES_DOMAIN. (scan_partial_symbols): Only create partial module symbols for non declarations. * psymtab.c (recursively_search_psymtabs): Handle MODULE_DOMAIN and MODULES_DOMAIN. * symtab.c (search_domain_name): Likewise. (search_symbols): Likewise. (print_symbol_info): Likewise. (symtab_symbol_info): Likewise. (info_modules_command): New function. (_initialize_symtab): Register 'info modules' command. * symtab.h (enum search_domain): Add MODULES_DOMAIN. * NEWS: Mention new 'info modules' command. gdb/doc/ChangeLog: * gdb.texinfo (Symbols): Document new 'info modules' command. gdb/testsuite/ChangeLog: * gdb.fortran/info-modules.exp: New file. * gdb.fortran/info-types.exp: Build with new file. * gdb.fortran/info-types.f90: Include and use new module. * gdb.fortran/info-types-2.f90: New file. Change-Id: I2b781dd5a06bcad04620ccdc45f01a0f711adfad
* NEWS and documentation for $_gdb_setting and $_gdb_setting_str.Philippe Waroquiers2019-10-312-1/+96
| | | | | | | | | | | | | | | gdb/ChangeLog 2019-10-31 Philippe Waroquiers <philippe.waroquiers@skynet.be> * NEWS: Mention $_gdb_setting, $_gdb_setting_str, $_gdb_maint_setting and $_gdb_maint_setting_str. gdb/doc/ChangeLog 2019-10-31 Philippe Waroquiers <philippe.waroquiers@skynet.be> * gdb.texinfo (Convenience Funs): Document the new $_gdb_setting_str, $_gdb_maint_setting and $_gdb_maint_setting_str convenience functions.
* Load system gdbinit files from a directoryChristian Biesinger2019-10-293-8/+77
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Adds a configure option --with-system-gdbinit-dir to specify a directory in which to look for gdbinit files. All files in this directory are loaded on startup (subject to -n/-nx as usual) as long as the extension matches a known and enabled scripting language (.gdb/.py/.scm). This also changes get_ext_lang_of_file to support ".gdb" files, similar to get_ext_lang_defn's handling of EXT_LANG_GDB. gdb/ChangeLog: 2019-10-29 Christian Biesinger <cbiesinger@google.com> * NEWS: Mention new --with-system-gdbinit-dir option. * config.in: Regenerate. * configure: Regenerate. * configure.ac: Add new option --with-system-gdbinit-dir. * extension.c (get_ext_lang_of_file): Return extension_language_gdb for a ".gdb" suffix. * main.c (get_init_files): Change system_gdbinit argument to a vector and return the files in SYSTEM_GDBINIT_DIR in addition to SYSTEM_GDBINIT. (captured_main_1): Update. (print_gdb_help): Update. * top.c (print_gdb_configuration): Also print the value of SYSTEM_GDBINIT_DIR. gdb/doc/ChangeLog: 2019-10-29 Christian Biesinger <cbiesinger@google.com> * Makefile.in: Also set SYSTEM_GDBINIT_DIR for the info manual generation. * gdb.texinfo (many sections): Document new --with-system-gdbinit-dir option. Change-Id: If233859ecc21bc6421d589b37cd658a3c7d030f2
* Move readline to the readline/readline subdirectoryTom Tromey2019-10-232-1/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | readline turns out to be a bit of a stumbling block for the project to move gdbsupport (and then gdbserver) to the top-level. The issue is that readline headers are intended to be included with names like "readline/readline.h". To support this, gdb effectively adds a -I option pointing to the top-level source directory -- but, importantly, this option is not used when the system readline is used. For gdbsupport, a -I option like this would always be needed, but that in turn would break the system readline case. This was PR build/17077, fixed in commit a8a5dbcab8df0b3a9e04745d4fe8d64740acb323. Previously, we had discussed this on the gdb-patches list in terms of removing readline from the tree https://sourceware.org/ml/gdb-patches/2019-09/msg00317.html However, Eli expressed some concerns, and Joel did as well (off-list). Given those concerns, and the fact that a patch-free local readline is relatively new in gdb (it was locally patched for years), I changed my mind and decided to handle this situation by moving the readline sources down a level. That is, upstream readline is now in readline/readline, and the top-level readline directory just contains the minimal configury needed to build that. This fixes the problem because, when gdb unconditionally adds a -I$(top_srcdir), this will not find readline headers. A separate -I will be needed instead, which is exactly what's needed for --with-system-readline. gdb/ChangeLog 2019-10-23 Tom Tromey <tom@tromey.com> * Makefile.in (READLINE_DIR): Update. gdb/doc/ChangeLog 2019-10-23 Tom Tromey <tom@tromey.com> * Makefile.in (READLINE_DIR): Update. readline/ChangeLog 2019-10-23 Tom Tromey <tom@tromey.com> Move old contents to readline/ subdirectory. * aclocal.m4, configure, configure.ac, .gitignore, Makefile.am, Makefile.in, README: New files. Change-Id: Ice156a2ee09ea68722b48f64d97146d7428ea9e4
* Add a note for how to get the list of threadsChristian Biesinger2019-10-232-0/+8
| | | | | | | | | | | | | | It's not immediately obvious how to get the list of threads, so add a note about that in the "Threads in Python" section. gdb/doc/ChangeLog: 2019-10-23 Christian Biesinger <cbiesinger@google.com> * python.texi (Threads In Python): Add a note for how to get the list of threads. Change-Id: I0fef8a7aff161fc347c09052319048c907a6e8c3
* [gdb/doc] Fix some typosTom de Vries2019-10-074-3/+9
| | | | | | | | | | | | | Fix typos 'prevsiouly -> previously' and 'corresonding -> corresponding' in the docs. gdb/doc/ChangeLog: 2019-10-07 Tom de Vries <tdevries@suse.de> * gdb.texinfo: Fix typo. * guile.texi: Same. * python.texi: Same.
* gdb/fortran: Nested subroutine supportAndrew Burgess2019-10-032-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch is a rebase and update of the following three patches: https://sourceware.org/ml/gdb-patches/2018-11/msg00298.html https://sourceware.org/ml/gdb-patches/2018-11/msg00302.html https://sourceware.org/ml/gdb-patches/2018-11/msg00301.html I have merged these together into a single commit as the second patch, adding scope support to nested subroutines, means that some of the changes in the first patch are now no longer useful and would have to be backed out. The third patch is tightly coupled to the changes in the second of these patches and I think deserves to live together with it. There is an extra change in cp-namespace.c that is new, this resolves an issue with symbol lookup when placing breakpoints from within nested subroutines. There is also an extra test added to this commit 'nested-funcs-2.exp' that was written by Richard Bunt from ARM, this offers some additional testing of breakpoints on nested functions. After this commit it is possible to place breakpoints on nested Fortran subroutines and functions by using a fully scoped name, for example, given this simple Fortran program: program greeting call message contains subroutine message print *, "Hello World" end subroutine message end program greeting It is possible to place a breakpoint in 'message' with: (gdb) break greeting::message Breakpoint 1 at 0x4006c9: file basic.f90, line 5. What doesn't work with this commit is placing a breakpoint like this: (gdb) break message Function "message" not defined. Making this work will come in a later commit. gdb/ChangeLog: * cp-namespace.c (cp_search_static_and_baseclasses): Only search for nested static variables when searchin VAR_DOMAIN. * dwarf2read.c (add_partial_symbol): Add nested subroutines to the global scope, update comment. (add_partial_subprogram): Call add_partial_subprogram recursively for nested subroutines when processinng Fortran. (load_partial_dies): Process the child entities of a subprogram when processing Fortran. (partial_die_parent_scope): Handle building scope for Fortran nested functions. (process_die): Record that nested functions have a scope. (new_symbol): Always record Fortran subprograms on the global symbol list. (determine_prefix): How to build the prefix for Fortran subprograms. gdb/testsuite/ChangeLog: * gdb.fortran/nested-funcs.exp: Tests for placing breakpoints on nested functions. * gdb.fortran/nested-funcs.f90: Update expected results. * gdb.fortran/nested-funcs-2.exp: New file. * gdb.fortran/nested-funcs-2.f90: New file. gdb/doc/ChangeLog: * doc/gdb.texinfo (Fortran Operators): Describe scope operator.
* Add $_ada_exception convenience variableTom Tromey2019-10-022-2/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This adds the $_ada_exception convenience variable. It is set by the Ada exception catchpoints, and holds the address of the exception currently being thrown. This is useful because it allows more fine-grained filtering of exceptions than is possible using the existing "catch" syntax. This also simplifies Ada catchpoints somewhat; because the catchpoint must now carry the "kind", it's possible to remove many helper functions. gdb/ChangeLog 2019-10-02 Tom Tromey <tromey@adacore.com> * NEWS: Add $_ada_exception entry. * ada-lang.c (struct ada_catchpoint): Add constructor. <m_kind>: New member. (allocate_location_exception, re_set_exception): Remove "ex" parameter. (should_stop_exception): Compute $_ada_exception. (check_status_exception, print_it_exception) (print_one_exception, print_mention_exception): Remove "ex" parameter. (allocate_location_catch_exception, re_set_catch_exception) (check_status_exception, print_it_catch_exception) (print_one_catch_exception, print_mention_catch_exception) (print_recreate_catch_exception) (allocate_location_catch_exception_unhandled) (re_set_catch_exception_unhandled) (check_status_exception, print_it_catch_exception_unhandled) (print_one_catch_exception_unhandled) (print_mention_catch_exception_unhandled) (print_recreate_catch_exception_unhandled) (allocate_location_catch_assert, re_set_catch_assert) (check_status_assert, print_it_catch_assert) (print_one_catch_assert, print_mention_catch_assert) (print_recreate_catch_assert) (allocate_location_catch_handlers, re_set_catch_handlers) (check_status_handlers, print_it_catch_handlers) (print_one_catch_handlers, print_mention_catch_handlers) (print_recreate_catch_handlers): Remove. (create_ada_exception_catchpoint): Update. (initialize_ada_catchpoint_ops): Update. gdb/doc/ChangeLog 2019-10-02 Tom Tromey <tromey@adacore.com> * gdb.texinfo (Set Catchpoints, Convenience Vars): Document $_ada_exception. gdb/testsuite/ChangeLog 2019-10-02 Tom Tromey <tromey@adacore.com> * gdb.ada/catch_ex_std.exp: Add $_ada_exception test.
* Revert "Improve ptrace-error detection on Linux targets"Sergio Durigan Junior2019-09-262-148/+0
| | | | | | | This reverts commit 381beca6146ac68b57edf47d28cdb335fbd11635. The patch hasn't been fully reviewed yet, and Pedro would like to see more fixes.
* Improve ptrace-error detection on Linux targetsSergio Durigan Junior2019-09-262-0/+148
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In Fedora GDB, we carry the following patch: https://src.fedoraproject.org/rpms/gdb/blob/8ac06474ff1e2aa4920d14e0666b083eeaca8952/f/gdb-attach-fail-reasons-5of5.patch Its purpose is to try to detect a specific scenario where SELinux's 'deny_ptrace' option is enabled, which prevents GDB from ptrace'ing in order to debug the inferior (PTRACE_ATTACH and PTRACE_TRACEME will fail with EACCES in this case). I like the idea of improving error detection and providing more information to the user (a simple "Permission denied" can be really frustrating), but I don't fully agree with the way the patch was implemented: it makes GDB link against libselinux only for the sake of consulting the 'deny_ptrace' setting, and then prints a warning if ptrace failed and this setting is on. My first thought (and attempt) was to make GDB print a generic warning when a ptrace error happened; this message would just point the user to our documentation, where she could find more information about possible causes for the error (and try to diagnose/fix the problem). This proved to be too simple, and I was convinced that it is actually a good idea to go the extra kilometre and try to pinpoint the specific problem (or problems) preventing ptrace from working, as well as provide useful suggestions on how the user can fix things. Here is the patch I came up with. It implements a new function, 'linux_ptrace_restricted_fail_reason', which does a few things to check what's wrong with ptrace: - It dlopen's "libselinux.so.1" and checks if the "deny_ptrace" option is enabled. - It reads the contents of "/proc/sys/kernel/yama/ptrace_scope" and checks if it's different than 0. For each of these checks, if it succeeds, the user will see a message informing about the restriction in place, and how it can be disabled. For example, if "deny_ptrace" is enabled, the user will see: # gdb /usr/bin/true ... Starting program: /usr/bin/true warning: Could not trace the inferior process. warning: ptrace: Permission denied The SELinux 'deny_ptrace' option is enabled and preventing GDB from using 'ptrace'. You can disable it by executing (as root): setsebool deny_ptrace off If you are debugging the inferior remotely, the ptrace restriction(s) need to be disabled in the target system (e.g., where GDBserver is running). During startup program exited with code 127. (gdb) In case "/proc/sys/kernel/yama/ptrace_scope" is > 0: # gdb /usr/bin/true ... Starting program: /usr/bin/true warning: Could not trace the inferior process. warning: ptrace: Operation not permitted The Linux kernel's Yama ptrace scope is in effect, which can prevent GDB from using 'ptrace'. You can disable it by executing (as root): echo 0 > /proc/sys/kernel/yama/ptrace_scope If you are debugging the inferior remotely, the ptrace restriction(s) need to be disabled in the target system (e.g., where GDBserver is running). During startup program exited with code 127. (gdb) If both restrictions are enabled, both messages will show up. This works for gdbserver as well, and actually fixes a latent bug I found: when ptrace is restricted, gdbserver would hang due to an unchecked ptrace call: # gdbserver :9988 /usr/bin/true gdbserver: linux_ptrace_test_ret_to_nx: Cannot PTRACE_TRACEME: Operation not permitted gdbserver: linux_ptrace_test_ret_to_nx: status 256 is not WIFSTOPPED! gdbserver: linux_ptrace_test_ret_to_nx: failed to kill child pid 2668100 No such process [ Here you would have to issue a C-c ] Now, you will see: # gdbserver :9988 /usr/bin/true gdbserver: linux_ptrace_test_ret_to_nx: Cannot PTRACE_TRACEME: Permission denied gdbserver: linux_ptrace_test_ret_to_nx: status 256 is not WIFSTOPPED! gdbserver: linux_ptrace_test_ret_to_nx: failed to kill child pid 2766868 No such process gdbserver: Could not trace the inferior process. gdbserver: ptrace: Permission denied The SELinux 'deny_ptrace' option is enabled and preventing GDB from using 'ptrace'. You can disable it by executing (as root): setsebool deny_ptrace off If you are debugging the inferior remotely, the ptrace restriction(s) need to be disabled in the target system (e.g., where GDBserver is running). # (I decided to keep all the other messages, even though I find them a bit distracting). If GDB can't determine the cause for the failure, it will still print the generic error message which tells the user to check our documentation: There might be restrictions preventing ptrace from working. Please see the appendix "Linux kernel ptrace restrictions" in the GDB documentation for more details. If you are debugging the inferior remotely, the ptrace restriction(s) need to be disabled in the target system (e.g., where GDBserver is running). This means that the patch expands our documentation and creates a new appendix section named "Linux kernel ptrace restrictions", with sub-sections for each possible restriction that might be in place. Notice how, on every message, we instruct the user to "do the right thing" if gdbserver is being used. This is because if the user started gdbserver *before* any ptrace restriction was in place, and then, for some reason, one or more restrictions get enabled, then the error message will be displayed both on gdbserver *and* on the connected GDB. Since the user will be piloting GDB, it's important to explicitly say that the ptrace restrictions are enabled in the target, where gdbserver is running. The current list of possible restrictions is: - SELinux's 'deny_ptrace' option (detected). - YAMA's /proc/sys/kernel/yama/ptrace_scope setting (detected). - seccomp on Docker containers (I couldn't find how to detect). It's important to mention that all of this is Linux-specific; as far as I know, SELinux, YAMA and seccomp are Linux-only features. I tested this patch locally, on my Fedora 30 machine (actually, a Fedora Rawhide VM), but I'm not proposing a testcase for it because of the difficulty of writing one. WDYT? gdb/doc/ChangeLog: 2019-09-26 Sergio Durigan Junior <sergiodj@redhat.com> * gdb.texinfo (Linux kernel ptrace restrictions): New appendix section. gdb/ChangeLog: 2019-09-26 Sergio Durigan Junior <sergiodj@redhat.com> Jan Kratochvil <jan.kratochvil@redhat.com> Pedro Alves <palves@redhat.com> * gdbsupport/gdb-dlfcn.h (gdb_dlopen): Update comment and mention that the function throws an error. * inf-ptrace.c (default_inf_ptrace_me_fail_reason): New function. (inf_ptrace_me_fail_reason): New variable. (inf_ptrace_me): Update call to 'trace_start_error_with_name'. * inf-ptrace.h (inf_ptrace_me_fail_reason): New variable. * linux-nat.c (attach_proc_task_lwp_callback): Call 'linux_ptrace_attach_fail_reason_lwp'. (linux_nat_target::attach): Update call to 'linux_ptrace_attach_fail_reason'. (_initialize_linux_nat): Set 'inf_ptrace_me_fail_reason'. * nat/fork-inferior.c (trace_start_error_with_name): Add optional 'append' argument. * nat/fork-inferior.h (trace_start_error_with_name): Update prototype. * nat/linux-ptrace.c: Include "gdbsupport/gdb-dlfcn.h", "gdbsupport/filestuff.h" and "nat/fork-inferior.h". (selinux_ftype): New typedef. (linux_ptrace_restricted_fail_reason): New function. (linux_ptrace_attach_fail_reason_1): New function. (linux_ptrace_attach_fail_reason): Change first argument type from 'ptid_t' to 'pid_t'. Call 'linux_ptrace_attach_fail_reason_1' and 'linux_ptrace_restricted_fail_reason'. (linux_ptrace_attach_fail_reason_lwp): New function. (linux_ptrace_me_fail_reason): New function. (errno_pipe): New variable. (linux_fork_to_function): Initialize pipe before forking. (linux_child_function): Deal with errno-passing from child. Handle ptrace error. (linux_check_child_ptrace_errno): New function. (linux_check_child_ptrace_errno): Call 'linux_check_child_ptrace_errno'. * nat/linux-ptrace.h (linux_ptrace_attach_fail_reason): Update prototype. (linux_ptrace_attach_fail_reason_lwp): New prototype. (linux_ptrace_me_fail_reason): New prototype. * remote.c (extended_remote_target::attach): Handle error message passed by the server when attach fails. gdb/gdbserver/ChangeLog: 2019-09-26 Sergio Durigan Junior <sergiodj@redhat.com> Pedro Alves <palves@redhat.com> * linux-low.c (linux_ptrace_fun): Call 'linux_ptrace_me_fail_reason'. (attach_proc_task_lwp_callback): Call 'linux_ptrace_attach_fail_reason_lwp'. (linux_attach): Call 'linux_ptrace_attach_fail_reason'. * server.c (handle_v_attach): Use try..catch when calling 'attach_inferior', and send an error message to the client when needed. * thread-db.c (attach_thread): Call 'linux_ptrace_attach_fail_reason_lwp'.
* Remove Cell Broadband Engine debugging supportUlrich Weigand2019-09-202-113/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch implements removal of Cell/B.E. support, including - Support for the spu-*-* target - Support for native stand-alone SPU debugging - Support for integrated debugging of combined PPU/SPU applications - Remote debugging (gdbserver) support for all the above. The patch also removes the TARGET_OBJECT_SPU target object type, as this is available only on Cell/B.E. targets, including - Native Linux support - Core file support (including core file generation) - Remote target support, including removal of the qXfer:spu:read and qXfer:spu:write remote protocal packets and associated support in gdbserver. gdb/ChangeLog 2019-09-20 Ulrich Weigand <uweigand@de.ibm.com> * NEWS: Mention that Cell/B.E. debugging support was removed. * MAINTAINERS: Remove spu target. * config/djgpp/fnchange.lst: Remove entries for removed files. * Makefile.in (ALL_TARGET_OBS): Remove solib-spu.o, spu-multiarch.o, and spu-tdep.o. (HFILES_NO_SRCDIR): Remove solib-spu.h and spu-tdep.h. (ALLDEPFILES): Remove solib-spu.c, spu-linux-nat.c, spu-multiarch.c, and spu-tdep.c. * spu-linux-nat.c: Remove file. * spu-multiarch.c: Remove file. * spu-tdep.c: Remove file. * spu-tdep.h: Remove file. * solib-spu.c: Remove file. * solib-spu.h: Remove file. * configure.host (powerpc64*-*-linux*): Remove Cell/B.E. support. * configure.nat (spu-linux): Remove. * configure.tgt (powerpc*-*-linux*): Remove solib-spu.o and solib-multiarch.o from gdb_target_obs. (spu*-*-*): Remove. * arch/ppc-linux-common.h (struct ppc_linux_features): Remove "cell" feature flag. (ppc_linux_no_features): Update. * arch/ppc-linux-common.c (ppc_linux_match_description): Remove Cell/B.E. support. * arch/ppc-linux-tdesc.h (tdesc_powerpc_cell32l): Remove declaration. (tdesc_powerpc_cell64l): Likewise. * nat/ppc-linux.h (PPC_FEATURE_CELL): Remove. * ppc-linux-nat.c (ppc_linux_nat_target::read_description): Remove Cell/B.E. support. * ppc-linux-tdep.h: Do not include "solib-spu.h" or "spu-tdep.h". Do not include "features/rs6000/powerpc-cell32l.c" or "features/rs6000/powerpc-cell64l.c". (ppc_linux_spu_section): Remove. (ppc_linux_core_read_description): Remove Cell/B.E. support. (spe_context_objfile, spe_context_lm_addr, spe_context_offset, spe_context_cache_ptid, spe_context_cache_ptid): Remove. (ppc_linux_spe_context_lookup): Remove. (ppc_linux_spe_context_inferior_created): Remove. (ppc_linux_spe_context_solib_loaded): Remove. (ppc_linux_spe_context_solib_unloaded): Remove. (ppc_linux_spe_context): Remove. (struct ppu2spu_cache): Remove. (ppu2spu_prev_arch, ppu2spu_this_id, ppu2spu_prev_register): Remove. (struct ppu2spu_data): Remove. (ppu2spu_unwind_register, ppu2spu_sniffer, ppu2spu_dealloc_cache, ppu2spu_unwind): Remove. (ppc_linux_init_abi): Remove Cell/B.E. support. * rs6000-tdep.h (rs6000_gdbarch_init): Remove Cell/B.E. support. * features/Makefile (rs6000/powerpc-cell32l-expedite): Remove. (rs6000/powerpc-cell64l-expedite): Likewise (WHICH): Remove rs6000/powerpc-cell32l and rs6000/powerpc-cell64l. (XMLTOC): Remove rs6000/powerpc-cell32l.xml and rs6000/powerpc-cell64l.xml. * features/rs6000/powerpc-cell32l.xml: Remove. * features/rs6000/powerpc-cell64l.xml: Likewise. * features/rs6000/powerpc-cell32l.c: Remove generated file. * features/rs6000/powerpc-cell64l.c: Likewise. * regformats/rs6000/powerpc-cell32l.dat: Remove generated file. * regformats/rs6000/powerpc-cell64l.dat: Likewise. * regformats/reg-spu.dat: Remove. * target.h (enum target_object): Remove TARGET_OBJECT_SPU. * corelow.c (struct spuid_list): Remove. (add_to_spuid_list): Remove. (core_target::xfer_partial): Remove support for TARGET_OBJECT_SPU. * remote.c (PACKET_qXfer_spu_read, PACKET_qXfer_spu_write): Remove. (remote_protocol_features): Remove associated entries. (_initialize_remote): No longer initialize them. (remote_target::xfer_partial): Remove support for TARGET_OBJECT_SPU. * linux-nat.c (SPUFS_MAGIC): Remove. (linux_proc_xfer_spu): Remove. (spu_enumerate_spu_ids): Remove. (linux_nat_target::xfer_partial): Remove support for TARGET_OBJECT_SPU. * linux-tdep.c (-linux_spu_make_corefile_notes): Remove. (linux_make_corefile_notes): No longer call it. * regcache.c (cooked_read_test): Remove bfd_arch_spu special case. (cooked_write_test): Likewise. gdb/doc/ChangeLog 2019-09-20 Ulrich Weigand <uweigand@de.ibm.com> * doc/gdb.texinfo (Remote Configuration): Remove documentation for qXfer:spu:read and qXfer:spu:write. (General Query Packets): Likewise. (Cell Broadband Engine SPU architecture): Remove subsection. gdb/gdbserver/ChangeLog 2019-09-20 Ulrich Weigand <uweigand@de.ibm.com> * configure.srv (ipa_ppc_linux_regobj): Remove powerpc-cell32l-ipa.o and powerpc-cell64l-ipa.o. (powerpc*-*-linux*): Remove powerpc-cell32l.o and powerpc-cell64l.o from srv_regobj. Remove rs6000/powerpc-cell32l.xml and rs6000/powerpc-cell64l.xml from srv_xmlfiles. (spu*-*-*): Remove. * spu-low.c: Remove file. * linux-ppc-low.c (INSTR_SC, NR_spu_run): Remove. (parse_spufs_run): Remove. (ppc_get_pc): Remove Cell/B.E. support. (ppc_set_pc): Likewise. (ppc_breakpoint_at): Likewise. (ppc_arch_setup): Likewise. (ppc_get_ipa_tdesc_idx): Do not handle tdesc_powerpc_cell64l or tdesc_powerpc_cell32l. (initialize_low_arch): Do not call init_registers_powerpc_cell64l or init_registers_powerpc_cell32l. * linux-ppc-ipa.c (get_ipa_tdesc): Do not handle PPC_TDESC_CELL. (initialize_low_tracepoint): Do not call init_registers_powerpc_cell64l or init_registers_powerpc_cell32l. * linux-ppc-tdesc-init.h (PPC_TDESC_CELL): Mark as unused. (init_registers_powerpc_cell32l): Remove prototype. (init_registers_powerpc_cell64l): Likewise. * target.h (struct target_ops): Remove qxfer_spu member. * server.c (handle_qxfer_spu): Remove. (qxfer_packets): Remove entry for "spu". (handle_query): No longer support qXfer:spu:read or qXfer:spu:write. * linux-low.c (SPUFS_MAGIC): Remove. (spu_enumerate_spu_ids): Remove. (linux_qxfer_spu): Remove. (linux_target_ops): Remove qxfer_spu member. * lynx-low.c (lynx_target_ops): Remove qxfer_spu member. * nto-low.c (nto_target_ops): Remove qxfer_spu member. * win32-low.c (win32_target_ops): Remove qxfer_spu member. gdb/testsuite/ChangeLog 2019-09-20 Ulrich Weigand <uweigand@de.ibm.com> * gdb.arch/spu-info.exp: Remove file. * gdb.arch/spu-info.c: Remove file. * gdb.arch/spu-ls.exp: Remove file. * gdb.arch/spu-ls.c: Remove file. * gdb.asm/asm-source.exp: Remove support for spu*-*-*. * gdb.asm/spu.inc: Remove file. * gdb.base/dump.exp: Remove support for spu*-*-*. * gdb.base/stack-checking.exp: Likewise. * gdb.base/overlays.exp: Likewise. * gdb.base/ovlymgr.c: Likewise. * gdb.base/spu.ld: Remove file. * gdb.cp/bs15503.exp: Remove support for spu*-*-*. * gdb.cp/cpexprs.exp: Likewise. * gdb.cp/exception.exp: Likewise. * gdb.cp/gdb2495.exp: Likewise. * gdb.cp/mb-templates.exp: Likewise. * gdb.cp/pr9167.exp: Likewise. * gdb.cp/userdef.exp: Likewise. * gdb.xml/tdesc-regs.exp: Remove support for spu*-*-*. * gdb.cell: Remove directory. * lib/cell.exp: Remove file.
* Give a name to the TUI SingleKey keymapTom Tromey2019-09-182-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* gdb: Look for compilation directory relative to directory search pathMike Gulick2019-09-172-27/+114
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Output the Ada task name in more messages.Philippe Waroquiers2019-09-122-7/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Update "save gdb-index" documentationTom Tromey2019-09-102-2/+6
| | | | | | | | | | 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.
* gdb: Add new -n flag to some info commandsAndrew Burgess2019-08-272-4/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Convert the RX target to make use of target descriptions.Yoshinori Sato2019-08-252-0/+14
| | | | | | | | | | | | | | | | | | | | | | | | 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.
* Move [PAC] into a new MI field addr_flagsAlan Hayward2019-08-162-1/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Require readline 7 or newerTom Tromey2019-08-122-1/+7
| | | | | | | | | | | | | | | | | | 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.
* doc: fix PAC typoAlan Hayward2019-08-092-1/+5
| | | | | | gdb/doc/ChangeLog: * gdb.texinfo (AArch64 Pointer Authentication): Fix typo.
* AArch64 pauth: Indicate unmasked addresses in backtraceAlan Hayward2019-08-072-0/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Add block['var'] accessorChristian Biesinger2019-08-052-1/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* NEWS and documentation for info sources [-dirname | -basename] [--] [REGEXP].Philippe Waroquiers2019-08-032-0/+15
| | | | | | | | | | | | | 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.
* [PR/24474] Add gdb.lookup_static_symbol to the python APIChristian Biesinger2019-07-302-0/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* Add Objfile.lookup_{global,static}_symbol functionsChristian Biesinger2019-07-292-0/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.