Age | Commit message (Collapse) | Author | Files | Lines |
|
|
|
|
|
If all external symbol accesses are indirect, we can treat protected
symbols as local since there will be no copy relocation for data and
external function pointer access will go through GOT, instead of PLT.
No PLT slot should be used for external function pointer in executable.
bfd/
PR ld/33260
* elfxx-x86.h (COPY_INPUT_RELOC_P): Treat protected symbols with
indirect external access as local.
ld/
PR ld/33260
* testsuite/ld-i386/i386.exp: Run PR ld/33260 test.
* testsuite/ld-x86-64/x86-64.exp: Likewise.
* testsuite/ld-i386/pr33260.d: New file.
* testsuite/ld-i386/pr33260.s: Likewise.
* testsuite/ld-x86-64/pr33260-x32.d: Likewise.
* testsuite/ld-x86-64/pr33260.d: Likewise.
* testsuite/ld-x86-64/pr33260.s: Likewise.
Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
|
|
|
|
Otherwise, the same test appears twice, once with PASS, once with UNSUPPORTED
on non-ia64. Just add '(ia64)' to the name so binutils.log is clearer.
* testsuite/binutils-all/testranges-ia64.d (#name): Add suffix.
|
|
Pass $plug_opt to nm when setting dump_prog to nm to load plugin.
PR binutils/21479
* testsuite/ld-plugin/lto-binutils.exp (run_lto_binutils_test):
Pass $plug_opt to nm.
Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
|
|
should_validate_memtags uses value_as_address to evalute
whether an address for a value is tagged. The comments for
that function simply say, "Extract a value as a C pointer."
While that sounds innoncuous, that function calls coerce_array,
which will dereference any references. This is not what is
desired here.
This can be demonstrated on an MTE-enabled host, such as aarch64-
based Ampere (example taken from tests introduced in this patch):
(gdb) p b.get_foo ()
Could not validate memory tag: Value can't be converted to integer.
$2 = (const foo &) @0xffffffffed88: {m_a = 42}
While the command completes, gdb didn't actually attempt to
evaluate any memory tags.
Fix this by using unpack_pointer instead.
Tested on x86_64 Fedora 40 and aarch64 RHEL 9.6.
|
|
With test-case gdb.tui/basic.exp and TERM=ansis, I run into (with some logging
added):
...
status line: '<reverse:1><intensity:dim>exec No process (asm) In:
L?? PC: ?? <reverse:0><intensity:normal>'
FAIL: gdb.tui/basic.exp: status window: reverse
...
The status window uses ncurses attribute standout, which can differ between
different terminal settings.
Fix this by making the matching less strict.
Tested on x86_64-linux.
|
|
When running test-case gdb.tui/main-2.exp with TERM=ansis, I get:
...
screen line 6: 'B+><fg:black><intensity:bold> 21 <reverse:1><fg:default><intensity:normal> return 0;<reverse:0> '
FAIL: gdb.tui/main-2.exp: highlighted line in middle of source window
...
The test tries to check the highlighting of the source line, but also gets the
part with the line number, which makes it more complicated to parse.
Fix this by getting just the part with the source line:
...
screen line 6: '<reverse:1> return 0;<reverse:0> \
'
...
Tested on x86_64-linux.
|
|
While investigating using TERM=ansiw for freebsd, I also came across
TERM=ansis which unlike ansiw is present on both linux and freebsd.
Add initial support for TERM=ansi in tuiterm:
- handle ansis in Term::_have_bw
- add Term::_csi_x to support (well, ignore) DECREQTPARM
(Request Terminal Parameters)
This is sufficient to make the TUI testsuite pass on x86_64-freebsd.
|
|
The test-case gdb.tui/tui-layout-asm-short-prog.exp uses an assembly file
gdb.tui/tui-layout-asm-short-prog.S that it compiles using -nostdlib and
-nostartfiles.
However, on x86_64-linux the resulting executable still has dependencies on
libm and libc:
...
$ ldd outputs/gdb.tui/tui-layout-asm-short-prog/tui-layout-asm-short-prog
linux-vdso.so.1 (0x00007ffddf3ec000)
libm.so.6 => /lib64/libm.so.6 (0x00007f8b13406000)
libc.so.6 => /lib64/libc.so.6 (0x00007f8b13000000)
/lib64/ld-linux-x86-64.so.2 (0x00007f8b1350f000)
...
due -lm being added by default_target_compile.
On x86_64-freebsd, using -nostdlib and -nostartfiles in combination with -lm
causes the compilation to fail.
Fix this by using -static as well.
Tested on x86_64-linux and x86_64-freebsd.
|
|
On x86_64-freebsd, with test-case gdb.base/exprs.exp I get:
...
(gdb) print 23
yydebug: state 0, reading 257 (INT)
yydebug: state 0, shifting to state 1
yydebug: state 1, reducing by rule 94 (exp : INT)
yydebug: after reduction, shifting from state 0 to state 59
yydebug: state 59, reading 0 (end-of-file)
yydebug: state 59, reducing by rule 7 (exp1 : exp)
yydebug: after reduction, shifting from state 0 to state 60
yydebug: state 60, reducing by rule 1 (start : exp1)
yydebug: after reduction, shifting from state 0 to state 58
$220 = 23
(gdb) FAIL: gdb.base/exprs.exp: print with debugging
...
The test fails because it's not finding the string "Starting parse".
In this case, the .y files are processed used byacc. I suppose the testcase
matches the case that bison is used.
Fix this by grepping for something more generic: shift or Shift.
Tested on x86_64-linux and x86_64-freebsd.
|
|
There's no reason to have the compiler materialize objects onto the
stack. And there's also no reason to allow comb[] and name_table[] to be
modifiable.
|
|
There's no reason for riscv_all_supported_ext[] to appear in libbfd.so's
dynamic symbol table. There's also no reason for various pieces of data
to live in .data, when .data.rel.ro or even .rodata can do.
|
|
... and const. There's no reason to have the compiler copy anonymous
objects onto the stack. And there's also no reason to allow the arrays
to be modifiable.
|
|
The custom parsing done there and in one of its callers allowed various
bogus constructs to be accepted. Insist on a non-zero leading digit when
parsing numbers, don't lose upper bits, and insist on proper separation
of operands.
|
|
The values are all pretty small; one is even a boolean. No point in
wasting 32 bits for every one of the fields.
|
|
To be a fair global name space citizen, give it an aarch64_ prefix. In
two cases, drop a variable that's used only once.
|
|
After updating the documentation in commit cf03713dd1c ("[gdb/cli] Document
\001 and \002 usage for set prompt"), I started to wonder if I could reproduce
the CLI issue described in PR cli/28887 using the TUI.
That turned out not to be the case, but I noticed handling of the markers in
tui_puts and tui_puts_internal, and no test-case exercising this, so I
decided to add this.
After doing so in gdb.tui/color-prompt.exp, I realized I could use the same
code to test the CLI case.
Add test-case gdb.base/color-prompt.exp that shares code with
gdb.tui/color-prompt.exp in gdb.tui/color-prompt.exp.tcl.
For the CLI case, I was hoping to reproduce the behaviour described in the PR,
but it didn't trigger.
FTR, I manually reproduced the behaviour and used script to record it. I
observed the following sequence after the C-a:
- ^M (CR) : go to start of line
- ^[[K (EL) : erase line
- ^M (CR) : go to start of line
- ^[[31m(gdb) ^[[0m : output prompt
- some long command : output text
- ^M (CR) : go to start of line
- ^[[C, 15 times (CUF): cursor forward 15 times
giving me:
...
(gdb) some long command
^
...
Perhaps we'll trigger this on some other os, or once we start using a
different TERM value.
Tested on x86_64-linux.
|
|
In ppc64_sysv_abi_return_value I came across this if clause:
...
/* Small character arrays are returned, right justified, in r3. */
if (valtype->code () == TYPE_CODE_ARRAY
&& !valtype->is_vector ()
&& valtype->length () <= 8
&& valtype->target_type ()->code () == TYPE_CODE_INT
&& valtype->target_type ()->length () == 1)
...
I decided to write a test-case to try and trigger this.
AFAIU, in C/C++, we're not allowed to return an array, so I wrote an Ada
test-case instead, with a function returning this type:
...
type T is new String (1 .. 4);
...
After doing so I realized that the clause above is not triggering because
valtype->target_type ()->code () == TYPE_CODE_CHAR. Fix this by allowing
both TYPE_CODE_INT and TYPE_CODE_CHAR.
Then I realized that the specific "small character array" handling comes from
the v1 abi. Add a check for this as well.
Tested on ppc64le-linux, with v2 abi.
Approved-By: Simon Marchi <simon.marchi@efficios.com>
|
|
|
|
* ldlang.c: Don't include "elf-bfd.h" twice.
Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
|
|
It isn't needed anywhere except plugin.c. The typedef can disappear.
Also make a forward declaraion for ld_plugin_input_file in plugin.h
so that this header can be used without first including plugin-api.h.
bfd/
* plugin.h (struct ld_plugin_input_file): Forward declare.
(struct plugin_data_struct): Move to..
* plugin.c: ..here.
(add_symbols): Size plugin_data without using type.
* archive.c: Don't include plugin-api.h.
* elflink.c: Likewise.
* format.c: Likewise.
binutils/
* ar.c: Don't include plugin-api.h or ansidecl.h. Only
include plugin.h when BFD_SUPPORTS_PLUGINS.
* nm.c: Don't include plugin-api.h. Only include plugin.h
when BFD_SUPPORTS_PLUGINS.
* objcopy.c: Likewise.
ld/
* ldfile.c: Don't include plugin-api.h.
* ldmain.c: Likewise.
|
|
bfd/
* bfd.m4: Replace AC_TRY_COMPILE with AC_COMPILE_IFELSE.
binutils/
* configure.ac: Replace AC_TRY_COMPILE with AC_COMPILE_IFELSE.
gas/
* acinclude.m4: Replace AC_TRY_LINK with AC_LINK_IFELSE.
Replace AC_TRY_COMPILE with AC_COMPILE_IFELSE.
gprof/
* configure.ac: Replace AC_OUTPUT(file list) with
AC_CONFIG_FILES([file list])\nAC_OUTPUT.
libctf/
* configure.ac: Replace AC_TRY_LINK with AC_LINK_IFELSE.
opcodes/
* configure.ac: Replace AC_TRY_COMPILE with AC_COMPILE_IFELSE.
|
|
As defined by the enums amd64_regnum and i386_regnum the register
numbering starts at 0.
Defaults for register numbers are currently set to 0 which seems to
be the wrong default. Set them to -1 instead. Configure the right
register number if we find out it's supported in i386_gdbarch_init.
Similarly we don't have to set the num_*regname* variables to 0 in
i386_gdbarch_init, as it's already assigned to 0 by default.
Approved-By: Andrew Burgess <aburgess@redhat.com>
Approved-By: Simon Marchi <simon.marchi@efficios.com>
|
|
Import the following commits from GCC as of r16-3056-gca2169c65bd169:
0d0837df697 libiberty: disable logging of list content for doubly-linked list tests
|
|
There's a logic error in loongarch_relax_perform_deletes: when there's
not any delete operation of which the start address is strictly smaller
than the symbol address, splay_tree_predecessor() will return nullptr
and the symbol size will be unchanged even if some bytes of it are
removed.
Make the logic more complete to fix this issue. Also factor out the
symbol size adjustment logic into a function to avoid code bloating.
Tested-by: WANG Xuerui <git@xen0n.name>
Signed-off-by: Xi Ruoyao <xry111@xry111.site>
|
|
|
|
This reverts commit 14de1447c9c52c1bfc52588f8652836f66ac6c47.
An automated tester said that this patch caused a regression on
aarch64:
FAIL: gdb.arch/aarch64-atomic-inst.exp: Step through the ldxr/stxr sequence (timeout)
I looked into it a bit yesterday but couldn't see an obvious problem;
and it's somewhat of a pain to try to debug it at the moment.
Tom de Vries also noticed this and filed it in bugzilla. So, I'm
backing the patch out until I can port the failing test to the AdaCore
internal test suite in order to find out what went wrong.
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28440
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=33255
|
|
Fat IR objects contains both regular sections and IR sections. After
commit 717a38e9a02109fcbcb18bb2ec3aa251e2ad0a0d
Author: H.J. Lu <hjl.tools@gmail.com>
Date: Sun May 4 05:12:46 2025 +0800
strip: Add GCC LTO IR support
"strip --strip-debug" no longer strips debug sections in fat IR objects
since fat IR objects are recognized as plugin object and copied as unknown
objects. Add a is_strip_input field to bfd to indicate called from strip.
Update bfd_check_format_matches not to treat archive member nor standalone
fat IR object as IR object so that strip can remove debug and IR sections
in fat IR object. For archive member, it is copied as an unknown object
if the plugin target is in use or it is a slim IR object. For standalone
fat IR object, it is copied as non-IR object.
bfd/
PR binutils/33246
* archive.c: Include "plugin-api.h" and "plugin.h" if plugin is
enabled.
(_bfd_compute_and_write_armap): Don't complain plugin is needed
when the plugin target is in use.
* bfd-in2.h: Regenerated.
* bfd.c (bfd): Add is_strip_input.
* format.c (bfd_set_lto_type): If there is .llvm.lto section,
set LTO type to lto_fat_ir_object.
(bfd_check_format_matches): Don't set LTO type when setting
format. When called from strip, don't treat archive member nor
standalone fat IR object as an IR object.
* plugin.c (bfd_plugin_get_symbols_in_object_only): Copy LTO
type derived from input sections.
nm/
PR binutils/33246
* nm.c (filter_symbols): Don't complain plugin is needed when
the plugin target is in use.
(display_rel_file): Likewise.
* objcopy.c (copy_archive): Set the BFD is_strip_input field of
archive member to 1 to indicate called from strip. Also copy
slim IR archive member as unknown object.
(copy_file): Set the BFD is_strip_input field of input bfd to
1 to indicate called from strip.
(strip_main): Keep .gnu.debuglto_* sections unless all GCC LTO
sections will be removed.
ld/
PR binutils/33246
* testsuite/ld-plugin/lto-binutils.exp (run_pr33246_test): New.
Run binutils/33246 tests with GCC and Clang.
* testsuite/ld-plugin/pr33246.c: New file.
Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
|
|
|
|
Tidy changes to bfd_check_format_matches made by commit 9b854f169df9
which added a bfd_plugin_specified_p test and commit f752be8f916e
which added an lto_sections_removed arg. Both of these changes are
unnecessary if plugin_format is set to bfd_plugin_no before calling
bfd_check_format. bfd_plugin_no will prevent the plugin object_p
function from returning a match (and in the first case from a segfault
when loading plugins while a plugin is running). The plugin object_p
function already protected itself from recursive calls by setting
bfd_plugin_no before loading a plugin, but commit 9b854f169df9 opened
new bfds so they were unprotected.
It isn't strictly necessary to test for bfd_plugin_no in
bfd_check_format_matches but I kept the check to minimise functional
changes. Close inspection of the patch will notice I've added an
is_linker_input test too. That also isn't strictly necessary, I
think, but the match_count test was for the linker. See commit
999d6dff80fa.
PR 12291
PR 12430
PR 13298
PR 33198
bfd/
* format.c (bfd_check_format_lto): Revert to bfd_check_format.
(bfd_check_format_matches_lto): Revert to bfd_check_format_matches.
Correct comments. Manage both the lto_sections_removed and
bfd_plugin_specified_p cases by testing for bfd_plugin_no.
* plugin.c (bfd_plugin_get_symbols_in_object_only): Set
plugin_format to bfd_plugin_no before checking new bfds.
(try_load_plugin): Comment setting bfd_plugin_no.
(bfd_plugin_specified_p): Delete.
* plugin.h (bfd_plugin_specified_p): Delete.
* bfd-in2.h: Regenerate.
binutils/
* objcopy.c (copy_archive): Replace bfd_check_format_lto calls
with bfd_check_format using plugin_format set to bfd_plugin_no.
(check_format_object): New function.
(copy_file): Use it.
|
|
While trying out gccrs, I noticed that gdb_simple_compile does not use
the ".rs" extension for Rust sources. This patch fixes the problem,
which lets gccrs get a little further in the test suite.
|
|
Most code doesn't use cleanups any more, so remove the include of
cleanups.h from common-defs.h, and then only include that file where
it is truly needed.
Approved-By: Simon Marchi <simon.marchi@efficios.com>
|
|
The ANSI escape sequence translation layer in TUI mode strips italic
or underlined text modes silently. You cannot output text formatted
like that using `TuiWindow.write` in Python at the moment.
Parse the ANSI escape sequences for italic and underlined text into
the `ui_file_style` structure and apply it to the TUI window when
applying styles, similar to preserving the bold/dim state already.
A script like this shows italic and underlined text correctly now.
```python
import gdb
class TestTUIWindow:
_tui_window: gdb.TuiWindow
def __init__(self, tui_window: gdb.TuiWindow) -> None:
self._tui_window = tui_window
self._tui_window.title = "colors test"
def render(self) -> None:
self._tui_window.write("""
\x1b[4mThis is underlined.\x1b[24m And normal text.
\x1b[3mThis is italic.\x1b[23m And normal text.
""", True)
gdb.register_window_type("colortest", TestTUIWindow)
```
And launching it with
```
source the_above_script.py
tui new-layout test colortest 1 cmd 1
layout test
```
Approved-By: Tom Tromey <tom@tromey.com>
|
|
|
|
On x86_64-freebsd, with test-case gdb.base/style.exp I run into:
...
(gdb) print $_colorsupport
[36;49;22;27m$1[m = "monochrome"
(gdb) FAIL: $exp: colorsupport_8color: color support is 8 color
...
Fix this by applying the same fix as for tuiterm: use TERM=ansiw instead of
TERM=ansi for bsd, getting us instead:
...
(gdb) print $_colorsupport
[36;49;22;27m$1[m = "monochrome,ansi_8color"
(gdb) PASS: $exp: colorsupport_8color: color support is 8 color
...
Tested on x86_64-freebsd.
|
|
This patch gives gdbserver the ability to omit the 's' reply to
'vCont?'. This tells gdb that hardware single-step is definitely not
supported, causing it to fall back to using software single-step.
This is useful for testing the earlier change to
maybe_software_singlestep.
Approved-By: Andrew Burgess <aburgess@redhat.com>
|
|
When the PikeOS osabi sniffer was added, Pedro suggested that a target
could omit stepping from its vCont? reply packet to tell gdb that
software single-step must be used:
https://sourceware.org/legacy-ml/gdb-patches/2018-09/msg00312.html
This patch implements this idea by moving the call to
target_can_do_single_step into maybe_software_singlestep.
I've also removed some FIXME comments from gdbarch_components.py, and
slightly updated the documentation for gdbarch_software_single_step.
I think these comments are somewhat obsolete now that
target_can_do_single_step exists -- the current approach isn't exactly
what the comments intended, but on the other hand, it exists and
works.
Following review comments from Andrew, this version changes
record-full to use maybe_software_singlestep, and then combines
maybe_software_singlestep with insert_single_step_breakpoint.
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28440
|
|
|
|
Make the windres testing both parse .rc files to binary and back
again. It's not possible to compare against the original .rc file
unfortunately, but at least this checks for the segfault fixed by
commit 891d1654d731.
PR 33244
* testsuite/binutils-all/windres/psql.rc: New file.
* testsuite/binutils-all/windres/windres.exp: Do a -J res
-O rc conversion too. Correct verbose message.
|
|
|
|
|
|
Commit c6c8d0b82175 went completely the wrong way. "key" needs to be
NULL as that reads a different type of data.
PR 33244
* resbin.c (get_version_header): Don't pass a NULL key on to
toosmall.
(bin_to_res_version): Restore NULL key cases.
|
|
|
|
|
|
Both tst-gmon-gprof.sh and tst-gmon-gprof-l.sh generate gmon.out and
process it. Run tst-gmon-gprof-l.sh after tst-gmon-gprof.sh to avoid
the race condition.
* testsuite/Makefile.am (tst-gmon-gprof-l.out): Depend on
tst-gmon-gprof.out.
* testsuite/Makefile.in: Regenerated.
Signed-off-by: H.J. Lu <hjl.tools@gmail.com>
|
|
Update gdbserver to use getopt_long for argument processing. This
turned out to be easier than I expected.
Interesting parts of this patch are:
I pass '+' as the OPTSTRING to getopt_long, this prevents getopt_long
from reordering the contents of ARGV. This is needed so that things
like this will work:
gdbserver :54321 program --arg1 --arg2
Without the '+', getopt_long will reorder ARGV, moving '--arg1' and
'--arg2' forward and handling them as arguments to gdbserver.
Because of this (not reordering) and to maintain backward
compatibility, we retain a special case to deal with '--attach' which
can appear after the PORT, like this:
gdbserver :54321 --attach PID
I did consider adding a warning to this special case, informing the
user that placing --attach after the PORT was deprecated, but in the
end I didn't want to really change the behaviour as part of this
commit, so I've left that as an optional change for the future.
The getopt_long function supports two value passing forms, there is
'--option=value', and also '--option value'. Traditionally, gdbserver
only supports the first of these. To maintain this behaviour, after
the call to getopt_long, I spot if '--option value' was used, and if
so, modify the state so that it seems that no value was passed, and
that 'value' is the next ARGV entry to be parsed. We could, possibly,
remove this code in the future, but that would be a functional change,
which is not something I want in this commit.
Handling of "-" for stdio connection has now moved out of the argument
processing loop as '-' isn't considered a valid option by getopt_long,
this is an improvement as all PORT handling is now in one place.
I've tried as much as possible to leave user visible functionality
unchanged after this commit, and as far as I can tell from testing,
nothing has changed.
Approved-By: Tom Tromey <tom@tromey.com>
|
|
When using the command:
$ gdbserver --disable-packet
gdbserver lists all the packets that can be disabled, and then exits.
I think that this output is a helpful error message that is printed
when the user has forgotten to entry a packet name. We get similar
output if we run the command:
$ gdbserver --disable-packet=foo
where gdbserver tells us that 'foo' is invalid, and then lists the
packets that we can use.
The difference is that, in the first case, gdbserver exits with a code
of 0, and in the second, gdbserver exits with a code of 1.
I think both these cases should exit with a code of 1.
With the exception of '--help' and '--version', where we are asking
gdbserver to print some message then exit (which are, and should exit
with a code of 0), in all other cases where we do an early exit, I
think this is an indication that the user has done something
wrong (entered and invalid argument, or missed an argument value), and
gdbserver should exit with a non-zero exit code to indicate this.
This commit updates the exit code in the above case from 0 to 1.
Approved-By: Tom Tromey <tom@tromey.com>
|
|
Within gdbserver/server.cc, in captured_main, convert some locals to
bool. Move the declaration of some locals into the body of the
function.
There should be no user visible changes after this commit.
Approved-By: Tom Tromey <tom@tromey.com>
|