Commit Graph

114979 Commits

Author SHA1 Message Date
Alan Modra
6f860418d5 asprintf memory leaks
A number of backends want to return bfd_reloc_dangerous messaqes from
relocation special_function, and construct the message using asprintf.
Such messages are not freed anywhere, leading to small memory leaks
inside libbfd.  To limit the leaks, I'd implemented a static buffer in
the ppc backends that was freed before use in asprintf output.  This
patch extends that scheme to other backends using a shared static
buffer and goes further in freeing the buffer on any bfd_close.

The patch also fixes a few other cases where asprintf output was not
freed after use.

bfd/
	* bfd.c (_input_error_msg): Make global and rename to..
	(_bfd_error_buf): ..this.
	(bfd_asprintf): New function.
	(bfd_errmsg): Use bfd_asprintf.
	* opncls.c (bfd_close_all_done): Free _buf_error_buf.
	* elf32-arm.c (find_thumb_glue, find_arm_glue): Use bfd_asprintf.
	* elf32-nios2.c (nios2_elf32_relocate_section): Likewise.
	* elf32-ppc.c (ppc_elf_unhandled_reloc): Likewise.
	* elf64-ppc.c (ppc64_elf_unhandled_reloc): Likewise.
	* elfnn-riscv.c (riscv_resolve_pcrel_lo_relocs): Likewise.
	(riscv_elf_relocate_section): Likewise.
	* libbfd.h: Regenerate.
gas/
	* read.c (read_end): Free current_name and current_label.
	(do_s_func): Likewise on error path.  strdup label.
ld/
	* pe-dll.c (make_head, make_tail, make_one),
	(make_singleton_name_thunk, make_import_fixup_entry),
	(make_runtime_pseudo_reloc),
	(pe_create_runtime_relocator_reference: Free oname after use.
2023-06-14 14:24:50 +09:30
Alan Modra
48375c36dc Re: bfd/elf.c strtab memory leak
There are other places that leak the strtab.

	* elf.c (_bfd_elf_compute_section_file_positions): Free strtab
	on error paths.
2023-06-14 14:24:33 +09:30
GDB Administrator
3bedac2939 Automatic date update in version.in 2023-06-14 00:00:11 +00:00
Tom de Vries
63224e96d0 [gdb/testsuite] Fix gdb.tui/long-prompt.exp with read1
When running test-case gdb.tui/long-prompt.exp with check-read1, we get:
...
(gdb) FAIL: gdb.tui/long-prompt.exp: prompt size == width + 1: \
  end of screen: at last line
...

The problem is in these commands:
...
    Term::command "echo \\n"
    Term::command "echo \\n"
    Term::command "echo \\n"
    Term::command "echo \\n"
...

The last one makes the terminal scroll, and the scrolling makes the expected
output match on a different line.

Fix this by replacing the sequence with a single command:
...
    Term::command "echo \\n\\n\\n\\n\\n\\n"
...
which avoids scrolling.

Tested on x86_64-linux.
2023-06-13 13:21:09 +02:00
Tom de Vries
3e543c18b1 [gdb/testsuite] Fix and add prompt anchoring in tuiterm
There is a test-case that contains a unit test for tuiterm:
gdb.tui/tuiterm.exp.

However, this only excercises the tuiterm itself, and not the functions that
interact with it, like Term::command.

Add a new test-case gdb.tui/tuiterm-2.exp that:
- overrides proc accept_gdb_output (to be able simulate incorrect responses
  while avoiding the timeout),
- overrides proc send_gdb (to be able to call Term::command without a gdb
  instance, such that all tuiterm input is generated by the test-case).
- issues Term::command calls, and
- checks whether they behave correctly.

This exposes a problem in Term::command.  The "prompt before command" regexp
starts with a bit that is supposed to anchor the prompt to the border:
...
	set str "(^|\|)$gdb_prompt $str"
...
but that doesn't work due to insufficient escaping.  Fix this by adding the
missing escape:
...
	set str "(^|\\|)$gdb_prompt $str"
...

Futhermore, the "prompt after command" regexp in Term::wait_for has no
anchoring at all:
...
	set prompt_wait_for "$gdb_prompt \$"
...
so add that as well.

Tested on x86_64-linux.
2023-06-13 12:24:17 +02:00
Tom de Vries
cc313a1d84 [gdb/testsuite] Allow procs with default value args in with_override
Currently proc with_override does not work with procs with default value args.

Fix this, and add a test-case excercising this scenario.

Tested on x86_64-linux.
2023-06-13 12:24:17 +02:00
Tom de Vries
40bea10383 [gdb/testsuite] Fix gdb.dap/type_check.exp with older python
On openSUSE Leap 15.4 with system python 3.6, I run into:
...
(gdb) python check_everything()^M
(gdb) FAIL: gdb.dap/type_check.exp: type checker
...

In check_everything, the hasattr test fails silently:
...
def check_everything():
    # Older versions of Python can't really implement this.
    if hasattr(typing, "get_origin"):
...
and that makes the gdb_test in the test-case fail.

Fix this by emitting UNSUPPORTED instead in check_everything, and detecting
this in the test-case.

Tested on x86_64-linux.
2023-06-13 12:21:45 +02:00
Lancelot SIX
bdde90c4ce gdb/testsuite: use proper int size for gdb.dwarf2/symbol_needs_eval*.exp
We recently realized that symbol_needs_eval_fail.exp and
symbol_needs_eval_timeout.exp invalidly dereference an int (4 bytes on
x86_64) by reading 8 bytes (the size of a pointer).

Here how it goes:

In gdb/testsuite/gdb.dwarf2/symbol_needs_eval.c a global variable is
defined:

    int exec_mask = 1;

and later both tests build some DWARF using the assembler doing:

    set exec_mask_var [gdb_target_symbol exec_mask]
    ...
        DW_TAG_variable {
          {DW_AT_name a}
          {DW_AT_type :$int_type_label}
          {DW_AT_location {
            DW_OP_addr $exec_mask_var
            DW_OP_deref
            ...
          }
        }

The definition of the DW_OP_deref (from Dwarf5 2.5.1.3 Stack Operations)
says that "The size of the data retrieved from the dereferenced address
is the size of an address on the target machine."

On x86_64, the size of an int is 4 while the size of an address is 8.
The result is that when evaluating this expression, the debugger reads
outside of the `a` variable.

Fix this by using `DW_OP_deref_size $int_size` instead.  To achieve
this, this patch adds the necessary steps so we can figure out what
`sizeof(int)` evaluates to for the current target.

While at it, also change the definition of the int type in the assembled
DWARF information so we use the actual target's size for an int instead
of the literal 4.

Tested on x86_64 Linux.

Approved-By: Tom Tromey <tom@tromey.com>
2023-06-13 09:22:39 +01:00
GDB Administrator
1e888ec928 Automatic date update in version.in 2023-06-13 00:00:17 +00:00
Kevin Buettner
f3741bbd18 Simplify case DW_OP_GNU_uninit in dwarf_expr_context::execute_stack_op
Tom Tromey pointed out that the test and call to error() for the
DW_OP_GNU_uninit case in dwarf_expr_context::execute_stack_op (in
gdb/dwarf2/expr.c)...

	  if (op_ptr != op_end && *op_ptr != DW_OP_piece
	      && *op_ptr != DW_OP_bit_piece)
	    error (_("DWARF-2 expression error: DW_OP_GNU_uninit must always "
		   "be the very last op in a DWARF expression or "
		   "DW_OP_piece/DW_OP_bit_piece piece."));

...could be replaced by a call to dwarf_expr_require_composition which
performs a similar check and outputs a suitable error message.
2023-06-12 16:02:40 -07:00
Simon Farre
9af6e8c6df Added self to W.A.A. maintainers 2023-06-12 21:45:03 +02:00
Richard Bunt
2e3aff2762 gdb/testsuite: Testing with the armflang compiler
Currently the Fortran test suite does not run with armflang because the
compiler detection fails. This in turn means fortran_runto_main does not
know which main method to use to start a test case.

Fortran compiler detection was added in 44d469c5f85; however, the commit
message notes that it was not tested with armflang.

This commit tests and fixes up a minor issue to get the detection
working.

The goal here is to get the tests running and preventing further
regressions during future work. This change does not do anything to fix
existing failures.

>From what I can understand, the auto detection leverages the
preprocessor to extract the Fortran compiler identity from the defines.
This preprocessor output is then evaluated by the test suite to import
these defines.

In the case of armflang, this evaluation step is disrupted by the
presence of the following warning:

    $ armflang -E -fdiagnostics-color=never testsuite/lib/compiler.F90 -o compiler.exp
    $ clang-13: warning: argument unused during compilation: '-fdiagnostics-color=never' [-Wunused-command-line-argument]

The evaluation logic is already set up to filter this warning, but the
prefix differs.

This commit fixes the issue by updating the filter to exclude the
armflang flavour of warning.

gdb.fortran regression tests run with GNU, Intel and Intel LLVM. No
regressions detected.

The gdb.fortran test results with ACfL 23.04.1 are as follows.

Before:

 # of expected passes		560
 # of unexpected failures	113
 # of unresolved testcases	2
 # of untested testcases	5
 # of duplicate test names	2

After:

 # of expected passes		5388
 # of unexpected failures	628
 # of known failures		10
 # of untested testcases	8
 # of unsupported tests		5
 # of duplicate test names	5

As can be seen from the above, there are now considerably more passing
assertions.

Reviewed-By: Luis Machado <luis.machado@arm.com>
Approved-By: Tom Tromey <tom@tromey.com>
2023-06-12 12:32:52 -06:00
Tom Tromey
a1ef65231b Remove f-strings from DAP
Kévin pointed out that gdb claims a minimum Python version of 3.2, but
the DAP code uses f-strings, which were added in 3.6.

This patch removes the uses of f-strings from the DAP code.  I can't
test an older version of Python, but I did confirm that this still
works with the version I have.
2023-06-12 12:24:07 -06:00
Tom Tromey
d294a0fc26 Implement DAP conditional breakpoints
I realized that I had only implemented DAP breakpoint conditions for
exception breakpoints, and not other kinds of breakpoints.  This patch
corrects the oversight.
2023-06-12 12:10:15 -06:00
Tom Tromey
7cb909c409 Do not report totalFrames from DAP stackTrace request
Currently, gdb will unwind the entire stack in response to the
stackTrace request.  I had erroneously thought that the totalFrames
attribute was required in the response.  However, the spec says:

    If omitted or if `totalFrames` is larger than the available
    frames, a client is expected to request frames until a request
    returns less frames than requested (which indicates the end of the
    stack).

This patch removes this from the response in order to improve
performance when the stack trace is very long.
2023-06-12 12:10:15 -06:00
Tom Tromey
3c453cfb19 Implement DAP breakpointLocations request
This implements the DAP breakpointLocations request.
2023-06-12 12:10:15 -06:00
Tom Tromey
ad9cdfbcfd Add "stop at main" extension to DAP launch request
Co-workers who work on a program that uses DAP asked for the ability
to have gdb stop at the main subprogram when launching.  This patch
implements this extension.

Reviewed-By: Eli Zaretskii <eliz@gnu.org>
2023-06-12 12:10:10 -06:00
Tom Tromey
67efac36f1 Add "target" parameter to DAP attach request
This adds a new "target" to the DAP attach request.  This is passed to
"target remote".  I thought "attach" made the most sense for this,
because in some sense gdb is attaching to a running process.  It's
worth noting that all DAP "attach" parameters are defined by the
implementation.

Reviewed-By: Eli Zaretskii <eliz@gnu.org>
2023-06-12 12:09:56 -06:00
Tom Tromey
8115dffa1e Handle DAP supportsVariableType capability
A DAP client can report the supportsVariableType capability in the
initialize request.  In this case, gdb can include the type of a
variable or expression in various results.
2023-06-12 12:09:46 -06:00
Tom Tromey
c2a0d767db Implement DAP setExpression request
This implements the DAP setExpression request.
2023-06-12 12:09:45 -06:00
Tom Tromey
ed80156930 Add gdb.Value.assign method
This adds an 'assign' method to gdb.Value.  This allows for assignment
without requiring the use of parse_and_eval.

Reviewed-By: Eli Zaretskii <eliz@gnu.org>
2023-06-12 12:09:39 -06:00
Tom Tromey
510586589e Add type-checking to DAP requests
It occurred to me recently that gdb's DAP implementation should
probably check the types of objects coming from the client.  This
patch implements this idea by reusing Python's existing type
annotations, and supplying a decorator that verifies these at runtime.

Python doesn't make it very easy to do runtime type-checking, so the
core of the checker is written by hand.  I haven't tried to make a
fully generic runtime type checker.  Instead, this only checks the
subset that is needed by DAP.  For example, only keyword-only
functions are handled.

Furthermore, in a few spots, it wasn't convenient to spell out the
type that is accepted.  I've added a couple of comments to this effect
in breakpoint.py.

I've tried to make this code compatible with older versions of Python,
but I've only been able to try it with 3.9 and 3.10.
2023-06-12 12:09:28 -06:00
Tom Tromey
5e20b4cd17 Use tuples for default arguments in DAP
My co-worker Kévin taught me that using a mutable object as a default
argument in Python is somewhat dangerous, because the object is
created a single time (when the function is defined), and so if it is
mutated in the body of the function, the changes will stick around.

This patch changes the cases like this in DAP to use () rather than []
as the default.  This patch is merely preventative, as no bugs like
this are in the code.
2023-06-12 12:09:28 -06:00
Tom Tromey
5c7cdc95aa Fix a latent bug in DAP request decorator
The 'request' decorator is intended to also ensure that the request
function runs in the DAP thread.  However, the unwrapped function is
installed in the global request map, so the wrapped version is never
called.  This patch fixes the bug.
2023-06-12 12:09:28 -06:00
Tom Tromey
070e93a8b8 Add test for DAP pause request
I neglected to write a test for the DAP "pause" request.  This patch
adds one.
2023-06-12 12:09:28 -06:00
Tom Tromey
8c8701f9cf Rename one DAP function
When I first started implementing DAP, I had some vague plan of having
the implementation functions use the same name as the request.  I
abandoned this idea, but one vestige remained.  This patch renames the
one remaining function to be gdb-ish.
2023-06-12 12:09:28 -06:00
Tom Tromey
fc2d72afc0 Add singleThread support to some DAP requests
A few DAP requests support a "singleThread" parameter, which is
somewhat similar to scheduler-locking.  This patch implements support
for this.
2023-06-12 12:09:28 -06:00
Tom Tromey
3eb64586f0 Implement DAP stepOut request
This implements the DAP "stepOut" request.
2023-06-12 12:09:28 -06:00
Tom Tromey
d01f36bdfa Implement DAP attach request
This implements the DAP "attach" request.

Note that the copyright dates on the new test source file are not
incorrect -- this was copied verbatim from another directory.

Reviewed-By: Eli Zaretskii <eliz@gnu.org>
2023-06-12 12:09:18 -06:00
Tom Tromey
69ed07d546 Implement DAP setExceptionBreakpoints request
This implements the DAP setExceptionBreakpoints request for Ada.  This
is a somewhat minimal implementation, in that "exceptionOptions" are
not implemented (or advertised) -- I wasn't completely sure how this
feature is supposed to work.

I haven't added C++ exception handling here, but it's easy to do if
needed.

This patch relies on the new MI command execution support to do its
work.
2023-06-12 11:51:52 -06:00
Tom Tromey
2c4c710f56 Don't require inferior execution for Ada catchpoints
Currently, Ada catchpoints require that the inferior be running.
However, there's no deep reason for this -- for example, C++ exception
catchpoints do not have this requirement.  Instead, those work like
ordinary breakpoints: they are pending until the needed runtime
locations are seen.

This patch changes Ada catchpoints to work the same way.
2023-06-12 11:51:52 -06:00
Tom Tromey
03f531ea22 Mark members of ada_catchpoint "private"
This changes the members of ada_catchpoint to be private.
2023-06-12 11:51:52 -06:00
Tom Tromey
971149cb9a Turn should_stop_exception into a method of ada_catchpoint
This turns the should_stop_exception function in ada-lang.c into a
method of ada_catchpoint.
2023-06-12 11:51:52 -06:00
Tom Tromey
95f2fe27ef Combine create_excep_cond_exprs and ada_catchpoint::re_set
This patch merges create_excep_cond_exprs into ada_catchpoint::re_set.
This is less verbose and is also a step toward making ada_catchpoint
work more like the other code_breakpoint-based exception catchpoints.
2023-06-12 11:51:52 -06:00
Tom Tromey
898db0f75d Transfer ownership of exception string to ada_catchpoint
This changes the ada_catchpoint to require an rvalue ref, so that
ownership of the exception string can be transferred to the catchpoint
object.
2023-06-12 11:51:52 -06:00
Tom Tromey
dc3f8fa94a Pass tempflag to ada_catchpoint constructor
This is a minor cleanup to pass tempflag to the ada_catchpoint
constructor.
2023-06-12 11:51:52 -06:00
Tom Tromey
dd47347303 Use gnat_runtime_has_debug_info in Ada catchpoint tests
This changes the Ada catchpoint tests to use
gnat_runtime_has_debug_info.  This simplifies the code.
2023-06-12 11:51:52 -06:00
Tom Tromey
4adf3a4059 Stop gdb in gnat_runtime_has_debug_info
gnat_runtime_has_debug_info starts a new gdb to do its work.  However,
it also leaves this gdb running, which can potentially confuse the
calling test -- I encountered this when writing a new DAP test.  This
patch changes the proc to shut down gdb.
2023-06-12 11:51:52 -06:00
Tom de Vries
9f82823f89 [gdb/testsuite] Relax breakpoint count check in gdb.python/py-rbreak.exp
With a gdb 13.2 based package on SLE-15 aarch64,  I run into:
...
(gdb) PASS: gdb.python/py-rbreak.exp: nosharedlibrary
py sl = gdb.rbreak("^[^_]",minsyms=False)^M
Breakpoint 2 at 0x4004ac: file ../sysdeps/aarch64/crti.S, line 63.^M
  ...
(gdb) py print(len(sl))^M
12^M
(gdb) FAIL: gdb.python/py-rbreak.exp: check number of returned breakpoints is 11
...

The FAIL is due to:
- the glibc object crti.o containing debug information for function
  call_weak_fn, and
- the test-case not expecting this.

The debug information is there due to compiling glibc using a binutils which
contains commit 591cc9fbbf ("gas/Dwarf: record functions").

I've run into a similar issue before, see commit 3fbbcf473a ("[gdb/testsuite]
Fix regexp in py-rbreak.exp").

The fix I applied there was to use a regexp "^[^_]" to filter out
__libc_csu_fini and __libc_csu_init, but that doesn't work for call_weak_fn.

Fix this by:
- reverting the regexp to "", and
- rewriting the check to require at least 11 functions, rather than a precise
  match.

Tested on x86_64-linux.

PR testsuite/30538
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30538
2023-06-12 13:00:09 +02:00
Tom de Vries
d0cc647211 [gdb/testsuite] Fix breakpoint regexp in gdb.ada/out_of_line_in_inlined.exp
With a gdb 13.2 based package on openSUSE Tumbleweed i586, I ran into:
...
(gdb) run ^M
Starting program: out_of_line_in_inlined/foo_o224_021-all ^M
[Thread debugging using libthread_db enabled]^M
Using host libthread_db library "/lib/libthread_db.so.1".^M
^M
Breakpoint 1.1, foo_o224_021.child1.child2 (s=...) at foo_o224_021.adb:26^M
26                  for C of S loop^M
(gdb) FAIL: gdb.ada/out_of_line_in_inlined.exp: scenario=all: \
  run to foo_o224_021.child1.child2
...

I can reproduce the same issue with gdb trunk on x86_64, by using optimize=-O3
instead of optimize=-O2.

Fix this by using $bkptno_num_re.

Tested on x86_64-linux.

PR testsuite/30539
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=30539
2023-06-12 11:14:24 +02:00
Tom de Vries
45601fb84d [gdb/tui] Replace macro HELP_ATTRIBUTE_MODE with std::string
Replace macro HELP_ATTRIBUTE_MODE with a std::string.

Tested on x86_64-linux.

Reviewed-By: Bruno Larsen <blarsen@redhat.com>
Reviewed-By: Tom Tromey <tom@tromey.com>
2023-06-12 08:25:31 +02:00
mengqinggang
55e1609e53 LoongArch: gas: Relocations simplification when -mno-relax
Gas does not emit ADD/SUB relocation pairs for label differences
  when -mno-relax.
2023-06-12 09:30:48 +08:00
GDB Administrator
26d812a2aa Automatic date update in version.in 2023-06-12 00:00:10 +00:00
Kevin Buettner
d65befc152 Permit DW_OP_GNU_uninit to be used with DW_OP_piece
This commit implements a fix for a bug reported against GDB on
Fedora bugzilla...

https://bugzilla.redhat.com/show_bug.cgi?id=2166796

The test case in that bug report involved running gdb against the 'jq'
program (which is a command-line JSON processor) on Fedora 37.  Since
the debug info is compiler (and compile-time option) dependent, it
won't necessarily show up in other distributions or even past or
future versions of Fedora.  (E.g. when trying the example shown below
on Fedora 38, GDB says that the value of 'value' has been optimized
out.  I.e. it does not demonstrate the same DWARF error that can be
see when using Fedora 37.)

That said, on Fedora 37, the bug could be reproduced as follows:

[kev@f37-1 ~]$ gdb jq -q -ex 'b src/util.c:415' -ex 'r </dev/null'
Reading symbols from jq...

This GDB supports auto-downloading debuginfo from the following URLs:
  <https://debuginfod.fedoraproject.org/>
Enable debuginfod for this session? (y or [n]) y
Debuginfod has been enabled.
To make this setting permanent, add 'set debuginfod enabled on' to .gdbinit.
Reading symbols from /home/kev/.cache/debuginfod_client/9d3c8b4197350a190a74972d481de32abf641aa4/debuginfo...
No source file named src/util.c.
Make breakpoint pending on future shared library load? (y or [n]) y
Breakpoint 1 (src/util.c:415) pending.
Starting program: /usr/bin/jq </dev/null
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".

Breakpoint 1, jq_util_input_next_input (state=0x55555555d7f0) at src/util.c:416
416	    if (state->parser == NULL) {
(gdb) p value
DWARF-2 expression error: DW_OP_GNU_uninit must always be the very last op.

This is undesirable - rather than output an error about the DWARF
info, we'd prefer to see a value, even if it is uninitialized.

Examination of the debuginfo showed the following:

 <1><468f1>: Abbrev Number: 112 (DW_TAG_subprogram)
    <468f2>   DW_AT_external    : 1
    <468f2>   DW_AT_name        : (indirect string, offset: 0x4781): jq_util_input_next_input
    <468f6>   DW_AT_decl_file   : 10
    <468f6>   DW_AT_decl_line   : 411
    <468f8>   DW_AT_decl_column : 4
    <468f9>   DW_AT_prototyped  : 1
    <468f9>   DW_AT_type        : <0x3f2>
    <468fd>   DW_AT_sibling     : <0x4692e>
...
 <2><46921>: Abbrev Number: 102 (DW_TAG_variable)
    <46922>   DW_AT_name        : (indirect string, offset: 0x8cb): value
    <46926>   DW_AT_decl_file   : 10
    <46926>   DW_AT_decl_line   : 414
    <46928>   DW_AT_decl_column : 6
    <46929>   DW_AT_type        : <0x3f2>

Note that there's no DW_AT_location, so I looked for an abstract origin entry:

 <2><2dfa0>: Abbrev Number: 90 (DW_TAG_variable)
    <2dfa1>   DW_AT_abstract_origin: <0x46921>
    <2dfa5>   DW_AT_location    : 0x27cf1 (location list)
    <2dfa9>   DW_AT_GNU_locviews: 0x27ce1

(Note that the DW_AT_abstract_origin attribute's value is 0x46921 which
is the DIE for the local variable "value".)

Looking at the location list, I see:

    00027cf1 v000000000000000 v000000000000000 views at 00027ce1 for:
             000000000002f8fe 000000000002f92e (DW_OP_reg13 (r13); DW_OP_GNU_uninit; DW_OP_piece: 8; DW_OP_reg12 (r12); DW_OP_GNU_uninit; DW_OP_piece: 8)

While DW_OP_GNU_uninit is not the very last op, it is the last op
prior to DW_OP_piece.  The fix involved changing the DW_OP_GNU_uninit
case in dwarf_expr_context::execute_stack_op in gdb/dwarf2/expr.c so
that DW_OP_GNU_uninit may appear just before DW_OP_piece.

With the fix in place, attempting to print 'value' now looks like
this:

(gdb) p value
$1 =  [uninitialized] {kind_flags = 0 '\000', pad_ = 0 '\000', offset = 0,
  size = 0, u = {ptr = 0x0, number = 0}}

Note that "[uninitialized]" is part of the output.  (But also note
that there's an extra space character.)

I've made a new test case,
gdb.dwarf2/DW_OP_piece_with_DW_OP_GNU_uninit.exp, by adapting an
existing one, gdb.dwarf2/opt-out-not-implptr.exp.  Since it uses the
DWARF assembler, the test case does not depend on a specific compiler
version or compiler options.

Tested on Fedora 37 and Fedora 38.
2023-06-11 15:41:42 -07:00
GDB Administrator
5bd1073178 Automatic date update in version.in 2023-06-11 00:00:09 +00:00
GDB Administrator
3e27e91062 Automatic date update in version.in 2023-06-10 00:00:12 +00:00
Indu Bhagat
e4d5d12940 libsframe: testsuite: add sframe_find_fre tests for pltN entries
Add a new test plt-findfre-1 to ensure lookup of SFrame stack trace
information for pltN entries is correct.

In this test, a dummy SFrame FDE of type SFRAME_FDE_TYPE_PCMASK is
created.  The size of the 'function code block' covered by the SFrame
FDE is equivalent to 5 pltN entries of 16 bytes each.

The test first looks up SFrame FREs for some addresses in the first pltN
entry, followed by lookups for some addresses in the fourth pltN entry.

libsframe/
	* Makefile.in: Regenerated.
	* testsuite/libsframe.find/find.exp: Add new test.
	* testsuite/libsframe.find/local.mk: Likewise.
	* testsuite/libsframe.find/plt-findfre-1.c: New test.
2023-06-09 11:24:25 -07:00
Indu Bhagat
937c461e41 libsframe: fix sframe_find_fre for pltN entries
To find SFrame stack trace information from an FDE of type
SFRAME_FDE_TYPE_PCMASK, sframe_find_fre () was doing an operation
like,
  (start_ip_offset & 0xff) >= (pc & 0xff), etc.

This is buggy and needs correction.  The mask 0xff should be 0xf (to
work for a pltN entry of size say, 16 bytes).

At this time, the size of the pltN entry is implicitly assumed to be 16
bytes by libsframe.  In next version of the SFrame format, we can encode
this information explicitly in the SFrame FDE.

For now, we should fix the code to at least behave correctly for the
generated code and the generated SFrame stack trace information for the
pltN entries on x86_64.

libsframe/
	* sframe.c (sframe_find_fre): Correct the bitmask used for
	SFrame FDEs of type SFRAME_FDE_TYPE_PCMASK.
2023-06-09 11:14:05 -07:00
Luis Machado
05d63bafad [AArch64,arm] Fix some formatting issues in the aarch64/arm codebase
As noted by Tom Tromey, there are some formatting issues with the ternary
operator in the aarch64/arm codebase.  This patch fixes those.

Reviewed-By: Tom Tromey <tom@tromey.com>
2023-06-09 16:27:32 +01:00
Tom de Vries
a3859ffba3 [gdb/tui] Simplify tui_puts_internal
Simplify tui_puts_internal by using continue, as per this [1] coding standard
rule, making the function more readable and easier to understand.

No functional changes.

Tested on x86_64-linux.

[1] https://llvm.org/docs/CodingStandards.html#use-early-exits-and-continue-to-simplify-code

Reviewed-By: Tom Tromey <tom@tromey.com>
2023-06-09 16:44:12 +02:00