Commit Graph

1094 Commits

Author SHA1 Message Date
Philippe Waroquiers e47e48f6a7 Document 'set|show exec-file-mismatch (ask|warn|off)'
Mention in NEWS the new option and the set/show commands.

Document in gdb.texinfo the new option and the set/show commands.

gdb/ChangeLog
2020-01-25  Philippe Waroquiers  <philippe.waroquiers@skynet.be>

	* NEWS: Mention the new option and the set/show commands.

gdb/doc/ChangeLog
2020-01-25  Philippe Waroquiers  <philippe.waroquiers@skynet.be>

	* gdb.texinfo (Attach): Document the new option and the
	set/show commands.
	(Connecting): Reference the exec-file-mismatch option.
2020-01-25 11:09:13 +01:00
Pedro Alves 65c574f6dd Multi-target: NEWS and user manual
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.
2020-01-10 20:06:15 +00:00
Eli Zaretskii 3f6028216b Mention the recent fix of $_exitsignal on MS-Windows in gdb/NEWS
gdb/ChangeLog
2020-01-06  Eli Zaretskii  <eliz@gnu.org>

	* NEWS: Mention the recent fix of $_exitsignal on MS-Windows.
2020-01-06 21:25:23 +02:00
Christian Biesinger 8fb7532331 Add a NEWS entry for multithreaded symbol loading
Now that we enabled it by default, this change adds a NEWS entry for it.

gdb/ChangeLog:

2019-12-26  Christian Biesinger  <cbiesinger@google.com>

	* NEWS: Mention that multithreaded symbol loading is now on by
	default.

Change-Id: Ic344596a3b1b6e612a0071a50df49588b833c15d
2019-12-26 23:22:20 +01:00
Joel Brobecker 4decd62b21 Update NEWS post GDB 9 branch creation.
gdb/ChangeLog:

	* NEWS: Create a new section for the next release branch.
	Rename the section of the current branch, now that it has
	been cut.
2019-12-11 21:44:47 +01:00
Philippe Waroquiers d8edc8b768 Implement 'print -raw-values' and 'set print raw-values on|off'
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.
2019-12-11 04:31:05 +01:00
Andrew Burgess 293b38d60f gdb/mi: Add -symbol-info-module-{variables,functions}
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
2019-12-04 10:24:59 +00:00
Tom Tromey a2a7af0c33 Add TUI border colors
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
2019-12-01 11:59:23 -07:00
Tom Tromey d1da6b0160 Allow using less horizontal space in TUI source window
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
2019-12-01 11:59:23 -07:00
Philippe Waroquiers bf4985257d Document define-prefix command and the use of . in command names.
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.
2019-11-30 09:38:37 +01:00
Christian Biesinger e49b22ff20 Add a NEWS entry for multithreaded symbol loading
Just to let people know that this is available and how to use it.

Also updates the description of the setting to say the default is 0.

gdb/ChangeLog:

2019-11-26  Christian Biesinger  <cbiesinger@google.com>

	* NEWS: Mention the new multithreaded symbol loading.

Change-Id: I263add6aae03b523f0870ad4d1e972eada4b382a
2019-11-27 15:40:28 -06:00
Andrew Burgess db5960b4d2 gdb/mi: Add -symbol-info-modules command
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
2019-11-27 12:02:02 +00:00
Andrew Burgess 7dc4206609 gdb/mi: Add new commands -symbol-info-{functions,variables,types}
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
2019-11-27 12:01:55 +00:00
Tom Tromey 22138db609 Add maint set/show worker-threads
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
2019-11-26 14:02:58 -07:00
Luis Machado 6cc8564b9a [Debugging output] Make remote packet truncation length adjustable
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
2019-11-25 12:27:44 -03:00
Tom Tromey 45e4216376 Make TUI resizing tests more robust
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
2019-11-12 12:29:14 -07:00
Andrew Burgess 086baaf134 gdb/python: Introduce gdb.lookup_static_symbols
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
2019-11-10 21:35:32 +00:00
Rainer Orth dae8b3eb23 Obsolete Solaris 10 support
Here's the patch corresponding to the Solaris 10 obsoletion announcement

	https://sourceware.org/ml/gdb/2019-10/msg00008.html

Right now it doesn't remove any code, but obviates the need to test on
that ancient platform.  Besides, some of the patches I have in my queue
would require different solutions for Solaris 10 and 11.

There are a few comment-only references that I've kept since they are
still correct as is, even when GDB doesn't support Solaris 10 any
longer.  The only code fragment I've left in is support for
/proc/<pid/path/a.out in procfs.c (procfs_target::pid_to_exec_file):
while current Solaris 11 updates provide /proc/<pid>/execname, that
wasn't present in Solaris 11.0 and still isn't in current Illumos and I
didn't want to make live harder for them.

Tested on i386-pc-solaris2.10 (obsolete configuration rejected) and
x86_64-pc-linux-gnu x sparc64-solaris2.10 (likewise)
resp. x86_64-pc-linux-gnu x sparcv9-solaris2.11 (still builds; I'm using
the sparcv9 form for 64-bit SPARC customary on Solaris in the
MAINTAINERS file now).

	* NEWS (Changes since GDB 8.3): Document Solaris 10 removal.
	* configure.host: Mark *-*-solaris2.10* obsolete.
	* configure.tgt: Mark Solaris < 11 obsolete.
	* MAINTAINERS (Target Instruction Set Architectures) <sparc>:
	Update target triplet.
2019-11-04 18:13:14 +01:00
Andrew Burgess 165f8965d7 gdb: Add new commands to list module variables and functions
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
2019-10-31 23:02:59 +00:00
Andrew Burgess 59c35742fb gdb/fortran: Add new 'info modules' command
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
2019-10-31 23:02:59 +00:00
Philippe Waroquiers aed61d02fb NEWS and documentation for $_gdb_setting and $_gdb_setting_str.
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.
2019-10-31 23:36:39 +01:00
Christian Biesinger ed2a222951 Load system gdbinit files from a directory
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
2019-10-29 13:43:04 -05:00
Andrew Burgess 179aed7fdc gdb/fortran: Allow for matching symbols with missing scope
This commit allows symbol matching within Fortran code without having
to specify all of the symbol's scope.  For example, given this Fortran
code:

    module aaa
    contains
      subroutine foo
        print *, "hello."
      end subroutine foo
    end module aaa

    subroutine foo
      print *, "hello."
    end subroutine foo

    program test
      call foo
    contains
      subroutine foo
        print *, "hello."
      end subroutine foo

      subroutine bar
        use aaa
        call foo
      end subroutine bar
    end program test

The user can now do this:

    (gdb) b foo
    Breakpoint 1 at 0x4006c2: foo. (3 locations)
    (gdb) info breakpoints
    Num     Type           Disp Enb Address            What
    1       breakpoint     keep y   <MULTIPLE>
    1.1                         y   0x00000000004006c2 in aaa::foo at nest.f90:4
    1.2                         y   0x0000000000400730 in foo at nest.f90:9
    1.3                         y   0x00000000004007c3 in test::foo at nest.f90:16

The user asks for a breakpoint on 'foo' and is given a breakpoint on
all three possible 'foo' locations.  The user is, of course, still
able to specify the scope in order to place a single breakpoint on
just one of the foo functions (or use 'break -qualified foo' to break
on just the global foo).

gdb/ChangeLog:

	* f-lang.c (f_language_defn): Use cp_get_symbol_name_matcher and
	cp_search_name_hash.
	* NEWS: Add entry about nested function support.

gdb/testsuite/ChangeLog:

	* gdb.fortran/nested-funcs-2.exp: Run tests with and without the
	nested function prefix.
2019-10-03 21:25:22 +01:00
Tom Tromey 37f6a7f456 Add $_ada_exception convenience variable
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.
2019-10-02 09:53:17 -06:00
Dimitar Dimitrov ddd44b7053 sim: Add PRU simulator port
A simulator port for the TI PRU I/O processor.

v1: https://sourceware.org/ml/gdb-patches/2016-12/msg00143.html
v2: https://sourceware.org/ml/gdb-patches/2017-02/msg00397.html
v3: https://sourceware.org/ml/gdb-patches/2017-02/msg00516.html
v4: https://sourceware.org/ml/gdb-patches/2018-06/msg00484.html
v5: https://sourceware.org/ml/gdb-patches/2019-08/msg00584.html
v6: https://sourceware.org/ml/gdb-patches/2019-09/msg00036.html

gdb/ChangeLog:

	* NEWS: Mention new simulator port for PRU.

sim/ChangeLog:

	* MAINTAINERS: Add myself as PRU maintainer.
	* configure: Regenerated.
	* configure.tgt: Add PRU.

sim/common/ChangeLog:

	* gennltvals.sh: Add PRU libgloss target.
	* nltvals.def: Regenerate from the latest libgloss sources.

sim/pru/ChangeLog:

	* Makefile.in: New file.
	* aclocal.m4: Regenerated.
	* config.in: Regenerated.
	* configure: Regenerated.
	* configure.ac: New file.
	* interp.c: New file.
	* pru.h: New file.
	* pru.isa: New file.
	* sim-main.h: New file.
2019-09-23 22:11:02 +01:00
Joel Brobecker 5a3a0d6304 gdb/NEWS: Move entries about MI v3 and multi-loc breakpoints after GDB 8.3
This is a followup on the following commit...

    commit b4be1b0648
    Date:   Wed Mar 13 15:13:03 2019 -0400
    Subject: Fix MI output for multi-location breakpoints

... which mistakenly added NEWS entries in the "in gdb-8.3" section,
rather than in the "since gdb-8.3" one.

gdb/ChangeLog:

	* NEWS: Move entries about default MI version now being
        version 3, and about the GDB/MI fix for multi-location
        breakpoints to the "since GDB 8.3" section.
2019-09-20 16:23:15 -07:00
Ulrich Weigand abf516c693 Remove Cell Broadband Engine debugging support
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.
2019-09-20 23:06:57 +02:00
Tom Tromey 78e8cb91cd Change TUI window commands to be case-sensitive
The TUI window-related commands like "focus" are case insensitive.
This is not the norm in gdb, and I don't see a good reason to have it
here.  This patch changes the TUI to be case sensitive, like the rest
of gdb.

gdb/ChangeLog
2019-09-20  Tom Tromey  <tom@tromey.com>

	* NEWS: Mention case-sensitivity of TUI commands.
	* tui/tui-win.c (tui_set_focus_command): Now case-sensitive.
	(tui_set_win_height_command, parse_scrolling_args): Likewise.
	* tui/tui-layout.c (tui_layout_command): Now case-sensitive.
2019-09-20 13:49:12 -06:00
Tom Tromey 11061048d1 Give a name to the TUI SingleKey keymap
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.
2019-09-18 15:03:29 -06:00
Christian Biesinger 6a062a93d7 Add a NEWS entry that gdb can be compiled with py3 on Windows.
This was fixed in commit 272044897e.

2019-09-14  Christian Biesinger  <cbiesinger@google.com>

	* NEWS: Mention that gdb can now be compiled with Python 3
	on Windows.
2019-09-14 22:36:47 -04:00
Philippe Waroquiers 4993045d18 Output the Ada task name in more messages.
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.
2019-09-12 21:57:10 +02:00
Andrew Burgess 4acfdd20c9 gdb: Add new -n flag to some info commands
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.
2019-08-27 16:21:42 +01:00
Yoshinori Sato e3ec872f80 Convert the RX target to make use of target descriptions.
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.
2019-08-25 17:00:08 +09:00
Alan Hayward aa7ca1bb44 Move [PAC] into a new MI field addr_flags
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.
2019-08-16 10:19:18 +01:00
Tom Tromey 86c6b807f5 Require readline 7 or newer
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.
2019-08-12 10:57:56 -06:00
Alan Hayward 3d31bc39e6 AArch64 pauth: Indicate unmasked addresses in backtrace
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.
2019-08-07 13:34:12 +01:00
Christian Biesinger 0b27c27d0d Add block['var'] accessor
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.
2019-08-05 13:06:18 -05:00
Philippe Waroquiers ae60f04e08 NEWS and documentation for info sources [-dirname | -basename] [--] [REGEXP].
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.
2019-08-03 21:27:51 +02:00
Alan Hayward c6bdbeb7c4 Require GNU make 3.82
Gdbserver has failed to build with GNU make 3.81 since commit 08f10e02be.

Update the NEWS file to state that versions earlier than 3.82 are not
supported.

3.82 was released in 2010, 3.81 was released 2006. A quick investigation
of the default GNU make version provided across various distros found the
earliest provided version to be 3.82:
*RHEL 7, Centos 6 - make 3.82
*Fedora 27 - make 4.2.1
*OpenSuse 42.2, SLES11 - make 4.2.1
*Ubuntu 16.04/18.04 - make 4.1
*Debian Jessie - make 4.0

Note that Glibc requires at least 4.0, whereas GCC still allows 3.81.

gdb/ChangeLog:

	* NEWS: Require GNU make 3.82.
2019-08-01 17:07:43 +01:00
Christian Biesinger 2906593ffe [PR/24474] Add gdb.lookup_static_symbol to the python API
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.
2019-07-30 11:04:37 -05:00
Christian Biesinger c620ed8866 Add Objfile.lookup_{global,static}_symbol functions
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.
2019-07-29 20:44:08 -05:00
Philippe Waroquiers bc4268a5d9 Document 'set print frame-info|frame-arguments presence'.
gdb/ChangeLog
2019-06-19  Philippe Waroquiers  <philippe.waroquiers@skynet.be>

	* NEWS: Mention 'set|show print frame-info'.  Mention new
	'presence' value for 'frame-arguments'.  Mention new '-frame-info'
	backtrace argument.  Mention that python frame filtering code
	is now consistent with what 'backtrace' command prints.

gdb/doc/ChangeLog
2019-07-29  Philippe Waroquiers  <philippe.waroquiers@skynet.be>

	* gdb.texinfo (Backtrace): Document the new '-frame-info'
	backtrace option.  Reference 'set print frame-info'.
	(Print Settings): Document 'set|show print frame-info'.
	Document new 'presence' value for 'set print frame-arguments.
2019-07-29 21:43:08 +02:00
Andrew Burgess a8eab7c6d5 gdb: Switch "info types" over to use the gdb::options framework
Adds a new -q flag to "info types" using the gdb::option framework.
This -q flag is similar to the -q flag already present for "info
variables" and "info functions".

gdb/ChangeLog:

	* NEWS: Mention adding -q option to "info types".
	* symtab.c (struct info_types_options): New struct.
	(info_types_options_defs): New variable.
	(make_info_types_options_def_group): New function.
	(info_types_command): Use gdb::option framework to parse options.
	(info_types_command_completer): New function.
	(_initialize_symtab): Extend the help text on "info types" and
	register command completer.

gdb/doc/ChangeLog:

	* gdb.texinfo (Symbols): Add information about -q flag to "info
	types".
2019-07-22 10:43:00 +01:00
Andrew Burgess 60cfcb20ce gdb: Add command completers for some info commands
Add command completion for info variables, functions, args, and
locals.  This completer only completes the command line options as
these commands all take a regexp which GDB can't really offer
completions for.

gdb/ChangeLog:

	* cli/cli-utils.c (info_print_command_completer): New function.
	* cli/cli-utils.h: Add 'completer.h' include, and forward
	declaration for 'struct cmd_list_element'.
	(info_print_command_completer): Declare.
	* stack.c (_initialize_stack): Add completer for 'info locals' and
	'info args'.
	* symtab.c (_initialize_symtab): Add completer for 'info
	variables' and 'info functions'.
	* NEWS: Mention completion for additional info commands.
2019-07-11 20:19:24 +01:00
Philippe Waroquiers 1f6f6e21fa Ensure GDB printf command can print convenience var strings without a target.
Without this patch, GDB printf command calls malloc on the target,
writes the convenience var content to the target,
re-reads the content from the target, and then locally printf the string.

This implies inferior calls, and does not work when there is no running
inferior, or when the inferior is a core dump.

With this patch, printf command can printf string convenience variables
without inferior function calls.
Ada string convenience variables can also be printed.

gdb/ChangeLog
2019-07-08  Philippe Waroquiers  <philippe.waroquiers@skynet.be>

	* NEWS: Mention that GDB printf and eval commands can now print
	C-style and Ada-style convenience var strings without
	calling the inferior.
	* printcmd.c (printf_c_string): Locally print GDB internal var
	instead of transiting via the inferior.
	(printf_wide_c_string): Likewise.

gdb/testsuite/ChangeLog
2019-07-08  Philippe Waroquiers  <philippe.waroquiers@skynet.be>

	* gdb.base/printcmds.exp: Test printing C string and
	C wide string convenience vars without transiting via the inferior.
	Also make test names unique.
2019-07-08 23:31:54 +02:00
Pedro Alves fdbc98707b Introduce the "with" command
( See original discussion and prototype here:
   https://sourceware.org/ml/gdb-patches/2019-05/msg00570.html )

 (gdb) help with
 Temporarily set SETTING to VALUE, run COMMAND, and restore SETTING.
 Usage: with SETTING [VALUE] [-- COMMAND]
 Usage: w SETTING [VALUE] [-- COMMAND]
 With no COMMAND, repeats the last executed command.
 SETTING is any setting you can change with the "set" subcommands.
 E.g.:
   with language pascal -- print obj
   with print elements unlimited -- print obj

As can be seen above, the "with" command is just like "set", but
instead of setting the setting permanently, it sets the setting, runs
a command and then restores the setting.

 (gdb) p g_s
 $1 = {a = 1, b = 2, c = 3}
 (gdb) with language ada -- print g_s
 $2 = (a => 1, b => 2, c => 3)
 Warning: the current language does not match this frame.
 (gdb) show language
 The current source language is "auto; currently c".
 (gdb) with print elements 100 -- with print object on -- print 1
 $3 = 1

You can shorten things a bit though, as long as unambiguous.  So this:

 (gdb) with print elements 100 -- with print object off -- print 1

is the same as:

 (gdb) w p el 100 -- w p o 0 -- p 1

Note that the patch adds a "w" alias for "with", as "w" is not
currently taken:

 (gdb) w
 Ambiguous command "w": watch, wh, whatis, where, while, while-stepping, winheight, ws.

Let me know if you'd prefer to reserve "w" for one of the other
commands above.  IMHO, this command will end up being used frequently
enough that it deserves the "w" shorthand.

A nice feature is that this is fully integrated with TAB-completion:

 (gdb) with p[TAB]
 pagination  print       prompt      python
 (gdb) with print [TAB]
 address                max-depth              static-members
 array                  max-symbolic-offset    symbol
 array-indexes          null-stop              symbol-filename
 asm-demangle           object                 symbol-loading
 demangle               pascal_static-members  thread-events
 elements               pretty                 type
 entry-values           raw                    union
 frame-arguments        repeats                vtbl
 inferior-events        sevenbit-strings
 (gdb) with print [TAB]

 (gdb) with print elements unlimited -- thread apply all -[TAB]
 -ascending  -c          -q          -s

 (gdb) with print elements unlimited -- print -[TAB]
 -address         -max-depth       -repeats         -vtbl
 -array           -null-stop       -static-members
 -array-indexes   -object          -symbol
 -elements        -pretty          -union

The main advantage of this new command compared to command options,
like the new "print -OPT", is that this command works with any
setting, and, it works nicely when you want to override a setting
while running a user-defined command, like:

 (gdb) with print pretty -- usercmd

The disadvantage is that it isn't as compact or easy to type.  I think
of command options and this command as complementary.  I think that
even with this new command, it makes sense to continue developing the
command options in the direction of exposing most-oft-used settings as
command options.

Inspired by Philippe's "/" command proposal, if no command is
specified, then the last command is re-invoked, under the overridden
setting:

 (gdb) p g_s
 $1 = {a = 1, b = 2, c = 3}
 (gdb) with language ada
 $2 = (a => 1, b => 2, c => 3)
 Warning: the current language does not match this frame.

Note: "with" requires "--" to separate the setting from the command.
It might be possible to do without that, but, I haven't tried it yet,
and I think that this can go in without it.  We can always downgrade
to making "--" optional if we manage to make it work.

On to the patch itself, the implementation of the command is simpler
than one might expect.  A few details:

- I factored out a bit from pipe_command into repeat_previous
  directly, because otherwise I'd need to copy&paste the same code and
  same error message in the with command.

- The parse_cli_var_uinteger / parse_cli_var_zuinteger_unlimited /
  do_set_command changes are necessary since we can now pass an empty
  string as argument.

- do_show_command was split in two, as a FIXME comment suggests, but
  for a different reason: we need to get a string version of a "set"
  command's value, and we already had code for that in
  do_show_command.  That code is now factored out to the new
  get_setshow_command_value_string function.

- There's a new "maint with" command added too:

   (gdb) help maint with
   Like "with", but works with "maintenance set" variables.
   Usage: maintenance with SETTING [VALUE] [-- COMMAND]
   With no COMMAND, repeats the last executed command.
   SETTING is any setting you can change with the "maintenance set"
   subcommands.

  "with" and "maint with" share 99% of the implementation.

  This might be useful on its own, but it's also useful for testing,
  since with this, we can use the "maint set/show test-settings"
  settings for exercising the "with" machinery with all the command
  type variants (all enum var_types).  This is done in the new
  gdb/base/with.exp testcase.

The documentation bits are originally based on Philippe's docs for the
"/" command, hence the attribution in the ChangeLog.

gdb/ChangeLog:
2019-07-03  Pedro Alves  <palves@redhat.com>

	* NEWS (New commands): Mention "with" and "maint with".
	* cli/cli-cmds.c (with_command_1, with_command_completer_1)
	(with_command, with_command_completer): New.
	(pipe_command): Adjust to new repeat_previous
	interface.
	(_initialize_cli_cmds): Install the "with" command and its "w"
	alias.
	* cli/cli-cmds.h (with_command_1, with_command_completer_1): New
	declarations.
	* cli/cli-setshow.c (parse_cli_var_uinteger)
	(parse_cli_var_zuinteger_unlimited, do_set_command): Handle empty
	argument strings for all var_types.
	(get_setshow_command_value_string): New, factored out from ...
	(do_show_command): ... this.
	* cli/cli-setshow.h: Include <string>.
	(get_setshow_command_value_string): Declare.
	* command.h (repeat_previous): Now returns const char *.  Adjust
	comment.
	* maint.c: Include "cli/cli-cmds.h".
	(maintenance_with_cmd, maintenance_with_cmd_completer): New.
	(_initialize_maint_cmds): Register the "maintenance with" command.
	* top.c (repeat_previous): Move bits from pipe_command here:
	Return the saved command line, if any; error out if there's no
	command to relaunch.

gdb/doc/ChangeLog:
2019-07-03  Pedro Alves  <palves@redhat.com>
	    Philippe Waroquiers  <philippe.waroquiers@skynet.be>

	* gdb.texinfo (Command Settings): New node documenting the general
	concept of settings, how to change them, and the new "with"
	command.
	(Maintenance Commands): Document "maint with".

gdb/testsuite/ChangeLog:
2019-07-03  Pedro Alves  <palves@redhat.com>

	* gdb.base/with.c: New file.
	* gdb.base/with.exp: New file.
2019-07-03 13:35:45 +01:00
Pedro Alves c6ac893109 "maint test-settings set/show" -> "maint set/show test-settings"
This commit renames "maint test-settings set/show" to "maint set/show
test-settings".

This helps the following patch, which introduce a "maint with" command
what works with all "maint set" settings.

gdb/ChangeLog:
2019-07-03  Pedro Alves  <palves@redhat.com>

	* NEWS (New commands): Mention "maint set/show test-settings"
	instead of "maint test-settings".
	* maint-test-settings.c (maintenance_test_settings_list): Delete.
	(maintenance_test_settings_set_list): Rename to ...
	(maintenance_set_test_settings_list): ... this.
	(maintenance_test_settings_show_list): Rename to  ...
	(maintenance_show_test_settings_list): ... this.
	(maintenance_test_settings_cmd): Delete.
	(maintenance_test_settings_set_cmd): ...
	(maintenance_set_test_settings_cmd): ... this.
	(maintenance_test_settings_show_cmd): ...
	(maintenance_show_test_settings_cmd): ... this.
	(maintenance_test_settings_show_value_cmd):
	(maintenance_show_test_settings_value_cmd): ... this.
	(_initialize_maint_test_settings): No longer install the "maint
	test-settings" prefix command.  Rename "maint test-settings set"
	to "maint set test-settings", and "maint test-settings show" to
	"maint show test-settings".  Adjust all subcommands.

gdb/doc/ChangeLog:
2019-07-03  Pedro Alves  <palves@redhat.com>

	* gdb.texinfo (Maintenance Commands): Document "maint set/show
	test-settings" instead of "maint test-settings set/show".

gdb/testsuite/ChangeLog:
2019-07-03  Pedro Alves  <palves@redhat.com>

	* gdb.base/settings.exp: Replace all references to "maint
	test-settings set" with references to "maint set test-settings",
	and all references to "maint test-settings show" with references
	to "maint show test-settings".
2019-07-03 13:35:03 +01:00
Pedro Alves 54d6600669 Make "info threads" use the gdb::option framework
This makes "info threads" use the gdb::option framework to process
options.  There's only one option today (-gid), and it isn't used much
frequently unless you're looking at matching MI output.  Still, this
was in the neighborhood of "thread apply" so I had converted it.

The main advantage is that TAB completion now shows you the available
options, and gives you a hint to what the command accepts as operand
argument, including showing a metasyntactic variable:

  (gdb) info threads [TAB]
  -gid  ID

  (gdb) help info threads
  Display currently known threads.
  Usage: info threads [OPTION]... [ID]...

  Options:
    -gid
      Show global thread IDs.

  If ID is given, it is a space-separated list of IDs of threads to display.
  Otherwise, all threads are displayed.
  (gdb)

gdb/ChangeLog:
2019-07-02  Pedro Alves  <palves@redhat.com>

	* NEWS (Completion improvements): Mention "info threads".
	* thread.c (struct info_threads_opts, info_threads_option_defs)
	(make_info_threads_options_def_group): New.
	(info_threads_command): Use gdb::option::process_options.
	(info_threads_command_completer): New.
	(_initialize_thread): Use gdb::option::build_help to build the
	help text for "info threads".

gdb/testsuite/ChangeLog:
2019-07-02  Pedro Alves  <palves@redhat.com>

	* gdb.base/options.exp (test-info-threads): New procedure.
	(top level): Call it.
2019-07-02 16:34:31 +01:00
Andrew Burgess 30056ea04a gdb/mi: New commands to catch C++ exceptions
Adds some MI commands to catch C++ exceptions.  The new commands are
-catch-throw, -catch-rethrow, and -catch-catch, these all correspond
to the CLI commands 'catch throw', 'catch rethrow', and 'catch catch'.

Each MI command takes two optional arguments, '-t' has the effect of
calling 'tcatch' instead of 'catch', for example:

   (gdb)
   -catch-throw -t

Is the same as:

   (gdb) tcatch throw

There is also a '-r REGEXP' argument that can supply a regexp to match
against the exception type, so:

   (gdb)
   -catch-catch -r PATTERN

Is the same as:

   (gdb) catch catch PATTERN

The change in print_mention_exception_catchpoint might seem a little
strange; changing the output from using ui_out::field_int and
ui_out::text to using  ui_out::message.

The print_mention_exception_catchpoint is used as the 'print_mention'
method for the exception catchpoint breakpoint object.  Most of the
other 'print_mention' methods (see breakpoint.c) use either
printf_filtered, of ui_out::message.  Using field_int was causing an
unexpected field to be added to the MI output.  Here's the output
without the change in print_mention_exception_catchpoint:

    (gdb)
    -catch-throw
    ^done,bkptno="1",bkpt={number="1",type="breakpoint",disp="keep",
                           enabled="y",addr="0x00000000004006c0",
                           what="exception throw",catch-type="throw",
                           thread-groups=["i1"],times="0"}

Notice the breakpoint number appears in both the 'bkptno' field, and
the 'number' field within the 'bkpt' tuple.  Here's the output with
the change in print_mention_exception_catchpoint:

    (gdb)
    -catch-throw
    ^done,bkpt={number="1",type="breakpoint",disp="keep",
                enabled="y",addr="0x00000000004006c0",
                what="exception throw",catch-type="throw",
                thread-groups=["i1"],times="0"}

gdb/ChangeLog:

	* NEWS: Mention new MI commands.
	* break-catch-throw.c (enum exception_event_kind): Move to
	breakpoint.h.
	(print_mention_exception_catchpoint): Output text as a single
	message.
	(catch_exception_command_1): Rename to...
	(catch_exception_event): ...this, make non-static, update header
	command, and change some parameter types.
	(catch_catch_command): Update for changes to
	catch_exception_command_1.
	(catch_throw_command): Likewise.
	(catch_rethrow_command): Likewise.
	* breakpoint.c (enum exception_event_kind): Delete.
	* breakpoint.h (enum exception_event_kind): Moved here from
	break-catch-throw.c.
	(catch_exception_event): Declare.
	* mi/mi-cmd-catch.c (mi_cmd_catch_exception_event): New function.
	(mi_cmd_catch_throw): New function.
	(mi_cmd_catch_rethrow): New function.
	(mi_cmd_catch_catch): New function.
	* mi/mi-cmds.c (mi_cmds): Add 'catch-throw', 'catch-rethrow', and
	'catch-catch' entries.
	* mi/mi-cmds.h (mi_cmd_catch_throw): Declare.
	(mi_cmd_catch_rethrow): Declare.
	(mi_cmd_catch_catch): Declare.

gdb/doc/ChangeLog:

	* gdb.texinfo (GDB/MI Catchpoint Commands): Add menu entry to new
	node.
	(C++ Exception GDB/MI Catchpoint Commands): New node to describe
	new MI commands.

gdb/testsuite/ChangeLog:

	* gdb.mi/mi-catch-cpp-exceptions.cc: New file.
	* gdb.mi/mi-catch-cpp-exceptions.exp: New file.
	* lib/mi-support.exp (mi_expect_stop): Handle 'exception-caught'
	as a stop reason.
2019-06-15 23:22:22 +01:00
Tom Tromey 52ce35e289 Minor NEWS rearrangement
I noticed that a NEWS item about Python scripting changes appeared
between an item about a convenience function and an item about a
convenience variable.  I think it's better for the latter to be next
to each other.

gdb/ChangeLog
2019-06-14  Tom Tromey  <tromey@adacore.com>

	* NEWS: Move convenience variable news above Python news.
2019-06-14 13:03:18 -06:00