Commit Graph

106570 Commits

Author SHA1 Message Date
Tom de Vries
7ee8c12755 [gdb/testsuite] Fix info-types-c.exp
Recently, I've rewritten gdb.base/info-types.exp.tcl to do processing
line-by-line (commit 2129a94255).

When building gdb with -O0, this test passes for me, but with -O2 I sometimes
run into:
...
FAIL: gdb.base/info-types-c.exp: info types (state == 1)
...

The output the failing gdb_test_multiple is trying to parse is:
...
(gdb) info types^M
All defined types:^M
^M
File src/gdb/testsuite/gdb.base/info-types.c:^M
52:     typedef enum {...} anon_enum_t;^M
  ...
(gdb)
...
and the FAIL with state == 1 means that:
- the regexp for "All defined types:" did trigger, and that
- the regexp for "File .*info-types.c" didn't trigger.

This is due to the fact that the empty line inbetween is supposed to be
matched by the "random line" regexp "^\r\n(\[^\r\n\]*)(?=\r\n)", which doesn't
happen because instead the earlier regexp consuming the gdb prompt matches.

Fix this by moving the "random line" regexp up.  [ Note that that regexp does
not consume the gdb prompt, because it requires (but doesn't consume) a
terminating "\r\n".

Tested on x86_64-linux.

gdb/testsuite/ChangeLog:

2021-06-07  Tom de Vries  <tdevries@suse.de>

	* gdb.base/info-types.exp.tcl (run_test): Move "random line" regexp
	up.
2021-06-07 14:33:50 +02:00
Jan Beulich
6b5ba0d49e x86: honor quoted figure braces in i386_att_operand()
When AVX512 support was added, symbol quotation was not paid attention
to. Just like the (base,index,scale) specifier gets parsed from the end
of the expression, the {...} also wants parsing from the end; in no case
is the first { found a guarantee of a masking or broadcasting specifier.
2021-06-07 12:05:35 +02:00
Jan Beulich
e68c3d59ac x86: better respect quotes in parse_operands()
When d02603dc20 ("Allow symbol and label names to be enclosed in
double quotes") added the check for a double quote to the loop body
there, it didn't go quite far enough: Parentheses inside quotes
shouldn't be counted, and character restrictions also shouldn't apply
inside quoted regions.

In i386_att_operand(), which needs adjustment to remain in sync, besides
respecting double quotes now, also change the logic such that we don't
count parentheses anymore: Finding any opening or closing parenthesis or
any double quote means we're done, because the subsequent parsing code
wouldn't accept (extra) instances of these anyway.

Note that in parse_operands() this mimics get_symbol_name()'s
questionable behavior of treating \ specially only when ahead of ". (The
behavior is suspicious because the meaning of \\ then is ambiguous. It
is in particular impossible to have a (quoted) symbol name end in a
single \.) I would have used get_symbol_name() here, if that didn't
require fiddling with input_line_pointer.
2021-06-07 12:05:02 +02:00
Jan Beulich
014fbcda4c x86: allow unary operators to start a memory operand
So far only - was permitted, but +, !, and ~ ought to be treated the
same.

Rather than adding them to digit_chars[], which was at least odd to have
held - so far, drop this array and its wrapper macro for being used just
once.

While adjusting this logic, also include [ in the characters which may
start a displacement expression - gas generally treats [] as equivalent
to ().
2021-06-07 12:04:24 +02:00
Jan Beulich
9d299bea8c x86: make symbol quotation check consistent in i386_att_operand()
When d02603dc20 ("Allow symbol and label names to be enclosed in
double quotes") added the check for a leading double quote to
i386_att_operand(), it missed a second similar check after having found
a segment override. To avoid the two checks going out of sync again,
introduce an inline helper.
2021-06-07 12:03:32 +02:00
Jan Beulich
c8d541e2e7 x86: correct absolute branch check with segment override
This needs to happen before checking of what may legitimately start a
memory operand (like is done when there's no segment override). Plus a
second '*' shouldn't be permitted when one was already found before the
segment override.
2021-06-07 12:02:15 +02:00
Jan Beulich
98ff9f1c5d x86/Intel: drop unnecessary bracket matching from parse_operands()
While subsequent processing in AT&T mode relies on this simplistic early
checking, Intel mode hasn't been for quite a long time (or perhaps never
really did).
2021-06-07 12:01:45 +02:00
Jan Beulich
f70c6814bb x86: remove pointless 2nd parameter from check_VecOperations()
In the one case where non-NULL gets passed, passing NULL has the same
effect. Hence the parameter is not needed at all.
2021-06-07 12:01:14 +02:00
Jan Beulich
4e014f6ac0 x86: immediate operands don't allow for vector operations
Neither masking nor broadcast are possible here, and RC/SAE get dealt
with elsewhere.

This also fixes gas crashes (i.e. "Fatal error: unable to continue with
assembly"), since the return path being removed failed to restore
input_line_pointer from save_input_line_pointer.
2021-06-07 12:00:38 +02:00
Jan Beulich
a442cac508 ix86: wrap constants
Non-64-bit code should get handled the same with or without BFD64. This
wasn't the case though in a number of situations (and quite likely there
are more that I haven't spotted yet).

It's not very nice to tie the check in md_apply_fix() to object_64bit,
but afaict at that time we have no record anymore of the mode an insn
was assembled in (it might also have been data). This doesn't look to be
the first inconsistency of this kind, though. In x86_cons() it's even
less clear what the right approach would be: flag_code shouldn't matter
for data emission, but instead we'd need to know from which mode(s) the
data actually gets accessed. On this basis, signed_cons() also gets
adjusted.
2021-06-07 08:49:33 +02:00
Jan Beulich
6bee34a1dc fix Dwarf2 build with certain gcc versions
Older gcc reports:

.../bfd/dwarf2.c: In function 'read_ranges':
.../bfd/dwarf2.c:3107: error: comparison between signed and unsigned
.../bfd/dwarf2.c: In function 'read_rnglists':
.../bfd/dwarf2.c:3189: error: comparison between signed and unsigned

Similarly for binutils/dwarf.c. Arrange for the left sides of the > to
also be unsigned quantities.
2021-06-07 08:48:26 +02:00
GDB Administrator
53f18dfd3e Automatic date update in version.in 2021-06-07 00:00:46 +00:00
Simon Marchi
921b2bc73e gdb/testsuite: set sysroot in gdb.server/stop-reply-no-thread-multi.exp
I get some random timeouts in this test due to big debug info taking a
lot of time to read through gdbserver.  When host and target are on the
same machine, clear the sysroot parameter so that GDB reads the files
from the local file system, as we already do in many tests.

I agree with what Pedro says here:

  https://sourceware.org/pipermail/gdb-patches/2019-March/156568.html

that if this is bad for us, it's also bad for users, so we should be
fixing the slowness instead.  But so far nobody seems to be working on
it, and the testsuite timeouts are getting in the way, so I think this
"set sysroot" is a net positive for now.

Without this patch, the test takes over 2 minutes to run (most of it
"downloading" libc debug info), with it it takes 10 seconds.

gdb/testsuite/ChangeLog:

	* gdb.server/stop-reply-no-thread-multi.exp: Clear sysroot when
	host and target are local.

Change-Id: Ieb6304f0e56b4575af450913de4210c667c6bf7b
2021-06-06 09:53:42 -04:00
GDB Administrator
9482e6e450 Automatic date update in version.in 2021-06-06 00:00:44 +00:00
Bernd Edlinger
4a97754465 Fix gdb crash due to SIGPIPE when the compile command fails
Due to the SIGPIPE the gdb process is killed here, which is
not helpful.

2021-06-05  Bernd Edlinger  <bernd.edlinger@hotmail.de>

	* compile/compile.c (scoped_ignore_sigpipe): New helper class.
	(compile_to_object): Ignore SIGPIPE before calling the plugin.
2021-06-05 19:35:44 +02:00
Tom Tromey
8ff8c543b4 Really fix data-directory/Makefile rebuilding
Oops, I botched the last patch to fix data-directory/Makefile
rebuilding, by copying the config.status line and forgetting to update
the directory name.  This one fixes the problem for real.

gdb/ChangeLog
2021-06-05  Tom Tromey  <tom@tromey.com>

	* data-directory/Makefile.in (Makefile): Use correct directory
	name.
2021-06-05 09:26:25 -06:00
Tom Tromey
19d6d783e1 Fix gdb/data-directory Makefile-regeneration rule
My recent changes to the gdb build removed a special case for
data-directory/Makefile, but neglected to update the rule in that
Makefile.  This patch fixes the error by rewriting this rule.

gdb/ChangeLog
2021-06-05  Tom Tromey  <tom@tromey.com>

	* data-directory/Makefile.in (Makefile): Rewrite.
2021-06-05 09:04:51 -06:00
Tom Tromey
b316465fab Use ACX_NONCANONICAL_TARGET in gdb/configure
Shahab Vahedi pointed out that the patch to remove
gdb/testsuite/configure regressed the site.exp creation a bit -- it
left an unresolved configure substitution.  Andrew Burgess pointed out
that the patch removed the call to ACX_NONCANONICAL_TARGET, which
caused this problem.

This patch adds ACX_NONCANONICAL_TARGET to gdb's configure, and fixes
the bug.

gdb/ChangeLog
2021-06-05  Tom Tromey  <tromey@adacore.com>

	* configure: Rebuild.
	* configure.ac: Add ACX_NONCANONICAL_TARGET.
2021-06-05 08:47:46 -06:00
Mike Frysinger
5bea0c3276 sim: common: start dedicated local.mk
This provides a space to generate things that we only need to build
once per-arch.  Some day that will be all of common/, but for now,
we move the version.c management in.
2021-06-05 10:09:27 -04:00
Hannes Domani
ad4bd975fc Fix symbol constants tests for Python 3
gdb/testsuite/ChangeLog:

2021-06-05  Hannes Domani  <ssbssa@yahoo.de>

	* gdb.python/py-symbol.exp: Fix tests for Python 3.
2021-06-05 14:46:30 +02:00
Shahab Vahedi
ae61ef2c56 arc: Add 'set disassembler-options' support
Implement ARC target support for passing options to the disassembler
through the command interface. e.g.:

gdb> set disassembler-options cpu=hs38_linux ...

gdb/ChangeLog:

	* NEWS: Document 'set disassembler-options' support for the ARC
	target.
	* arc-tdep.c (arc_gdbarch_init): Set
	'gdbarch_valid_disassembler_options'.

gdb/doc/ChangeLog:

	* gdb.texinfo (Source and Machine Code): Document 'set
	disassembler-options' support for the ARC target.

gdb/testsuite/ChangeLog:

	* gdb.arch/arc-disassembler-options.exp: New test.
	* gdb.arch/arc-disassembler-options.s: New test source.
2021-06-05 11:43:07 +02:00
GDB Administrator
30569fbb57 Automatic date update in version.in 2021-06-05 00:00:55 +00:00
Tom Tromey
386de171cb Add PROP_VARIABLE_NAME
With -fgnat-encodings=minimal, an internal version (these patches will
be upstreamed in the near future) of the Ada compiler can emit DWARF
for an array where the bound comes from a variable, like:

 <1><12a7>: Abbrev Number: 7 (DW_TAG_array_type)
    <12a8>   DW_AT_name        : (indirect string, offset: 0x1ae9): pck__my_array
[...]
 <2><12b4>: Abbrev Number: 8 (DW_TAG_subrange_type)
    <12b5>   DW_AT_type        : <0x1294>
    <12b9>   DW_AT_upper_bound : <0x1277>

With the upper bound DIE being:

 <1><1277>: Abbrev Number: 2 (DW_TAG_variable)
    <1278>   DW_AT_name        : (indirect string, offset: 0x1a4d): pck__my_length___U
    <127c>   DW_AT_type        : <0x128f>
    <1280>   DW_AT_external    : 1
    <1280>   DW_AT_artificial  : 1
    <1280>   DW_AT_declaration : 1

Note that the variable is just a declaration -- in this situation, the
variable comes from another compilation unit, and must be found when
trying to compute the array bound.

This patch adds a new PROP_VARIABLE_NAME kind, to enable this search.

This same scenario can occur with DW_OP_GNU_variable_value, so this
patch adds support for that as well.

gdb/ChangeLog
2021-06-04  Tom Tromey  <tromey@adacore.com>

	* dwarf2/read.h (dwarf2_fetch_die_type_sect_off): Add 'var_name'
	parameter.
	* dwarf2/loc.c (dwarf2_evaluate_property) <case
	PROP_VARIABLE_NAME>: New case.
	(compute_var_value): New function.
	(sect_variable_value): Use compute_var_value.
	* dwarf2/read.c (attr_to_dynamic_prop): Handle DW_TAG_variable.
	(var_decl_name): New function.
	(dwarf2_fetch_die_type_sect_off): Add 'var_name' parameter.
	* gdbtypes.h (enum dynamic_prop_kind) <PROP_VARIABLE_NAME>: New
	constant.
	(union dynamic_prop_data) <variable_name>: New member.
	(struct dynamic_prop) <variable_name, set_variable_name>: New
	methods.

gdb/testsuite/ChangeLog
2021-06-04  Tom Tromey  <tromey@adacore.com>

	* gdb.ada/array_of_symbolic_length.exp: New file.
	* gdb.ada/array_of_symbolic_length/foo.adb: New file.
	* gdb.ada/array_of_symbolic_length/gl.adb: New file.
	* gdb.ada/array_of_symbolic_length/gl.ads: New file.
	* gdb.ada/array_of_symbolic_length/pck.adb: New file.
	* gdb.ada/array_of_symbolic_length/pck.ads: New file.
2021-06-04 13:51:23 -06:00
Andrew Burgess
4351271e9c gdb: add some additional debug output in remote.c
I needed more debug output from:
  remote_target::select_thread_for_ambiguous_stop_reply
I thought this would be useful for others too.

gdb/ChangeLog:

	* remote.c (remote_target)
	<select_thread_for_ambiguous_stop_reply>: Add additional debug
	output.
2021-06-04 17:19:28 +01:00
Hannes Domani
a53755664f Forward mouse click to python TUI window
If the TUI window object implements the click method, it is called for each
mouse click event in this window.

gdb/ChangeLog:

2021-06-04  Hannes Domani  <ssbssa@yahoo.de>

	* python/py-tui.c (class tui_py_window): Add click function.
	(tui_py_window::click): Likewise.

gdb/doc/ChangeLog:

2021-06-04  Hannes Domani  <ssbssa@yahoo.de>

	* python.texi (TUI Windows In Python): Document Window.click.
2021-06-04 16:18:10 +02:00
Hannes Domani
1bace02a96 Initial TUI mouse support
Implements an overridable tui_win_info::click method whose arguments
are the mouse coordinates inside the specific window, and the mouse
button clicked.

And if the curses implementation supports 5 buttons, the 4th and 5th
buttons are used for scrolling.

gdb/ChangeLog:

2021-06-04  Hannes Domani  <ssbssa@yahoo.de>

	* ser-mingw.c (console_select_thread): Handle MOUSE_EVENT.
	* tui/tui-data.h (struct tui_win_info): Add click function.
	* tui/tui-io.c (tui_prep_terminal): Enable mouse events.
	(tui_deprep_terminal): Disable mouse events.
	(tui_dispatch_ctrl_char): Handle KEY_MOUSE.
	* tui/tui.c (tui_disable): Disable mouse events.
2021-06-04 16:15:01 +02:00
GDB Administrator
25e821a6c2 Automatic date update in version.in 2021-06-04 00:00:51 +00:00
Magne Hov
df5bc734f2 gdb: fix eval.c assert during inferior exit event
Evaluating expressions from within an inferior exit event handler can
cause a crash:

    echo "int main() { return 0; }" > repro.c
    gcc -g repro.c -o repro
    ./gdb -q --ex "set language c++" --ex "python gdb.events.exited.connect(lambda _: gdb.execute('set \$_a=0'))" --ex "run" repro

    Reading symbols from repro...
    Starting program: /home/mhov/repos/binutils-gdb-master/install-bad/bin/repro
    [Inferior 1 (process 1974779) exited normally]
    ../../gdb/thread.c:72: internal-error: thread_info* inferior_thread(): Assertion `current_thread_ != nullptr' failed.
    A problem internal to GDB has been detected,
    further debugging may prove unreliable.
    Quit this debugging session? (y or n) [answered Y; input not from terminal]

    This is a bug, please report it.  For instructions, see:
    <https://www.gnu.org/software/gdb/bugs/>.

Backtrace
    0  in internal_error of ../../gdbsupport/errors.cc:51
    1  in inferior_thread of ../../gdb/thread.c:72
    2  in expression::evaluate of ../../gdb/eval.c:98
    3  in evaluate_expression of ../../gdb/eval.c:115
    4  in set_command of ../../gdb/printcmd.c:1502
    5  in do_const_cfunc of ../../gdb/cli/cli-decode.c:101
    6  in cmd_func of ../../gdb/cli/cli-decode.c:2181
    7  in execute_command of ../../gdb/top.c:670
    ...
    22 in python_inferior_exit of ../../gdb/python/py-inferior.c:182

In `expression::evaluate (...)' there is a call to `inferior_thread
()' that is guarded by `target_has_execution ()':

    struct value *
    expression::evaluate (struct type *expect_type, enum noside noside)
    {
      gdb::optional<enable_thread_stack_temporaries> stack_temporaries;
      if (target_has_execution ()
          && language_defn->la_language == language_cplus
          && !thread_stack_temporaries_enabled_p (inferior_thread ()))
        stack_temporaries.emplace (inferior_thread ());

The `target_has_execution ()' guard maps onto `inf->pid' and the
`inferior_thread ()' call assumes that `current_thread_' is set to
something meaningful:

    struct thread_info*
    inferior_thread (void)
    {
      gdb_assert (current_thread_ != nullptr);
      return current_thread_;
    }

In other words, it is assumed that if `inf->pid' is set then
`current_thread_' must also be set. This does not hold at the point
where inferior exit observers are notified:
- `generic_mourn_inferior (...)'
  - `switch_to_no_thread ()'
    - `current_thread_ = nullptr;'
  - `exit_inferior (...)'
    - `gdb::observers::inferior_exit.notify (...)'
    - `inf->pid = 0'

The inferior exit notification means that a Python handler can get a
chance to run while `current_thread' has been cleared and the
`inf->pid' has not been cleared. Since the Python handler can call any
GDB command with `gdb.execute(...)' (in my case `gdb.execute("set
$_a=0")' we can end up evaluating expressions and asserting in
`evaluate_subexp (...)'.

This patch adds a test in `evaluate_subexp (...)' to check the global
`inferior_ptid' which is reset at the same time as `current_thread_'.
Checking `inferior_ptid' at the same time as `target_has_execution ()'
seems to be a common pattern:

    $ git grep -n -e inferior_ptid --and -e target_has_execution
    gdb/breakpoint.c:2998:    && (inferior_ptid == null_ptid || !target_has_execution ()))
    gdb/breakpoint.c:3054:    && (inferior_ptid == null_ptid || !target_has_execution ()))
    gdb/breakpoint.c:4587:  if (inferior_ptid == null_ptid || !target_has_execution ())
    gdb/infcmd.c:360:  if (inferior_ptid != null_ptid && target_has_execution ())
    gdb/infcmd.c:2380:  /* FIXME:  This should not really be inferior_ptid (or target_has_execution).
    gdb/infrun.c:3438:  if (!target_has_execution () || inferior_ptid == null_ptid)
    gdb/remote.c:11961:  if (!target_has_execution () || inferior_ptid == null_ptid)
    gdb/solib.c:725:  if (target_has_execution () && inferior_ptid != null_ptid)

The testsuite has been run on 5.4.0-59-generic x86_64 GNU/Linux:
- Ubuntu 20.04.1 LTS
- gcc (Ubuntu 9.3.0-17ubuntu1~20.04) 9.3.0
- DejaGnu version 1.6.2
  - Expect version 5.45.4
  - Tcl version 8.6
- Native configuration: x86_64-pc-linux-gnu
- Target: unix

Results show a few XFAIL in
gdb.threads/attach-many-short-lived-threads.exp. The existing
py-events.exp tests are skipped for native-gdbserver and fail for
native-extended-gdbserver, but the new tests pass with
native-extended-gdbserver when run without the existing tests.

gdb/ChangeLog:

2021-06-03  Magne Hov  <mhov@undo.io>

	PR python/27841
	* eval.c (expression::evaluate): Check inferior_ptid.

gdb/testsuite/ChangeLog:

2021-06-03  Magne Hov  <mhov@undo.io>

	PR python/27841
	* gdb.python/py-events.exp: Extend inferior exit tests.
	* gdb.python/py-events.py: Print inferior exit PID.
2021-06-03 21:22:08 +01:00
Pedro Alves
415c8100a2 Update my email address in MAINTAINERS
gdb/ChangeLog:
yyyy-mm-dd  Pedro Alves  <pedro@palves.net>

	* MAINTAINERS (The Official FSF-appointed GDB Maintainers): Remove
	affiliation.
	(Global Maintainers): Update my address.
	(Write After Approval): Remove stale entry.

Change-Id: I3266fedeebfa6800faa2217baf6c032408e84902
2021-06-03 19:57:01 +01:00
John Baldwin
8381088119 Report additional details for signals received on FreeBSD.
Provide a description for si_code values as a sigcode-meaning field.
For signals raised by a system call, provide the pid and user ID of
the sending process.  For signals raised by a POSIX timer exparation,
provide the id of the timer.  For signals raised by a POSIX message
queue, provide the id of the message queue.  For SIGCHLD provide the
pid and user ID of the child process along with the exit status or
relevant signal number.

Sample output for SIGUSR1 raised by kill():

before:

Program received signal SIGUSR1, User defined signal 1.
kill () at kill.S:4
4       RSYSCALL(kill)

after:

Program received signal SIGUSR1, User defined signal 1.
Sent by kill() from pid 30529 and user 1001.
kill () at kill.S:4
4       RSYSCALL(kill)

SIGCHLD for exited process:

before:

Program received signal SIGCHLD, Child status changed.

after:

Program received signal SIGCHLD, Child status changed.
Child has exited: pid 31929, uid 1001, exit status 0.

SIGALRM raised by a POSIX timer (timer_create):

before:

Program received signal SIGALRM, Alarm clock.

after:

Program received signal SIGALRM, Alarm clock.
Timer expired: timerid 3.

gdb/ChangeLog:

	* fbsd-tdep.c (FBSD_SI_USER, FBSD_SI_QUEUE, FBSD_SI_TIMER)
	(FBSD_SI_ASYNCIO, FBSD_SI_MESGQ, FBSD_SI_KERNEL, FBSD_SI_LWP)
	(FBSD_ILL_ILLOPC, FBSD_ILL_ILLOPN, FBSD_ILL_ILLADR)
	(FBSD_ILL_ILLTRP, FBSD_ILL_PRVOPC, FBSD_ILL_PRVREG)
	(FBSD_ILL_COPROC, FBSD_ILL_BADSTK, FBSD_BUS_ADRALN)
	(FBSD_BUS_ADRERR, FBSD_BUS_OBJERR, FBSD_BUS_OOMERR)
	(FBSD_SEGV_MAPERR, FBSD_SEGV_ACCERR, FBSD_SEGV_PKUERR)
	(FBSD_FPE_INTOVF, FBSD_FPE_INTDIV, FBSD_FPE_FLTDIV)
	(FBSD_FPE_FLTOVF, FBSD_FPE_FLTUND, FBSD_FPE_FLTRES)
	(FBSD_FPE_FLTINV, FBSD_FPE_FLTSUB, FBSD_TRAP_BRKPT)
	(FBSD_TRAP_TRACE, FBSD_TRAP_DTRACE, FBSD_TRAP_CAP)
	(FBSD_CLD_EXITED, FBSD_CLD_KILLED, FBSD_CLD_DUMPED)
	(FBSD_CLD_TRAPPED, FBSD_CLD_STOPPED, FBSD_CLD_CONTINUED)
	(FBSD_POLL_IN, FBSD_POLL_OUT, FBSD_POLL_MSG, FBSD_POLL_ERR)
	(FBSD_POLL_PRI, FBSD_POLL_HUP, fbsd_signal_cause)
	(fbsd_report_signal_info): New.
	(fbsd_init_abi): Use fbsd_report_signal_info as gdbarch
	report_signal_info method.
2021-06-03 10:32:20 -07:00
Magne Hov
4c958d7911 Add ChangeLog entry for previous commit 2021-06-03 18:05:31 +01:00
Magne Hov
7cfa3e63f9 Add myself to gdb/MAINTAINERS
gdb/ChangeLog:

2021-06-03  Magne Hov  <mhov@undo.io>

	* MAINTAINERS (Write After Approval): Add Magne Hov.
2021-06-03 17:27:44 +01:00
Hannes Domani
6ac5237cf1 Restore gdb.SYMBOL_LABEL_DOMAIN constant
It was removed (probably by mistake) in
51e78fc5fa.

gdb/ChangeLog:

2021-06-03  Hannes Domani  <ssbssa@yahoo.de>

	* python/py-symbol.c (gdbpy_initialize_symbols): Restore
	gdb.SYMBOL_LABEL_DOMAIN constant.

gdb/testsuite/ChangeLog:

2021-06-03  Hannes Domani  <ssbssa@yahoo.de>

	* gdb.python/py-symbol.exp: Test symbol constants.
2021-06-03 14:56:55 +02:00
Ben Asselstine
bbd47c1230 PR4283, update gprof manual with note about GMON_OUT_PREFIX
PR 4283
	* gprof.texi (Executing): Note GMON_OUT_PREFIX environment variable.
2021-06-03 21:26:33 +09:30
Alan Modra
364d772977 PR2589, ld vs. ld.so
PR 2589
	* ld.texi (link-time runtime library search path): Mention
	plugin library path.  Correct order of search.
2021-06-03 18:32:30 +09:30
Alan Modra
a38d139645 PR1202, mcore disassembler: wrong address loopt
Fixes a 16 year old bug report, which even came with a patch.

opcodes/
	PR 1202
	* mcore-dis.c (print_insn_mcore): Correct loopt disassembly.
	Use unsigned int for inst.
gas/
	PR 1202
	* testsuite/gas/mcore/allinsn.d: Correct loopt expected output.
2021-06-03 13:05:57 +09:30
GDB Administrator
9ef5bfdad9 Automatic date update in version.in 2021-06-03 00:00:44 +00:00
Bernd Edlinger
60be64b396 Fix temp-dir leakage in per-bfd-sharing.exp
Whan using clang as compiler this compile step fails due to the
unknown option "-Wl,--build-id".  This leaks the already created
temp-dir.

Fixed by compiling first, and creating the temp-dir only when the
compile succeeded.

2021-06-02  Bernd Edlinger  <bernd.edlinger@hotmail.de>

	* gdb.dwarf2/per-bfd-sharing.exp: Fix temp-dir leakage.
2021-06-02 21:24:45 +02:00
John Baldwin
ea6197bf5f sim m32c: Include defs.h in m32c.opc and r8c.opc.
gnulib can override stdio.h and/or stdlib.h in which case the gnulib
headers require config.h to be included first.

gdb/sim/m32c/ChangeLog:

	* m32c.opc: Include defs.h.
	* r8c.opc: Likewise.
2021-06-02 08:48:09 -07:00
Carl Love
170960e8e1 Fix threadapply test
The current test case leaves detached processes running at the end of
the test.  This patch changes the test to use a barrier wait to ensure all
processes exit cleanly at the end of the tests.

gdb/testsuite/ChangeLog:

2021-06-02  Carl Love  <cel@us.ibm.com>

	* gdb.threads/threadapply.c: Add global mybarrier.
	(main): Add pthread_barrier_init.
	(thread_function): Replace while loop with myp increment and
	pthread_barrier_wait.
2021-06-02 10:29:36 -05:00
Shahab Vahedi
8f46711443 arc: Construct disassembler options dynamically
The idea of this change is simple: Populate a data structure, namely
"disasm_option_and_arg_t" from "include/dis-asm.h", to encompass the
disassembly options and their possible arguments.

This will make it easier to manage or extend those options by adapting
entries in a data structure, "arc_options".  There will be lesser need
to hard-code the options in the code itself.  Moreover, ARC GDB will
use this population function, "disassembler_options_arc ()", to enable
the "set disassembler-option" for ARC targets.  The gdb change will be
in a separate patch though.

The changes in this patch can be divided into:

1) Introduction of "disassembler_options_arc ()" that will return a
"disasm_option_and_arg_t" structure representing the disassembly
options and their likely arguments.

2) New data type "arc_options_arg_t" and new data "arc_options".
These are the internals for keeping track of options and arguments
entries that can easily be extended.

3) To print the options, the "print_arc_disassembler_options ()" has
been adjusted to use this dynamically built structure instead of having
them hard-coded inside.

To see this in effect, one can look into the output of:
$ ./binutils/objdump --help
  ...
  The following ARC specific disassembler options are...
  ...

include/ChangeLog:

	* dis-asm.h (disassembler_options_arc): New prototype.

opcodes/ChangeLog:

	* arc-dis.c (arc_option_arg_t): New enumeration.
	(arc_options): New variable.
	(disassembler_options_arc): New function.
	(print_arc_disassembler_options): Reimplement in terms of
	"disassembler_options_arc".
2021-06-02 15:32:58 +03:00
Andrew Burgess
f2d4211150 gdb/testsuite: only add -J option when compiling with gfortran
We currently make use of the -J option to gfortran in order that
compiled modules should be placed in the correct output directory.
Obviously different compilers, e.g. flang, will have different options
to achieve the same result.

This commit makes it so we only add the -J flag when using a gcc
based (i.e. gfortran) compiler.

I had a look through the flang help page and tried a few likely
looking options, but couldn't find anything that seemed to do the same
thing, so, for now, I'm only adding an extra option when compiling
with gfortran.

This does mean that any compiler other than gfortran might run into
problems if running the testsuite in parallel due to modules of the
same name all being written to the same directory, and so possibly
overwriting each other.

gdb/testsuite/ChangeLog:

	* lib/gdb.exp (gdb_compile): Only add the -J option when using a
	gcc based Fortran compiler, for example, flang does not support
	this option.
2021-06-02 10:22:11 +01:00
Andrew Burgess
8a222a6b0f gdb/testsuite: escape '*' character in pattern used by flang
One of the integer type patterns used by flang included a '*'
character which was not escaped.

gdb/testsuite/ChangeLog:

	* lib/fortran.exp (fortran_int8): Escape '*' in pattern.
2021-06-02 10:12:02 +01:00
Alan Modra
45342c7c91 asan: heap buffer overflow in _bfd_elf_parse_attributes
* elf-attrs.c (_bfd_elf_parse_attributes): Break out of loop if
	subsection length is too small to cover tag and length field.
2021-06-02 14:47:17 +09:30
GDB Administrator
75bf2c9cf7 Automatic date update in version.in 2021-06-02 00:00:48 +00:00
John Baldwin
aeeb758df5 Conditionally restore displaced stepping state after fork.
There is no default method for
gdbarch_displaced_step_restore_all_in_ptid, so calling it
unconditionally for fork events triggered an assertion failure on
platforms that do not support displaced stepping.  To fix, only invoke
the method if the gdbarch supports displaced stepping.

Note that not all gdbarches support both displaced stepping and fork
events, so gdbarch validation does not require
gdbarch_displaced_step_restore_all_in_ptid for any gdbarch supporting
displaced stepping.  However, the internal assertion in
gdbarch_displaced_step_restore_all_in_ptid should catch any gdbarches
which do support both but fail to provide this method.

gdb/ChangeLog:

	* infrun.c (handle_inferior_event): Only call
	gdbarch_displaced_step_restore_all_in_ptid if
	gdbarch_supports_displaced_stepping is true.
2021-06-01 14:22:20 -07:00
Tom Tromey
906f72d454 Remove some gdb/data-directory special cases
I found an odd special case for data-directory in gdb's Makefile.  I
don't see a reason to have this, so this removes it in favor of having
this code work in the most ordinary way for a subdirectory build.

gdb/ChangeLog
2021-06-01  Tom Tromey  <tromey@adacore.com>

	* Makefile.in (all-data-directory): Remove.
	(data-directory/Makefile): Remove.
2021-06-01 08:11:31 -06:00
Tom Tromey
ba56237dab Clean up gdb's --enable-shared
The old testsuite configure did not use AS_HELP_STRING, and it had a
typo in the help for --enable-shared.  This patch fixes these
problems.

gdb/ChangeLog
2021-06-01  Tom Tromey  <tromey@adacore.com>

	* configure: Rebuild.
	* configure.ac: Use AS_HELP_STRING for enable-shared.  Fix typo.
2021-06-01 08:11:31 -06:00
Tom Tromey
2adf178139 Apply silent Makefile rules to gdb/testsuite
This applies the silent-rules.mk treatment to gdb/testsuite/Makefile.

gdb/ChangeLog
2021-06-01  Tom Tromey  <tromey@adacore.com>

	* silent-rules.mk (ECHO_CC): New variable.

gdb/testsuite/ChangeLog
2021-06-01  Tom Tromey  <tromey@adacore.com>

	* Makefile.in (all): Don't print anything.
	($(abs_builddir)/site.exp site.exp): Use $(ECHO_GEN).
	(expect-read1): Likewise.
	(read1.so): Use $(ECHO_CC).
	Include silent-rules.mk.
2021-06-01 08:11:31 -06:00
Tom Tromey
bdbbcd5774 Always build 'all' in gdb/testsuite
gdb's Makefile currently excludes testsuite from the subdirectories to
build.  I don't think there's a good reason for this, so this patch
adds testsuite to the SUBDIRS list and removes a special case from
'all'.

gdb/ChangeLog
2021-06-01  Tom Tromey  <tromey@adacore.com>

	* Makefile.in (SUBDIRS): Add testsuite.
	(all): Don't exclude testsuite.
2021-06-01 08:11:30 -06:00