Compare commits

...

150 Commits

Author SHA1 Message Date
Joel Brobecker
140ba011c0 Set GDB version number to 16.3.
This commit changes gdb/version.in to 16.3.
2025-04-20 10:22:06 -07:00
GDB Administrator
788edd470b Automatic date update in version.in 2025-04-20 00:01:45 +00:00
GDB Administrator
ec46e2ce7a Automatic date update in version.in 2025-04-19 00:01:13 +00:00
GDB Administrator
a74df132e3 Automatic date update in version.in 2025-04-18 00:01:40 +00:00
GDB Administrator
6c82a55780 Automatic date update in version.in 2025-04-17 00:00:43 +00:00
GDB Administrator
055279c914 Automatic date update in version.in 2025-04-16 00:01:15 +00:00
GDB Administrator
f92a904726 Automatic date update in version.in 2025-04-15 00:01:28 +00:00
GDB Administrator
3c2c00c32a Automatic date update in version.in 2025-04-14 00:00:41 +00:00
GDB Administrator
5eed5758ae Automatic date update in version.in 2025-04-13 00:00:38 +00:00
GDB Administrator
ebf7dd0ed8 Automatic date update in version.in 2025-04-12 00:00:43 +00:00
GDB Administrator
1936dc6a64 Automatic date update in version.in 2025-04-11 00:01:08 +00:00
GDB Administrator
6ce88ba61e Automatic date update in version.in 2025-04-10 00:01:13 +00:00
GDB Administrator
1549d0525b Automatic date update in version.in 2025-04-09 00:00:42 +00:00
GDB Administrator
565ad7474c Automatic date update in version.in 2025-04-08 00:01:17 +00:00
Keith Seitz
a7abbebc6d gstack: [downstream regression] Output file names and line numbers
With commit fb2ded33c1, I added
Fedora's gstack script to gdb.  Some issues have arisen since
then, and this patch addresses those issues:

. As Sam James recently noted[1], PKGVERSION and VERSION
  need to be quoted.
. A Fedora user reported the misuse of --readnever, which
  causes gstack to omit filename and line number information in the
  backtrace[Red Hat BZ 2354997].

[1] https://inbox.sourceware.org/gdb-patches/d19d6bc17e0a160ce27fc572079f11a587c0e168.1742424869.git.sam@gentoo.org/
Bug: https://bugzilla.redhat.com/show_bug.cgi?id=2354997
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=32828
2025-04-07 08:40:56 -07:00
Luis Machado
4ffff8e30b Fix build failure for gdbserver's raw_compare self test
Commit 5c89e5539a addressed a SVE/SME gdbserver
crash on gdbserver and added a gdbserver-side self test for a register cache
raw_compare function.

For the GDB 16 branch though, gdbserver's regcache doesn't yet have a
constructor taking a target description, so we need to explicitly initialize
the register cache before the self test can take place.

Also, the self tests are only built if we explicitly pass --enable-unit-tests
to configure. This build error should not manifest on a default build that
doesn't enable self tests.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=32775

Reviewed-By: Keith Seitz <keiths@redhat.com>
Approved-By: Andrew Burgess <aburgess@redhat.com>
2025-04-07 15:18:43 +01:00
GDB Administrator
0a363b10a1 Automatic date update in version.in 2025-04-07 00:00:52 +00:00
GDB Administrator
3348e9233b Automatic date update in version.in 2025-04-06 00:00:42 +00:00
GDB Administrator
b61f17e695 Automatic date update in version.in 2025-04-05 00:00:52 +00:00
GDB Administrator
d195670d47 Automatic date update in version.in 2025-04-04 00:00:48 +00:00
GDB Administrator
da5c8de5b0 Automatic date update in version.in 2025-04-03 00:00:34 +00:00
Luis Machado
5c89e5539a Fix gdbserver crashes on SVE/SME-enabled systems
Commit 51e6b8cfd6 fixed a
regression for SVE/SME registers on gdb's side by using a <= comparison for
regcache's raw_compare assertion check. We seem to have failed to do the same
for gdbserver's raw_compare counterpart.

With the code as it is, I'm seeing a lot of crashes for gdbserver on a machine
with SVE enabled. For instance, with the following invocation:

make check-gdb RUNTESTFLAGS="--target_board=native-gdbserver" TESTS=gdb.base/break.exp

Running /work/builds/binutils-gdb/gdb/testsuite/../../../../repos/binutils-gdb/gdb/testsuite/gdb.base/break.exp ...
FAIL: gdb.base/break.exp: test_break: run until function breakpoint
FAIL: gdb.base/break.exp: test_break: run until breakpoint set at a line number (the program is no longer running)
FAIL: gdb.base/break.exp: test_break: run until file:function(6) breakpoint (the program is no longer running)
FAIL: gdb.base/break.exp: test_break: run until file:function(5) breakpoint (the program is no longer running)
FAIL: gdb.base/break.exp: test_break: run until file:function(4) breakpoint (the program is no longer running)
FAIL: gdb.base/break.exp: test_break: run until file:function(3) breakpoint (the program is no longer running)
FAIL: gdb.base/break.exp: test_break: run until file:function(2) breakpoint (the program is no longer running)
FAIL: gdb.base/break.exp: test_break: run until file:function(1) breakpoint (the program is no longer running)
FAIL: gdb.base/break.exp: test_break: run until quoted breakpoint (the program is no longer running)
FAIL: gdb.base/break.exp: test_break: run until file:linenum breakpoint (the program is no longer running)
FAIL: gdb.base/break.exp: test_break: breakpoint offset +1
FAIL: gdb.base/break.exp: test_break: step onto breakpoint (the program is no longer running)
FAIL: gdb.base/break.exp: test_break: setting breakpoint at }
FAIL: gdb.base/break.exp: test_break: continue to breakpoint at } (the program is no longer running)
FAIL: gdb.base/break.exp: test_no_break_on_catchpoint: runto: run to main
FAIL: gdb.base/break.exp: test_break_nonexistent_line: runto: run to main
FAIL: gdb.base/break.exp: test_break_default: runto: run to main
FAIL: gdb.base/break.exp: test_break_silent_and_more: runto: run to main
FAIL: gdb.base/break.exp: test_break_line_convenience_var: runto: run to main
FAIL: gdb.base/break.exp: test_break_user_call: runto: run to main
FAIL: gdb.base/break.exp: test_finish_arguments: runto: run to main
FAIL: gdb.base/break.exp: test_next_with_recursion: kill program
FAIL: gdb.base/break.exp: test_next_with_recursion: run to factorial(6)
FAIL: gdb.base/break.exp: test_next_with_recursion: continue to factorial(5) (the program is no longer running)
FAIL: gdb.base/break.exp: test_next_with_recursion: backtrace from factorial(5)
FAIL: gdb.base/break.exp: test_next_with_recursion: next to recursive call (the program is no longer running)
FAIL: gdb.base/break.exp: test_next_with_recursion: next over recursive call (the program is no longer running)
FAIL: gdb.base/break.exp: test_next_with_recursion: backtrace from factorial(5.1)
FAIL: gdb.base/break.exp: test_next_with_recursion: continue until exit at recursive next test (the program is no longer running)
FAIL: gdb.base/break.exp: test_break_optimized_prologue: run until function breakpoint, optimized file
FAIL: gdb.base/break.exp: test_break_optimized_prologue: run until breakpoint set at small function, optimized file (the program is no longer running)
FAIL: gdb.base/break.exp: test_rbreak_shlib: rbreak junk

Adjusting the regcache raw_compare assertion check to use <= fixes
the problem on aarch64-linux on a SVE-capable system.

This patch also adds a simple selftest to gdbserver that validates this
particular case by simulating a raw_compare operation.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=32775

Approved-By: Simon Marchi <simon.marchi@efficios.com>
2025-04-02 17:07:14 +01:00
Andrew Burgess
a2c8f78df5 gdb: allow selecting default fg/bg colors in tui mode
This commit fixes PR gdb/32797, and pulls in just part of commit:

  commit 6447969d0a
  Date:   Sat Oct 5 22:27:44 2024 +0300

    Add an option with a color type.

to the gdb-16-branch.

This commit allows the escape sequences \x1b[39m and \x1b[49m, which
select the default foreground and background colours respectively, to
work correctly.

This fix is just a small part of the above commit.  Only these two
changes are required to fix this bug.  As we are currently preparing
for a 16.3 release, I don't think we should be pulling in the whole of
the above commit.

You can test this commit using:

  export TERM=xterm-256color
  gdb -q -tui -ex 'py print("normal\n\x1b[39mforeground default\n\x1b[0mnormal\n\x1b[49mbackground default\n\x1b[0mnormal\n")'

All of the output text should use the default foreground and
background colors.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=32797

Approved-By: Tom Tromey <tom@tromey.com>
2025-04-02 16:11:24 +01:00
GDB Administrator
bc997150d8 Automatic date update in version.in 2025-04-02 00:00:39 +00:00
GDB Administrator
27d7403d46 Automatic date update in version.in 2025-04-01 00:01:06 +00:00
GDB Administrator
f3ecdb73cd Automatic date update in version.in 2025-03-31 00:00:46 +00:00
GDB Administrator
9c3d1bb4c8 Automatic date update in version.in 2025-03-30 00:00:26 +00:00
GDB Administrator
24c91baf98 Automatic date update in version.in 2025-03-29 00:01:30 +00:00
Craig Blackmore
c295d55246 gdb: Fix assertion failure when inline frame #0 is duplicated
Modifying inline-frame-cycle-unwind.exp to use `bt -no-filters` produces
the following incorrect backtrace:

  #0  inline_func () at .../gdb/gdb/testsuite/gdb.base/inline-frame-cycle-unwind.c:49
  #1  normal_func () at .../gdb/gdb/testsuite/gdb.base/inline-frame-cycle-unwind.c:32
  #2  0x000055555555517f in inline_func () at .../gdb/gdb/testsuite/gdb.base/inline-frame-cycle-unwind.c:50
  #3  normal_func () at .../gdb/gdb/testsuite/gdb.base/inline-frame-cycle-unwind.c:32
  Backtrace stopped: previous frame identical to this frame (corrupt stack?)
  (gdb) FAIL: gdb.base/inline-frame-cycle-unwind.exp: cycle at level 1: backtrace when the unwind is broken at frame 1

The expected output, which we get with `bt`, is:

  #0  inline_func () at .../gdb/gdb/testsuite/gdb.base/inline-frame-cycle-unwind.c:49
  #1  normal_func () at .../gdb/gdb/testsuite/gdb.base/inline-frame-cycle-unwind.c:32
  Backtrace stopped: previous frame identical to this frame (corrupt stack?)
  (gdb) PASS: gdb.base/inline-frame-cycle-unwind.exp: cycle at level 1: backtrace when the unwind is broken at frame 1

The cycle checking in `get_prev_frame_maybe_check_cycle` relies on newer
frame ids having already been computed and stashed.  Unlike other
frames, frame #0's id does not get computed immediately.

The test passes with `bt` because when applying python frame filters,
the call to `bootstrap_python_frame_filters` happens to compute the id
of frame #0.  When `get_prev_frame_maybe_check_cycle` later tries to
stash frame #2's id, the cycle is detected.

The test fails with `bt -no-filters` because frame #0's id has not been
stashed by the time `get_prev_frame_maybe_check_cycle` tries to stash
frame #2's id which succeeds and the cycle is only detected later when
trying to stash frame #4's id.  Doing `stepi` after the incorrect
backtrace would then trigger an assertion failure when trying to stash
frame #0's id because it is a duplicate of #2's already stashed id.

In `get_prev_frame_always_1`, if this_frame is inline frame 0, then
compute and stash its frame id before returning the previous frame.
This ensures that the id of inline frame 0 has been stashed before
`get_prev_frame_maybe_check_cycle` is called on older frames.

The test case has been updated to run both `bt` and `bt -no-filters`.

Co-authored-by: Andrew Burgess <aburgess@redhat.com>
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=32757
2025-03-28 09:57:18 +00:00
GDB Administrator
66150ea536 Automatic date update in version.in 2025-03-28 00:00:37 +00:00
GDB Administrator
0c09aa22ee Automatic date update in version.in 2025-03-27 00:00:33 +00:00
GDB Administrator
b9a7fda110 Automatic date update in version.in 2025-03-26 00:00:51 +00:00
GDB Administrator
21c21807a3 Automatic date update in version.in 2025-03-25 00:00:36 +00:00
GDB Administrator
67e9e439f7 Automatic date update in version.in 2025-03-24 00:01:22 +00:00
GDB Administrator
dcf6d684ce Automatic date update in version.in 2025-03-23 00:01:09 +00:00
GDB Administrator
639b6f1055 Automatic date update in version.in 2025-03-22 00:01:34 +00:00
GDB Administrator
a1bcf87a5f Automatic date update in version.in 2025-03-21 00:01:18 +00:00
GDB Administrator
883f7d18d1 Automatic date update in version.in 2025-03-20 00:00:59 +00:00
GDB Administrator
b4b7d9f112 Automatic date update in version.in 2025-03-19 00:01:50 +00:00
GDB Administrator
f45379953a Automatic date update in version.in 2025-03-18 00:01:12 +00:00
GDB Administrator
d6e18cff1d Automatic date update in version.in 2025-03-17 00:01:53 +00:00
GDB Administrator
3ee680f9eb Automatic date update in version.in 2025-03-16 00:01:13 +00:00
Tom de Vries
5bc76dc8d4 [gdb/tdep] Rewrite i386_canonicalize_syscall
On openSUSE Tumbleweed x86_64, with target board unix/-m32 and test-case
gdb.reverse/recvmsg-reverse.exp, I run into:
...
(gdb) continue^M
Continuing.^M
Process record and replay target doesn't support syscall number 360^M
Process record: failed to record execution log.^M
^M
Program stopped.^M
0xf7fc5575 in __kernel_vsyscall ()^M
(gdb) FAIL: $exp: continue to breakpoint: marker2
...

The syscall number 360 in i386 is for syscall socketpair, as we can see in
arch/x86/entry/syscalls/syscall_32.tbl:
...
<number>  <abi>  <name>      <entry point>
360       i386   socketpair  sys_socketpair
...

Function i386_canonicalize_syscall assumes that any syscall below 500 maps to
an identically valued enum in enum gdb_syscall:
...
static enum gdb_syscall
i386_canonicalize_syscall (int syscall)
{
  enum { i386_syscall_max = 499 };

  if (syscall <= i386_syscall_max)
    return (enum gdb_syscall) syscall;
  else
    return gdb_sys_no_syscall;
}
...

However, that's not the case.  The value of gdb_sys_socketpair is not 360,
but 512:
...
enum gdb_syscall {
  ...
  gdb_sys_getrandom = 355,
  gdb_sys_statx = 383,
  ...
  gdb_sys_socketpair = 512,
...

Consequently, when record_linux_system_call is called with
syscall == i386_canonicalize_syscall (360), we hit the default case here:
....
  switch (syscall)
    {
    ...
    default:
      gdb_printf (gdb_stderr,
                  _("Process record and replay target doesn't "
                    "support syscall number %d\n"), syscall);
      return -1;
      break;
    }
...
rather than hitting the case for gdb_sys_socketpair.

I initially wrote a trivial fix for this, changing the value of
gdb_sys_socketpair to 360.  However, Andreas Schwab pointed out that there are
other functions (ppc_canonicalize_syscall and s390_canonicalize_syscall) that
make assumptions about specific values of enum gdb_syscall, and fixing this
for i386 may break things for ppc or s390.

So instead, I decided to rewrite i386_canonicalize_syscall to match the
approach taken in aarch64_canonicalize_syscall, which allows
gdb_sys_socketpair to keep the same value.

So, fix this by:
- adding a new table file gdb/i386-syscalls.def, using a SYSCALL entry for
  each syscall, generated from arch/x86/entry/syscalls/syscall_32.tbl,
- using gdb/i386-syscalls.def to define enum i386_syscall, and
- using macros SYSCALL_MAP, SYSCALL_MAP_RENAME and UNSUPPORTED_SYSCALL_MAP to
  define the mapping from enum i386_syscall to enum gdb_syscall in
  i386_canonicalize_syscall.

I've created the mapping as follows:
- I used arch/x86/entry/syscalls/syscall_32.tbl to generate an initial mapping
  using SYSCALL_MAP for each syscall,
- I attempted to compile this and used the compilation errors about
  non-existing gdb_sys_ values to change those entries to
  UNSUPPORTED_SYSCALL_MAP, which got me a compiling version,
- I reviewed the UNSUPPORTED_SYSCALL_MAP entries, changing to
  SYSCALL_MAP_RENAME where necessary,
- I then reviewed syscalls below 500 that mapped to a gdb_syscall value below
  500, but not the same, and fixed those using SYSCALL_MAP_RENAME, and
- reviewed the mapping for gdb_syscall entries >= 500.

On the resulting mapping, I was able to do the following sanity check:
...
  for (int i = 0; i < 500; ++i)
    {
      int res = i386_canonicalize_syscall (i);
      if (res == i)
	continue;
      if (res == -1)
	continue;
      if (res >= 500)
	continue;
      gdb_assert_not_reached ("");
    }
}
...
to make sure that any syscall below 500 either:
- maps to the same number,
- is unsupported, or
- maps to a number >= 500.

Coming back to our original problem, the socket pair syscall is addressed by
an entry:
...
      SYSCALL_MAP (socketpair);
...
which maps i386_sys_socketpair (360) to gdb_sys_socketpair (512).

Tested on x86_64-linux with target board unix/-m32.

Approved-By: Guinevere Larsen <guinevere@redhat.com>

PR tdep/32770
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=32770

(cherry picked from commit fbfb29b304)
2025-03-15 13:17:36 +01:00
GDB Administrator
0230950c6e Automatic date update in version.in 2025-03-15 00:01:04 +00:00
GDB Administrator
7a6ff0051f Automatic date update in version.in 2025-03-14 00:01:23 +00:00
Tom de Vries
55b7a56b1f [gdb/record] Fix out-of-bounds write in aarch64_record_asimd_load_store
After compiling gdb with -fstack-protector-all, and running test-case
gdb.reverse/getrandom.exp on aarch64-linux, we run into
"Stack smashing detected" in function aarch64_record_asimd_load_store.

This is reported in PR record/32784.

This happens due to an out-of-bounds write to local array record_buf_mem:
...
  uint64_t record_buf_mem[24];
...
when recording insn:
...
B+>0xfffff7ff4d10  st1     {v0.16b-v3.16b}, [x0]
...

We can fix this by increasing the array size to 128, but rather than again
hardcoding a size, reimplement record_buf_mem as std::vector.

Tested on aarch64-linux.

Approved-By: Guinevere Larsen <guinevere@redhat.com>

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=32784
(cherry picked from commit 51729ea090)
2025-03-13 11:15:05 +01:00
GDB Administrator
465465ce9c Automatic date update in version.in 2025-03-13 00:00:41 +00:00
GDB Administrator
b4d832ef2b Automatic date update in version.in 2025-03-12 00:01:24 +00:00
GDB Administrator
5f2f9d4dcc Automatic date update in version.in 2025-03-11 00:01:15 +00:00
Simon Marchi
4996027dbf gdb/dwarf: save DWARF version in dwarf2_loclist_baton, remove it from dwarf2_per_cu
When running:

    $ make check TESTS="gdb.cp/cpexprs-debug-types.exp" RUNTESTFLAGS="--target_board=fission"

I get:

    (gdb) break -qualified main
    /home/smarchi/src/binutils-gdb/gdb/dwarf2/read.h:295: internal-error: version: Assertion `m_dwarf_version != 0' failed.

The problem is that dwarf2_per_cu objects created in the
read_cutu_die_from_dwo code path never have their DWARF version set.  A
seemingly obvious solution would be to add a call to
dwarf2_per_cu::set_version in there (there's a patch in the referenced
PR that does that).  However, this comment in
read_comp_units_from_section is a bit scary:

      /* Init this asap, to avoid a data race in the set_version in
	 cutu_reader::cutu_reader (which may be run in parallel for the cooked
	 index case).  */
      this_cu->set_version (cu_header.version);

I don't know if a DWO file can be read while the cooked indexer runs, so
if it would be a problem here, but I prefer to be safe than sorry.  This
patch side-steps the problem by deleting the DWARF version from
dwarf2_per_cu.

The only users of dwarf2_per_cu::version are the loclists callbacks in
`loc.c`.  Add the DWARF version to dwarf2_loclist_baton and modify those
callbacks to get the version from there instead.  Initialize that new
field in fill_in_loclist_baton.

I like this approach because there is no version field that is possibly
unset now.

I wasn't keen on doing this at first because I thought it would waste
space, but the dwarf2_loclist_baton has 7 bytes of padding at the end
anyway, so we might as well use that.

Cc: Ricky Zhou <ricky@rzhou.org>
Cc: Tom de Vries <tdevries@suse.de>
Cc: Tom Tromey <tom@tromey.com>
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=32309
Change-Id: I30d4ede7d67da5d80ff65c6122f5868e1098ec52
Approved-By: Tom Tromey <tom@tromey.com>
(cherry picked from commit f62cf22157)
2025-03-10 16:24:47 -04:00
GDB Administrator
fbc36742f7 Automatic date update in version.in 2025-03-10 00:00:42 +00:00
Brandon Belew
ebb9d77f35 Fix segfault if target_fileio_read_alloc fails
Check for target_fileio_read_alloc failure in linux_fill_prpsinfo
before dereferencing buffer. This fixes a segfault in the 'gcore'
command when attached to certain remote targets.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=32441
Approved-By: Andrew Burgess <aburgess@redhat.com>
(cherry picked from commit cbc6950a66)
2025-03-09 08:17:55 +04:00
GDB Administrator
94f97a3cdd Automatic date update in version.in 2025-03-09 00:01:12 +00:00
GDB Administrator
96f3f01d9d Automatic date update in version.in 2025-03-08 00:00:36 +00:00
GDB Administrator
8bdaecde02 Automatic date update in version.in 2025-03-07 00:00:49 +00:00
GDB Administrator
fa315f8c30 Automatic date update in version.in 2025-03-06 00:01:03 +00:00
GDB Administrator
a5bfad18c4 Automatic date update in version.in 2025-03-05 00:01:28 +00:00
GDB Administrator
de2c17ad1d Automatic date update in version.in 2025-03-04 00:01:35 +00:00
GDB Administrator
fdf8666844 Automatic date update in version.in 2025-03-03 00:01:14 +00:00
GDB Administrator
7aef96f044 Automatic date update in version.in 2025-03-02 00:00:57 +00:00
GDB Administrator
26f7f82058 Automatic date update in version.in 2025-03-01 00:00:41 +00:00
GDB Administrator
56e453742e Automatic date update in version.in 2025-02-28 00:00:28 +00:00
GDB Administrator
0674100e37 Automatic date update in version.in 2025-02-27 00:01:38 +00:00
GDB Administrator
636e85837a Automatic date update in version.in 2025-02-26 00:00:45 +00:00
GDB Administrator
09774db4f0 Automatic date update in version.in 2025-02-25 00:00:45 +00:00
GDB Administrator
7ea5b42758 Automatic date update in version.in 2025-02-24 00:00:42 +00:00
GDB Administrator
db69753580 Automatic date update in version.in 2025-02-23 00:01:45 +00:00
GDB Administrator
15672434ec Automatic date update in version.in 2025-02-22 00:01:08 +00:00
GDB Administrator
de09906181 Automatic date update in version.in 2025-02-21 00:01:32 +00:00
GDB Administrator
397f62b9d9 Automatic date update in version.in 2025-02-20 00:01:26 +00:00
GDB Administrator
e4ec026513 Automatic date update in version.in 2025-02-19 00:00:48 +00:00
GDB Administrator
bd6f05164f Automatic date update in version.in 2025-02-18 00:01:32 +00:00
GDB Administrator
6d52d7b146 Automatic date update in version.in 2025-02-17 00:00:34 +00:00
GDB Administrator
398b42317e Automatic date update in version.in 2025-02-16 00:01:03 +00:00
GDB Administrator
5429f87550 Automatic date update in version.in 2025-02-15 00:00:40 +00:00
GDB Administrator
944e553674 Automatic date update in version.in 2025-02-14 00:00:47 +00:00
GDB Administrator
d6762792f7 Automatic date update in version.in 2025-02-13 00:01:19 +00:00
GDB Administrator
5baddddfbe Automatic date update in version.in 2025-02-12 00:00:36 +00:00
GDB Administrator
9ef9fb511f Automatic date update in version.in 2025-02-11 00:00:46 +00:00
GDB Administrator
6e3384d4cc Automatic date update in version.in 2025-02-10 00:01:05 +00:00
GDB Administrator
5a14f9e79a Automatic date update in version.in 2025-02-09 00:00:39 +00:00
Andrew Burgess
2b646bb876 gdb/tui: use wrefresh if output is not surpressed
Recent work in the TUI has improved GDB's use of the curses
wnoutrefresh and doupdate mechanism, which improves performance by
batching together updates and then doing a single set of writes to the
screen when doupdate is finally called.

The tui_batch_rendering type is a RAII class which, in its destructor,
calls doupdate to send the batched updates to the screen.

However, if there is no tui_batch_rendering active on the call stack
then any wnoutrefresh calls will remain batched but undisplayed until
the next time doupdate happens to be called.

This problem can be seen in PR gdb/32623.  When an inferior is started
the 'Starting program' message is not immediately displayed to the
user.

The 'Starting program' message originates from run_command_1 in
infcmd.c, the message is sent to the current_uiout, which will be the
TUI ui_out.  After the message is sent, ui_out::flush() is called,
here's the backtrace when that happens:

  #0  tui_file::flush (this=0x36e4ab0) at ../../src/gdb/tui/tui-file.c:42
  #1  0x0000000001004f4b in pager_file::flush (this=0x36d35f0) at ../../src/gdb/utils.c:1531
  #2  0x0000000001004f71 in gdb_flush (stream=0x36d35f0) at ../../src/gdb/utils.c:1539
  #3  0x00000000006975ab in cli_ui_out::do_flush (this=0x35a50b0) at ../../src/gdb/cli-out.c:250
  #4  0x00000000009fd1f9 in ui_out::flush (this=0x35a50b0) at ../../src/gdb/ui-out.h:263
  #5  0x00000000009f56ad in run_command_1 (args=0x0, from_tty=1, run_how=RUN_NORMAL) at ../../src/gdb/infcmd.c:449
  #6  0x00000000009f599a in run_command (args=0x0, from_tty=1) at ../../src/gdb/infcmd.c:511

And if we check out tui_file::flush (tui-file.c) we can see that this
just calls tui_win_info::refresh_window(), which in turn, just uses
wnoutrefresh to batch any pending output.

The problem is that, in the above backtrace, there is no
tui_batch_rendering active, and so there will be no doupdate call to
flush the output to the screen.

We could add a tui_batch_rendering into tui_file::flush.  And
tui_file::write.  And tui_file::puts .....

... but that all seems a bit unnecessary.  Instead, I propose that
tui_win_info::refresh_window() should be changed.  If suppress_output
is true (i.e. a tui_batch_rendering is active) then we should continue
to call wnoutrefresh().  But if suppress_output is false, meaning that
no tui_batch_rendering is in place, then we should call wrefresh(),
which immediately writes the output to the screen.

Testing but PR gdb/32623 was a little involved.  We need to 'run' the
inferior and check for the 'Starting program' message.  But DejaGNUU
can only check for the message once it knows the message should have
appeared.  But, as the bug is that output is not displayed, we don't
have any output hints that the inferior is started yet...

In the end, I have the inferior create a file in the test's output
directory.  Now DejaGNU can send the 'run' command, and wait for the
file to appear.  Once that happens, we know that the 'Starting
program' message should have appeared.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=32623

Approved-By: Tom Tromey <tom@tromey.com>
2025-02-08 19:49:07 +00:00
GDB Administrator
655703fa8d Automatic date update in version.in 2025-02-08 00:00:20 +00:00
Tom de Vries
2fc5610642 [gdb/corefiles] Fix segfault in core_target_open
On x86_64-freebsd, with test-case gdb.arch/i386-biarch-core.exp I run into a
segfault here in corelow.c:core_target_open:
...
    {
      gdb::unique_xmalloc_ptr<char> failing_command = make_unique_xstrdup
        (bfd_core_file_failing_command (current_program_space->core_bfd ()));
      if (failing_command != nullptr)
        gdb_printf (_("Core was generated by `%s'.\n"),
                    failing_command.get ());
    }
...
where bfd_core_file_failing_command returns nullptr, so the segfault happens
somewhere during "strdup (nullptr)".

There doesn't seem to be a need to make a copy of the string, so fix this by
dropping the make_unique_xstrdup.

Tested on x86_64-linux.
Tested the test-case on x86_64-freebsd.

Approved-By: Tom Tromey <tom@tromey.com>

PR corefiles/32634
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=32634

(cherry picked from commit 9dd3d66b79)
2025-02-07 17:06:30 +01:00
GDB Administrator
8d4e87af56 Automatic date update in version.in 2025-02-07 00:00:39 +00:00
GDB Administrator
74023881d2 Automatic date update in version.in 2025-02-06 00:01:00 +00:00
GDB Administrator
3dd94eccf6 Automatic date update in version.in 2025-02-05 00:00:34 +00:00
GDB Administrator
e649750353 Automatic date update in version.in 2025-02-04 00:01:22 +00:00
GDB Administrator
1c3834732b Automatic date update in version.in 2025-02-03 00:01:20 +00:00
GDB Administrator
82874bd707 Automatic date update in version.in 2025-02-02 00:01:13 +00:00
Joel Brobecker
39330efedd Bump GDB's version number to 16.2.90.DATE-git.
This commit changes gdb/version.in to 16.2.90.DATE-git.

This commit also makes the following changes in gdb/testsuite:

	* gdb.base/default.exp: Change $_gdb_minor to 3.
2025-02-01 14:28:15 +04:00
Joel Brobecker
50b1dcab86 Set GDB version number to 16.2.
This commit changes gdb/version.in to 16.2.
2025-02-01 14:14:31 +04:00
GDB Administrator
9f5c7b01ea Automatic date update in version.in 2025-02-01 00:00:31 +00:00
GDB Administrator
06f68b9c9a Automatic date update in version.in 2025-01-31 00:01:41 +00:00
GDB Administrator
a31b440834 Automatic date update in version.in 2025-01-30 00:02:03 +00:00
Simon Marchi
da48c9e23a gdb: include cli/cli-style.h in darwin-nat.c
PR 32610 says:

  File gdb/darwin-nat.c is missing an #include statement of
  "cli/cli-style.h". It is needed because there is a reference to class
  object command_style in the .c file.

I'm not able to build-test this change (I only have access to arm64
macos machines, which GDB doesn't support yet), but I don't think I'm
doing things worse by adding this.

Change-Id: I2a169664ff91b92caf27cb084334f2eb4df46aa5
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=32610
2025-01-29 12:04:09 -05:00
Tom de Vries
0ac766802a [gdb/tui] Fix assert in tui_source_window_base::refresh_window
Say we use the executable of test-case gdb.tui/tui-missing-src.exp like this:
...
$ gdb.sh -q -tui outputs/gdb.tui/tui-missing-src/tui-missing-src \
    -ex "b f2"\
    -ex run
...
(from a directory not containing a file called main.c to make sure that the
missing source stays missing) and then issue finish:
...
(gdb) finish
Run till exit from #0  f2 (x=4)
    at f2.c:5
0x0000000000400570 in main ()
    at main.c:7
Value returned is $1 = 13
(gdb)
...
and use control-<minus> to decrease the font size (IOW increase the $LINES and
$COLUMNS) on the terminal, we get:
...
gdb/tui/tui-winsource.c:340: internal-error: refresh_window: \
  Assertion `pad_x + view_width <= pad_width || m_pad.get () == nullptr' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
...

The tui_source_window_base class has variable m_pad which keeps track of a
curses pad that is used to display the source code or disassembly efficiently.

The assert in tui_source_window_base::refresh_window triggers while preparing
to display part of the pad.

The problem is that the window is in a state in which the pad is not used,
because m_content.empty () == true.  Instead, it simply shows
"[ No Source Available ]".

Fix this by bailing out of tui_source_window_base::refresh_window before
accessing the m_pad variable, if m_content.empty () == true.

Tested on x86_64-linux.

Approved-By: Tom Tromey <tom@tromey.com>

PR tui/32592
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=32592

(cherry picked from commit 1c525b0e03)
2025-01-29 09:02:21 +01:00
GDB Administrator
4144c2f88d Automatic date update in version.in 2025-01-29 00:02:05 +00:00
Andrew Burgess
12630d881e gdb/remote: add 'binary-upload' feature to guard 'x' packet use
This mailing list discussion:

  https://inbox.sourceware.org/gdb-patches/CAOp6jLYD0g-GUsx7jhO3g8H_4pHkB6dkh51cbyDT-5yMfQwu+A@mail.gmail.com

highlighted the following issue with GDB's 'x' packet implementation.

Unfortunately, LLDB also has an 'x' packet, but their implementation
is different to GDB's and so targets that have implemented LLDB's 'x'
packet are incompatible with GDB.

The above thread is specifically about the 'rr' tool, but there could
be other remote targets out there that have this problem.

The difference between LLDB and GDB is that GDB expects a 'b' prefix
on the reply data, while LLDB does not.  The 'b' is important as it
allows GDB to distinguish between an empty reply (which will be a 'b'
prefix with no trailing data) and an unsupported packet (which will be
a completely empty packet).  It is not clear to me how LLDB
distinguishes these two cases.

See for discussion of the 'x' packet:

  https://inbox.sourceware.org/gdb-patches/cover.1710343840.git.tankut.baris.aktemur@intel.com/#r

with the part specific to the 'b' marker in:

  https://inbox.sourceware.org/gdb-patches/87msq82ced.fsf@redhat.com/

I propose that we add a new feature 'binary-upload' which can be
reported by a stub in its qSupported reply.  By default this feature
is "off", meaning GDB will not use the 'x' packet unless a stub
advertises this feature.

I have updated gdbserver to send 'binary-upload+', and when I examine
the gdbserver log I can see this feature being sent back, and then GDB
will use the 'x' packet.

When connecting to an older gdbserver, the feature is not sent, and
GDB does not try to use the 'x' packet at all.

I also built the latest version of `rr` and tested using current HEAD
of master, where I see problems like this:

  (rr) x/10i main
     0x401106 <main>:   Cannot access memory at address 0x401106

Then tested using this patched version of GDB, and now I see:

  (rr) x/10i main
     0x401106 <main>:   push   %rbp
     0x401107 <main+1>: mov    %rsp,%rbp
     0x40110a <main+4>: mov    0x2f17(%rip),%rax        # 0x404028 <global_ptr>
     ... etc ...

and looking in the remote log I see GDB is now using the 'm' packet
instead of the 'x' packet.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=32593
Reviewed-By: Eli Zaretskii <eliz@gnu.org>
Reviewed-By: Tankut Baris Aktemur <tankut.baris.aktemur@intel.com>
2025-01-28 12:51:20 +00:00
GDB Administrator
7c5dbff66e Automatic date update in version.in 2025-01-28 00:01:46 +00:00
GDB Administrator
650a77a80d Automatic date update in version.in 2025-01-27 00:01:32 +00:00
GDB Administrator
16281822d2 Automatic date update in version.in 2025-01-26 00:00:32 +00:00
GDB Administrator
5bde526b7f Automatic date update in version.in 2025-01-25 00:01:51 +00:00
GDB Administrator
129bc9e4ac Automatic date update in version.in 2025-01-24 00:00:57 +00:00
GDB Administrator
a9c3f13e66 Automatic date update in version.in 2025-01-23 00:02:15 +00:00
Andrew Burgess
2461ea21c7 bfd/doc: use abs_srcdir when creating symlinks
After commit:

  commit bd32be01c9
  Date:   Fri Dec 3 00:23:20 2021 -0500

      bfd: merge doc subdir up a level

And the follow-up commit:

  commit 98b1464bdf
  Date:   Wed Oct 2 22:58:08 2024 +0300

      bfd: fix unnecessary bfd.info regen

There is still a problem building the bfd docs from a release tar
file.

As the release tar file contains the pre-generated .texi files we
expect the bfd/doc build stage to symlink to the pre-existing .texi
files in the source tree.

However, this is still not working as expected if $(srcdir) is
relative.  The problem is this line in REGEN_TEXI:

    test -e $$texi || test ! -f $(srcdir)/$$texi || $(LN_S) $(srcdir)/$$texi $$texi; \

This is executed from the build/bfd/ directory, so if $(srcdir) is
relative, then this will get you from the bfd/ directory in the build
tree to the corresponding bfd/ directory in the src tree.  However,
the symlink is created in the bfd/doc/ build directory.  The relative
path will then fail to take you to the bfd/ directory in the src
tree.

Fix this by using $(abs_srcdir) when creating the symlink.

Approved-By: Nick Clifton <nickc@redhat.com>
2025-01-22 10:58:22 +00:00
GDB Administrator
4434d7d4cc Automatic date update in version.in 2025-01-22 00:01:56 +00:00
GDB Administrator
17bfbe6394 Automatic date update in version.in 2025-01-21 00:01:32 +00:00
GDB Administrator
4912fb7412 Automatic date update in version.in 2025-01-20 00:00:39 +00:00
GDB Administrator
d4db9fab08 Automatic date update in version.in 2025-01-19 00:01:31 +00:00
Joel Brobecker
0631c99c21 Bump GDB's version number to 16.1.90.DATE-git.
This commit changes gdb/version.in to 16.1.90.DATE-git.

This commit also makes the following changes in gdb/testsuite:

	* gdb.base/default.exp: Change $_gdb_minor to 2.
2025-01-18 13:58:42 +04:00
Joel Brobecker
f2a0e51cda Set GDB version number to 16.1.
This commit changes gdb/version.in to 16.1.
2025-01-18 13:43:52 +04:00
GDB Administrator
a24a5681c5 Automatic date update in version.in 2025-01-18 00:00:36 +00:00
Andrew Burgess
c7fc539d10 gdb: quote inferior arguments, if needed, when opening a core file
This commit fixes an issue with the commit:

  commit d3d13bf876
  Date:   Thu Apr 25 09:36:43 2024 +0100

      gdb: add gdbarch method to get execution context from core file

The above commit improves GDB's ability to display inferior arguments
when opening a core file, however, if an argument includes white
space, then this is not displayed as well as it should be.  For
example:

  (gdb) core-file /tmp/corefile-exec-context.2.core
  [New LWP 4069711]
  Reading symbols from /tmp/corefile-exec-context...
  Core was generated by `/tmp/corefile-exec-context aaaaa bbbbb ccccc ddddd e e e e e'.
  Program terminated with signal SIGABRT, Aborted.
  #0  __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50
  50	  return ret;
  (gdb) show args
  Argument list to give program being debugged when it is started is "aaaaa bbbbb ccccc ddddd e\ e\ e\ e\ e".
  (gdb)

Notice the 'Core was generated by ...' line.  In this case it is not
clear if the "e e e e e" is a single argument containing white space,
or 5 single arguments.

But when we 'show args' it is immediately clear that this is a single
argument, as the white space is now escaped.

This problem was caused by the above commit building the argument
string itself, and failing to consider white space escaping.

This commit changes things around, first we place the arguments into
the inferior, then, to print the 'Core was generated by ...' line, we
ask the inferior for the argument string.  In this way the quoting is
handled just as it is for 'show args'.  The initial output is now:

  (gdb) core-file /tmp/corefile-exec-context.2.core
  [New LWP 4069711]
  Reading symbols from /tmp/corefile-exec-context...
  Core was generated by `/tmp/corefile-exec-context aaaaa bbbbb ccccc ddddd e\ e\ e\ e\ e'.
  Program terminated with signal SIGABRT, Aborted.
  #0  0x00007f4f007af625 in raise () from /lib64/libc.so.6
  (gdb)

Much better.  The existing test is extended to cover this case.

Reviewed-By: Guinevere Larsen <guinevere@redhat.com>
Approved-By: Tom Tromey <tom@tromey.com>
2025-01-17 16:36:26 +00:00
Sergio Durigan Junior
d9f3ef784e gdbserver: Fix build on MIPS
Commit 3470a0e144 inadvertently broke
the build on MIPS because it's passing a non-existent "pid" argument
to "proc->for_each_thread".  This commit fixes the problem by removing
the argument from the call.

Signed-off-by: Sergio Durigan Junior <sergiodj@sergiodj.net>
Approved-By: Simon Marchi <simon.marchi@efficios.com>
2025-01-16 21:48:42 -05:00
GDB Administrator
e1474599f2 Automatic date update in version.in 2025-01-17 00:01:45 +00:00
GDB Administrator
1f3c894d72 Automatic date update in version.in 2025-01-16 00:01:55 +00:00
Tom Tromey
52b81397b1 Fix help formatting for string and filename options
I happened to notice that "help add-inferior" said:

  -execFILENAME
    FILENAME is the file name of the executable to use as the
    main program.

This is missing a space after "-exec".  This patch fixes the bug.

If ok'd on time I plan to check this in to the gdb-16 branch as well.

Approved-by: Kevin Buettner <kevinb@redhat.com>

(cherry picked from commit 6511d20c9d)
2025-01-15 08:25:06 -07:00
GDB Administrator
5746383e8c Automatic date update in version.in 2025-01-15 00:01:32 +00:00
Yang Liu
e371d9089a gdb/jit: fix jit-reader linetable integrity
The custom linetable functionality in GDB's JIT Interface has been broken
since commit 1acc9dca42.

In that commit, linetables were made independent from the objfile, which
requires objfile->section_offsets to be initialized. However, section_offsets
were never initialized in objfiles generated by GDB's JIT Interface
with custom jit-readers, leading to GDB crashes when stepping into JITed code
blocks with the following command already executed:

  jit-reader-load libmygdbjitreader.so

This patch fixes the issue by initializing the minimum section_offsets required
for linetable parsing procedures.

A minimal test is included.  The test sets up some very simple line
table information, which is enough to trigger the bug.  However, the
line table information is crafted such that none of the line table
entries will end up being displayed in GDB's output when the test is
run, as such, none of the expected output actually changes.

It might be nice in the future to extend some of the jit tests to
actually test hitting line table entries added via the jit reader.

Approved-By: Tom Tromey <tom@tromey.com>
2025-01-14 18:03:33 +00:00
GDB Administrator
3babd75807 Automatic date update in version.in 2025-01-14 00:01:44 +00:00
Tom Tromey
183e227b00 Handle case where DAP line can be None
A comment in bugzilla pointed out a bug in my earlier patch to handle
the DAP "linesStartAt1" setting.  In particular, in the backtrace
code, "line" can be None, which would lead to an exception from
export_line.

This patch fixes the problem.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=32468

(cherry picked from commit 28e5851344)
2025-01-13 07:42:27 -07:00
GDB Administrator
0866754873 Automatic date update in version.in 2025-01-13 00:01:29 +00:00
GDB Administrator
36d2bf9ba1 Automatic date update in version.in 2025-01-12 00:01:34 +00:00
GDB Administrator
97b4f10487 Automatic date update in version.in 2025-01-11 00:00:42 +00:00
GDB Administrator
230ab6b333 Automatic date update in version.in 2025-01-10 00:00:37 +00:00
GDB Administrator
6cd2d77114 Automatic date update in version.in 2025-01-09 00:01:45 +00:00
GDB Administrator
03a4ae4018 Automatic date update in version.in 2025-01-08 00:00:27 +00:00
Tom Tromey
c310e35131 Fix crash in DWARF indexer
Iain pointed out a crash in the DWARF indexer when run on a certain D
program.  The DWARF in this case has a nameless enum class; this
causes an assertion failure.

This patch arranges to simply ignore such types.  The fact that an
enum class is nameless in this case appears to be a compiler bug.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=32518
Approved-By: Tom de Vries <tdevries@suse.de>

(cherry picked from commit 66903f1d66)
2025-01-07 07:47:35 -07:00
GDB Administrator
6b0351f121 Automatic date update in version.in 2025-01-07 00:00:56 +00:00
Rainer Orth
4f38faacd9 Fix procfs.c compilation
procfs.c compilation is currently broken on Solaris:

/vol/src/gnu/gdb/hg/gdb-16-branch/git/gdb/procfs.c: In member function ‘virtual ptid_t procfs_target::wait(ptid_t, target_waitstatus*, target_wait_flags)’:
/vol/src/gnu/gdb/hg/gdb-16-branch/git/gdb/procfs.c:2067:34: error: ‘wait’ is not a member of ‘gdb’; did you mean ‘wait’?
 2067 |               wait_retval = gdb::wait (&wstat);
      |                                  ^~~~
In file included from ../gnulib/import/sys/wait.h:28,
                 from /usr/include/stdlib.h:16,
                 from /usr/gcc/14/include/c++/14.2.0/cstdlib:79,
                 from /vol/src/gnu/gdb/hg/gdb-16-branch/git/gdb/../gdbsupport/common-defs.h:99,
                 from /vol/src/gnu/gdb/hg/gdb-16-branch/git/gdb/defs.h:26,
                 from <command-line>:
/usr/include/sys/wait.h:85:14: note: ‘wait’ declared here
   85 | extern pid_t wait(int *);
      |              ^~~~
/vol/src/gnu/gdb/hg/gdb-16-branch/git/gdb/procfs.c:2154:41: error: ‘wait’ is not a member of ‘gdb’; did you mean ‘wait’?
 2154 |                         int temp = gdb::wait (&wstat);
      |                                         ^~~~
/usr/include/sys/wait.h:85:14: note: ‘wait’ declared here
   85 | extern pid_t wait(int *);
      |              ^~~~
/vol/src/gnu/gdb/hg/gdb-16-branch/git/gdb/procfs.c: In function ‘void unconditionally_kill_inferior(procinfo*)’:
/vol/src/gnu/gdb/hg/gdb-16-branch/git/gdb/procfs.c:2566:12: error: ‘wait’ is not a member of ‘gdb’; did you mean ‘wait’?
 2566 |       gdb::wait (NULL);
      |            ^~~~
/usr/include/sys/wait.h:85:14: note: ‘wait’ declared here
   85 | extern pid_t wait(int *);
      |              ^~~~

The use of gdb::wait was introduced in

commit 4e4dfc4728
Author: Tom de Vries <tdevries@suse.de>
Date:   Fri Nov 22 17:44:29 2024 +0100

    [gdb] Add gdb::wait

but obviously never tested.

Fixed by including gdbsupport/eintr.h to provide the declaration.

Tested on amd64-pc-solaris2.11 and sparcv9-sun-solaris2.11.

(cherry picked from commit d7bd319e93)
2025-01-06 16:25:40 +01:00
Tom Tromey
093a1b6b81 Handle linesStartAt1 in DAP
The DAP initialize request has a "linesStartAt1" option, where the
client can indicate that it prefers whether line numbers be 0-based or
1-based.

This patch implements this.  I audited all the line-related code in
the DAP implementation.

Note that while a similar option exists for column numbers, gdb
doesn't handle these yet, so nothing is done here.

Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=32468
(cherry picked from commit 8ac42dbf50)
2025-01-06 07:35:21 -07:00
Tom de Vries
2efabd1d9b [gdb/build] Use const_cast in fd_copy
Recent commit 6ab5d62ebc ("[gdb] Fix compilation error in event-top.c") did:
...
 fd_copy (fd_set *dst, const fd_set *src, int n)
 {
   FD_ZERO (dst);
   for (int i = 0; i < n; ++i)
-    if (FD_ISSET (i, src))
+    if (FD_ISSET (i, (fd_set *)src))
...
but according to [1] only const_cast may be used to cast away constness.

Fix this by using const_cast.

Tested by rebuilding on x86_64-linux.

[1] https://en.cppreference.com/w/cpp/language/const_cast

(cherry picked from commit a189db13c4)
2025-01-06 10:04:22 +01:00
GDB Administrator
dcde183ad1 Automatic date update in version.in 2025-01-06 00:02:01 +00:00
GDB Administrator
aebbe069df Automatic date update in version.in 2025-01-05 00:00:40 +00:00
Eli Zaretskii
947a9c38e7 [gdb/readline] Fix link error on MinGW due to missing 'alarm'
The previous solution used symbols that exist only in MinGW64.
  Add a stub implementation of 'alarm' for mingw.org's MinGW.

(cherry picked from commit d46fdacc09)
2025-01-04 12:23:52 +02:00
Eli Zaretskii
9bc042a41b [gdb/selftest] Fix 'help_doc_invariants' self-test
Running selftest help_doc_invariants.
  help doc broken invariant: command 'signal-event' help doc has over-long line
  Self test failed: self-test failed at unittests/command-def-selftests.c:121

  The reason is that doc string of 'signal-event' doesn't have
  newlines at end of its line.  Fix by adding newlines.

(cherry picked from commit c1023d9567)
2025-01-04 12:16:56 +02:00
Eli Zaretskii
bbd194adc6 [gdb] Fix compilation error in event-top.c
CXX    event-top.o
     In file included from d:\usr\include\winsock2.h:69,
		      from ./../gdbsupport/gdb_select.h:30,
		      from event-top.c:43:
     event-top.c: In function 'fd_set* fd_copy(fd_set*, const fd_set*, int)':
     event-top.c:1279:22: error: invalid conversion from 'const fd_set*' to 'fd_set*' [-fpermissive]
      1279 |     if (FD_ISSET (i, src))
	   |                      ^
	   |                      |
	   |                      const fd_set*
     d:\usr\include\winsock.h:164:50: note:   initializing argument 2 of 'int __FD_ISSET(SOCKET, fd_set*)'
       164 | __CRT_ALIAS int __FD_ISSET( SOCKET __fd, fd_set *__set )
	   |                                          ~~~~~~~~^~~~~

  Use an explicit type cast to prevent this.

      * gdb/event-top.c (fd_copy): Type-cast in call to FD_ISSET.

(cherry picked from commit 6ab5d62ebc)
2025-01-04 12:16:29 +02:00
GDB Administrator
67a0e92293 Automatic date update in version.in 2025-01-04 00:01:06 +00:00
GDB Administrator
85c6b4e827 Automatic date update in version.in 2025-01-03 00:01:53 +00:00
Alan Modra
97078538d6 PR 32507, PRIx64 in error messages on 32-bit mingw
People, including me, had forgotten that the bfd_error_handler just
handled standard printf format strings, not MSC %I64 and suchlike.
Using PRIx64 and similar in errors does not work if the host compiler
headers define those formats as the Microsoft %I64 variety.  (We
handled %ll OK, editing it to %I64 on such hosts.)

	PR 32507
	* bfd.c (_bfd_doprnt, _bfd_doprnt_scan): Handle %I64 and %I32
	in input strings if the host defines PRId64 as "I64d".
	Edit %ll to %I64 on detecting PRId64 as "I64d" rather than on
	a preprocessor define.

(cherry picked from commit b38cf91f23)
2025-01-02 19:32:16 +02:00
GDB Administrator
c1001d08ee Automatic date update in version.in 2025-01-02 00:01:22 +00:00
GDB Administrator
c2a5fae738 Automatic date update in version.in 2025-01-01 00:01:14 +00:00
GDB Administrator
7b4436effe Automatic date update in version.in 2024-12-31 00:00:50 +00:00
GDB Administrator
0d51df64c4 Automatic date update in version.in 2024-12-30 00:01:44 +00:00
Joel Brobecker
f1687b6964 Bump GDB's version number to 16.0.90.DATE-git.
This commit changes gdb/version.in to 16.0.90.DATE-git.
2024-12-29 07:28:10 +04:00
Joel Brobecker
557ee7861a Set GDB version number to 16.0.90.
This commit changes gdb/version.in to 16.0.90.
2024-12-29 07:16:03 +04:00
Joel Brobecker
00d493c805 gdb/NEWS: modify "Changes since GDB 15" to "Changes in GDB 16" 2024-12-29 07:10:11 +04:00
Joel Brobecker
b2d36b9a2b Set development mode to "off" by default.
This is done by setting the "development" variable to "false"
in bfd/development.sh.
2024-12-29 06:51:39 +04:00
Joel Brobecker
f83f33630c Bump version to 16.0.90.DATE-git.
Now that the GDB 16 branch has been created,
this commit bumps the version number in gdb/version.in to
16.0.90.DATE-git

For the record, the GDB 16 branch was created
from commit ee29a3c4ac.
2024-12-29 06:51:21 +04:00
51 changed files with 1605 additions and 195 deletions

View File

@@ -1318,7 +1318,7 @@ REGEN_TEXI = \
$(MKDOC) -f $(srcdir)/doc/doc.str < $< > $@.tmp; \
texi=$@; \
texi=$${texi%.stamp}.texi; \
test -e $$texi || test ! -f $(srcdir)/$$texi || $(LN_S) $(srcdir)/$$texi $$texi; \
test -e $$texi || test ! -f $(srcdir)/$$texi || $(LN_S) $(abs_srcdir)/$$texi $$texi; \
$(SHELL) $(srcdir)/../move-if-change $@.tmp $$texi; \
touch $@; \
)

View File

@@ -1090,8 +1090,14 @@ _bfd_doprnt (bfd_print_callback print, void *stream, const char *format,
ptr += 2;
}
/* There is a clash between Microsoft's non-standard I64
and I32 integer length modifiers and glibc's
non-standard I flag. */
const char *printf_flag_chars
= sizeof PRId64 == sizeof "I64d" ? "-+ #0'" : "-+ #0'I";
/* Move past flags. */
while (strchr ("-+ #0'I", *ptr))
while (strchr (printf_flag_chars, *ptr))
*sptr++ = *ptr++;
if (*ptr == '*')
@@ -1141,6 +1147,22 @@ _bfd_doprnt (bfd_print_callback print, void *stream, const char *format,
while (ISDIGIT (*ptr))
*sptr++ = *ptr++;
}
if (sizeof PRId64 == sizeof "I64d" && *ptr =='I')
{
if (ptr[1] == '6' && ptr[2] == '4')
{
wide_width = 3;
*sptr++ = *ptr++;
*sptr++ = *ptr++;
*sptr++ = *ptr++;
}
else if (ptr[1] == '3' && ptr[2] == '2')
{
*sptr++ = *ptr++;
*sptr++ = *ptr++;
*sptr++ = *ptr++;
}
}
while (strchr ("hlL", *ptr))
{
switch (*ptr)
@@ -1192,14 +1214,17 @@ _bfd_doprnt (bfd_print_callback print, void *stream, const char *format,
PRINT_TYPE (long, l);
break;
case 2:
if (sizeof PRId64 == sizeof "I64d")
{
/* Convert any %ll to %I64. */
sptr[-3] = 'I';
sptr[-2] = '6';
sptr[-1] = '4';
*sptr++ = ptr[-1];
*sptr = '\0';
}
/* Fall through. */
default:
#if defined (__MSVCRT__)
sptr[-3] = 'I';
sptr[-2] = '6';
sptr[-1] = '4';
*sptr++ = ptr[-1];
*sptr = '\0';
#endif
PRINT_TYPE (long long, ll);
break;
}
@@ -1322,8 +1347,14 @@ _bfd_doprnt_scan (const char *format, va_list ap, union _bfd_doprnt_args *args)
ptr += 2;
}
/* There is a clash between Microsoft's non-standard I64
and I32 integer length modifiers and glibc's
non-standard I flag. */
const char *printf_flag_chars
= sizeof PRId64 == sizeof "I64d" ? "-+ #0'" : "-+ #0'I";
/* Move past flags. */
while (strchr ("-+ #0'I", *ptr))
while (strchr (printf_flag_chars, *ptr))
ptr++;
if (*ptr == '*')
@@ -1372,6 +1403,17 @@ _bfd_doprnt_scan (const char *format, va_list ap, union _bfd_doprnt_args *args)
while (ISDIGIT (*ptr))
ptr++;
}
if (sizeof PRId64 == sizeof "I64d" && *ptr =='I')
{
if (ptr[1] == '6' && ptr[2] == '4')
{
wide_width = 3;
ptr += 3;
}
else if (ptr[1] == '3' && ptr[2] == '2')
ptr += 3;
}
while (strchr ("hlL", *ptr))
{
switch (*ptr)

View File

@@ -16,7 +16,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Controls whether to enable development-mode features by default.
development=true
development=false
# Indicate whether this is a release branch.
experimental=true

View File

@@ -101,7 +101,7 @@ REGEN_TEXI = \
$(MKDOC) -f $(srcdir)/%D%/doc.str < $< > $@.tmp; \
texi=$@; \
texi=$${texi%.stamp}.texi; \
test -e $$texi || test ! -f $(srcdir)/$$texi || $(LN_S) $(srcdir)/$$texi $$texi; \
test -e $$texi || test ! -f $(srcdir)/$$texi || $(LN_S) $(abs_srcdir)/$$texi $$texi; \
$(SHELL) $(srcdir)/../move-if-change $@.tmp $$texi; \
touch $@; \
)

View File

@@ -16,7 +16,7 @@
In releases, the date is not included in either version strings or
sonames. */
#define BFD_VERSION_DATE 20241229
#define BFD_VERSION_DATE 20250420
#define BFD_VERSION @bfd_version@
#define BFD_VERSION_STRING @bfd_version_package@ @bfd_version_string@
#define REPORT_BUGS_TO @report_bugs_to@

View File

@@ -1,7 +1,7 @@
What has changed in GDB?
(Organized release by release)
*** Changes since GDB 15
*** Changes in GDB 16
* Support for Nios II targets has been removed as this architecture
has been EOL'ed by Intel.
@@ -204,6 +204,12 @@ x addr,length
equivalent to 'm', except that the data in the response are in
binary format.
binary-upload in qSupported reply
If the stub sends back 'binary-upload+' in it's qSupported reply,
then GDB will, where possible, make use of the 'x' packet. If the
stub doesn't report this feature supported, then GDB will not use
the 'x' packet.
*** Changes in GDB 15
* The MPX commands "show/set mpx bound" have been deprecated, as Intel

View File

@@ -5200,9 +5200,9 @@ aarch64_record_asimd_load_store (aarch64_insn_decode_record *aarch64_insn_r)
CORE_ADDR address;
uint64_t addr_offset = 0;
uint32_t record_buf[24];
uint64_t record_buf_mem[24];
std::vector<uint64_t> record_buf_mem;
uint32_t reg_rn, reg_rt;
uint32_t reg_index = 0, mem_index = 0;
uint32_t reg_index = 0;
uint8_t opcode_bits, size_bits;
reg_rt = bits (aarch64_insn_r->aarch64_insn, 0, 4);
@@ -5265,8 +5265,8 @@ aarch64_record_asimd_load_store (aarch64_insn_decode_record *aarch64_insn_r)
record_buf[reg_index++] = reg_rt + AARCH64_V0_REGNUM;
else
{
record_buf_mem[mem_index++] = esize / 8;
record_buf_mem[mem_index++] = address + addr_offset;
record_buf_mem.push_back (esize / 8);
record_buf_mem.push_back (address + addr_offset);
}
addr_offset = addr_offset + (esize / 8);
reg_rt = (reg_rt + 1) % 32;
@@ -5337,8 +5337,8 @@ aarch64_record_asimd_load_store (aarch64_insn_decode_record *aarch64_insn_r)
record_buf[reg_index++] = reg_tt + AARCH64_V0_REGNUM;
else
{
record_buf_mem[mem_index++] = esize / 8;
record_buf_mem[mem_index++] = address + addr_offset;
record_buf_mem.push_back (esize / 8);
record_buf_mem.push_back (address + addr_offset);
}
addr_offset = addr_offset + (esize / 8);
reg_tt = (reg_tt + 1) % 32;
@@ -5350,9 +5350,9 @@ aarch64_record_asimd_load_store (aarch64_insn_decode_record *aarch64_insn_r)
record_buf[reg_index++] = reg_rn;
aarch64_insn_r->reg_rec_count = reg_index;
aarch64_insn_r->mem_rec_count = mem_index / 2;
aarch64_insn_r->mem_rec_count = record_buf_mem.size () / 2;
MEM_ALLOC (aarch64_insn_r->aarch64_mems, aarch64_insn_r->mem_rec_count,
record_buf_mem);
record_buf_mem.data ());
REG_ALLOC (aarch64_insn_r->aarch64_regs, aarch64_insn_r->reg_rec_count,
record_buf);
return AARCH64_RECORD_SUCCESS;

View File

@@ -790,10 +790,10 @@ append_val_type_str (std::string &help, const option_def &opt,
}
break;
case var_string:
help += "STRING";
help += " STRING";
break;
case var_filename:
help += "FILENAME";
help += " FILENAME";
break;
default:
break;

View File

@@ -1169,35 +1169,30 @@ core_target_open (const char *arg, int from_tty)
if (ctx.valid ())
{
std::string args;
for (const auto &a : ctx.args ())
{
args += ' ';
args += a.get ();
}
gdb_printf (_("Core was generated by `%ps%s'.\n"),
styled_string (file_name_style.style (),
ctx.execfn ()),
args.c_str ());
/* Copy the arguments into the inferior. */
std::vector<char *> argv;
for (const auto &a : ctx.args ())
for (const gdb::unique_xmalloc_ptr<char> &a : ctx.args ())
argv.push_back (a.get ());
gdb::array_view<char * const> view (argv.data (), argv.size ());
current_inferior ()->set_args (view);
/* And now copy the environment. */
current_inferior ()->environment = ctx.environment ();
/* Inform the user of executable and arguments. */
const std::string &args = current_inferior ()->args ();
gdb_printf (_("Core was generated by `%ps%s%s'.\n"),
styled_string (file_name_style.style (),
ctx.execfn ()),
(args.length () > 0 ? " " : ""), args.c_str ());
}
else
{
gdb::unique_xmalloc_ptr<char> failing_command = make_unique_xstrdup
(bfd_core_file_failing_command (current_program_space->core_bfd ()));
const char *failing_command
= bfd_core_file_failing_command (current_program_space->core_bfd ());
if (failing_command != nullptr)
gdb_printf (_("Core was generated by `%s'.\n"),
failing_command.get ());
failing_command);
}
/* Clearing any previous state of convenience variables. */

View File

@@ -26,6 +26,7 @@
#include "symtab.h"
#include "objfiles.h"
#include "cli/cli-cmds.h"
#include "cli/cli-style.h"
#include "gdbcore.h"
#include "gdbthread.h"
#include "regcache.h"

View File

@@ -43467,6 +43467,10 @@ and @var{length} is a multiple of the word size, the stub is free to
use byte accesses, or not. For this reason, this packet may not be
suitable for accessing memory-mapped I/O devices.
@value{GDBN} will only use this packet if the stub reports the
@samp{binary-upload} feature is supported in its @samp{qSupported}
reply (@pxref{qSupported}).
Reply:
@table @samp
@item b @var{XX@dots{}}
@@ -45114,6 +45118,11 @@ These are the currently defined stub features and their properties:
@tab @samp{+}
@tab No
@item @samp{binary-upload}
@tab No
@tab @samp{-}
@tab No
@end multitable
These are the currently defined stub features, in more detail:
@@ -45360,6 +45369,9 @@ The remote stub supports replying with an error in a
send this feature back to @value{GDBN} in the @samp{qSupported} reply,
@value{GDBN} will always support @samp{E.@var{errtext}} format replies
if it sent the @samp{error-message} feature.
@item binary-upload
The remote stub supports the @samp{x} packet (@pxref{x packet}).
@end table
@item qSymbol::

View File

@@ -388,12 +388,12 @@ dwarf2_find_location_expression (const dwarf2_loclist_baton *baton,
enum debug_loc_kind kind;
const gdb_byte *new_ptr = NULL; /* init for gcc -Wall */
if (baton->per_cu->version () < 5 && baton->from_dwo)
if (baton->dwarf_version < 5 && baton->from_dwo)
kind = decode_debug_loc_dwo_addresses (baton->per_cu,
baton->per_objfile,
loc_ptr, buf_end, &new_ptr,
&low, &high, byte_order);
else if (baton->per_cu->version () < 5)
else if (baton->dwarf_version < 5)
kind = decode_debug_loc_addresses (loc_ptr, buf_end, &new_ptr,
&low, &high,
byte_order, addr_size,
@@ -444,7 +444,7 @@ dwarf2_find_location_expression (const dwarf2_loclist_baton *baton,
high = (unrelocated_addr) ((CORE_ADDR) high + (CORE_ADDR) base_address);
}
if (baton->per_cu->version () < 5)
if (baton->dwarf_version < 5)
{
length = extract_unsigned_integer (loc_ptr, 2, byte_order);
loc_ptr += 2;
@@ -3977,12 +3977,12 @@ loclist_describe_location (struct symbol *symbol, CORE_ADDR addr,
enum debug_loc_kind kind;
const gdb_byte *new_ptr = NULL; /* init for gcc -Wall */
if (dlbaton->per_cu->version () < 5 && dlbaton->from_dwo)
if (dlbaton->dwarf_version < 5 && dlbaton->from_dwo)
kind = decode_debug_loc_dwo_addresses (dlbaton->per_cu,
per_objfile,
loc_ptr, buf_end, &new_ptr,
&low, &high, byte_order);
else if (dlbaton->per_cu->version () < 5)
else if (dlbaton->dwarf_version < 5)
kind = decode_debug_loc_addresses (loc_ptr, buf_end, &new_ptr,
&low, &high,
byte_order, addr_size,
@@ -4032,7 +4032,7 @@ loclist_describe_location (struct symbol *symbol, CORE_ADDR addr,
CORE_ADDR low_reloc = per_objfile->relocate (low);
CORE_ADDR high_reloc = per_objfile->relocate (high);
if (dlbaton->per_cu->version () < 5)
if (dlbaton->dwarf_version < 5)
{
length = extract_unsigned_integer (loc_ptr, 2, byte_order);
loc_ptr += 2;

View File

@@ -197,6 +197,9 @@ struct dwarf2_loclist_baton
/* Non-zero if the location list lives in .debug_loc.dwo.
The format of entries in this section are different. */
unsigned char from_dwo;
/* The version of DWARF this loclist comes from. */
unsigned char dwarf_version;
};
/* The baton used when a dynamic property is an offset to a parent

View File

@@ -4103,8 +4103,6 @@ cutu_reader::cutu_reader (dwarf2_per_cu_data *this_cu,
/* Establish the type offset that can be used to lookup the type. */
sig_type->type_offset_in_section =
this_cu->sect_off + to_underlying (sig_type->type_offset_in_tu);
this_cu->set_version (cu->header.version);
}
else
{
@@ -4115,7 +4113,6 @@ cutu_reader::cutu_reader (dwarf2_per_cu_data *this_cu,
gdb_assert (this_cu->sect_off == cu->header.sect_off);
this_cu->set_length (cu->header.get_length_with_initial ());
this_cu->set_version (cu->header.version);
}
}
@@ -5129,10 +5126,6 @@ read_comp_units_from_section (dwarf2_per_objfile *per_objfile,
this_cu->set_length (cu_header.get_length_with_initial ());
this_cu->is_dwz = is_dwz;
this_cu->section = section;
/* Init this asap, to avoid a data race in the set_version in
cutu_reader::cutu_reader (which may be run in parallel for the cooked
index case). */
this_cu->set_version (cu_header.version);
info_ptr = info_ptr + this_cu->length ();
per_objfile->per_bfd->all_units.push_back (std::move (this_cu));
@@ -9237,7 +9230,7 @@ open_and_init_dwo_file (dwarf2_cu *cu, const char *dwo_name,
create_cus_hash_table (per_objfile, cu, *dwo_file, dwo_file->sections.info,
dwo_file->cus);
if (cu->per_cu->version () < 5)
if (cu->header.version < 5)
{
create_debug_types_hash_table (per_objfile, dwo_file.get (),
dwo_file->sections.types, dwo_file->tus);
@@ -14800,8 +14793,7 @@ read_subroutine_type (struct die_info *die, struct dwarf2_cu *cu)
if (type->code () == TYPE_CODE_VOID
&& !type->is_stub ()
&& die->child == nullptr
&& (cu->per_cu->version () == 2
|| producer_is_gas_2_39 (cu)))
&& (cu->header.version == 2 || producer_is_gas_2_39 (cu)))
{
/* Work around PR gas/29517, pretend we have an DW_TAG_unspecified_type
return type. */
@@ -16809,6 +16801,12 @@ cooked_indexer::index_dies (cutu_reader *reader,
break;
case DW_TAG_enumeration_type:
/* Some versions of gdc could emit an "enum class"
without a name, which is nonsensical. These are
skipped. */
if (is_enum_class && this_entry == nullptr)
continue;
/* We need to recurse even for an anonymous enumeration.
Which scope we record as the parent scope depends on
whether we're reading an "enum class". If so, we use
@@ -21687,6 +21685,7 @@ fill_in_loclist_baton (struct dwarf2_cu *cu,
else
baton->base_address = {};
baton->from_dwo = cu->dwo_unit != NULL;
baton->dwarf_version = cu->header.version;
}
static void

View File

@@ -120,9 +120,6 @@ struct dwarf2_per_cu_data
private:
unsigned int m_length = 0;
/* DWARF standard version this data has been read from (such as 4 or 5). */
unsigned char m_dwarf_version = 0;
public:
/* Non-zero if this CU is from .debug_types.
Struct dwarf2_per_cu_data is contained in struct signatured_type iff
@@ -281,24 +278,6 @@ public:
gdb_assert (m_length == length);
}
/* Return DWARF version number of this CU. */
short version () const
{
/* Make sure it's set already. */
gdb_assert (m_dwarf_version != 0);
return m_dwarf_version;
}
void set_version (short version)
{
if (m_dwarf_version == 0)
/* Set if not set already. */
m_dwarf_version = version;
else
/* If already set, verify that it's the same value. */
gdb_assert (m_dwarf_version == version);
}
dwarf_unit_type unit_type (bool strict_p = true) const
{
dwarf_unit_type ut = m_unit_type.load ();

View File

@@ -1276,7 +1276,7 @@ fd_copy (fd_set *dst, const fd_set *src, int n)
{
FD_ZERO (dst);
for (int i = 0; i < n; ++i)
if (FD_ISSET (i, src))
if (FD_ISSET (i, const_cast<fd_set *>(src)))
FD_SET (i, dst);
return dst;

View File

@@ -2325,7 +2325,22 @@ get_prev_frame_always_1 (const frame_info_ptr &this_frame)
until we have unwound all the way down to the previous non-inline
frame. */
if (get_frame_type (this_frame) == INLINE_FRAME)
return get_prev_frame_maybe_check_cycle (this_frame);
{
frame_info_ptr fi = get_prev_frame_maybe_check_cycle (this_frame);
/* If this_frame is the current frame, then compute and stash its frame
id so that the cycle check in get_prev_frame_maybe_check_cycle works
correctly in the case where inline frame 0 has been duplicated.
The this_id.p check is required to avoid recursion as computing the
frame id results in a call to inline_frame_this_id which calls back
into get_prev_frame_always. */
if (this_frame->level == 0
&& this_frame->this_id.p != frame_id_status::COMPUTING)
get_frame_id (this_frame);
return fi;
}
/* If this_frame is the current frame, then compute and stash its
frame id prior to fetching and computing the frame id of the

View File

@@ -1,6 +1,6 @@
#!/usr/bin/env bash
# Copyright (C) 2024 Free Software Foundation, Inc.
# Copyright (C) 2024-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -22,8 +22,8 @@
GDB=${GDB:-$(command -v gdb)}
GDBARGS=${GDBARGS:-}
AWK=${AWK:-}
PKGVERSION=@PKGVERSION@
VERSION=@VERSION@
PKGVERSION="@PKGVERSION@"
VERSION="@VERSION@"
# Find an appropriate awk interpreter if one was not specified
# via the environment.
@@ -132,7 +132,7 @@ EOF
)
# Run GDB and remove some unwanted noise.
"$GDB" --quiet -nx --readnever $GDBARGS <<EOF |
"$GDB" --quiet -nx $GDBARGS <<EOF |
set width 0
set height 0
set pagination no

View File

@@ -370,6 +370,16 @@ i386_all_but_ip_registers_record (struct regcache *regcache)
return 0;
}
enum i386_syscall
{
#define SYSCALL(NUMBER,NAME) \
i386_sys_ ## NAME = NUMBER,
#include "gdb/i386-syscalls.def"
#undef SYSCALL
};
/* i386_canonicalize_syscall maps from the native i386 Linux set
of syscall ids into a canonical set of syscall ids used by
process record (a mostly trivial mapping, since the canonical
@@ -378,12 +388,486 @@ i386_all_but_ip_registers_record (struct regcache *regcache)
static enum gdb_syscall
i386_canonicalize_syscall (int syscall)
{
enum { i386_syscall_max = 499 };
switch ((enum i386_syscall) syscall)
{
#define SYSCALL_MAP(SYSCALL) \
case i386_sys_ ## SYSCALL: \
return gdb_sys_ ## SYSCALL
if (syscall <= i386_syscall_max)
return (enum gdb_syscall) syscall;
else
return gdb_sys_no_syscall;
#define SYSCALL_MAP_RENAME(SYSCALL,GDB_SYSCALL) \
case i386_sys_##SYSCALL: \
return GDB_SYSCALL;
#define UNSUPPORTED_SYSCALL_MAP(SYSCALL) \
case i386_sys_ ## SYSCALL: \
return gdb_sys_no_syscall;
SYSCALL_MAP (restart_syscall);
SYSCALL_MAP (exit);
SYSCALL_MAP (fork);
SYSCALL_MAP (read);
SYSCALL_MAP (write);
SYSCALL_MAP (open);
SYSCALL_MAP (close);
SYSCALL_MAP (waitpid);
SYSCALL_MAP (creat);
SYSCALL_MAP (link);
SYSCALL_MAP (unlink);
SYSCALL_MAP (execve);
SYSCALL_MAP (chdir);
SYSCALL_MAP (time);
SYSCALL_MAP (mknod);
SYSCALL_MAP (chmod);
SYSCALL_MAP_RENAME (lchown, gdb_sys_lchown16);
SYSCALL_MAP_RENAME (break, gdb_sys_ni_syscall17);
SYSCALL_MAP_RENAME (oldstat, gdb_sys_stat);
SYSCALL_MAP (lseek);
SYSCALL_MAP (getpid);
SYSCALL_MAP (mount);
SYSCALL_MAP_RENAME (umount, gdb_sys_oldumount);
SYSCALL_MAP_RENAME (setuid, gdb_sys_setuid16);
SYSCALL_MAP_RENAME (getuid, gdb_sys_getuid16);
SYSCALL_MAP (stime);
SYSCALL_MAP (ptrace);
SYSCALL_MAP (alarm);
SYSCALL_MAP_RENAME (oldfstat, gdb_sys_fstat);
SYSCALL_MAP (pause);
SYSCALL_MAP (utime);
SYSCALL_MAP_RENAME (stty, gdb_sys_ni_syscall31);
SYSCALL_MAP_RENAME (gtty, gdb_sys_ni_syscall32);
SYSCALL_MAP (access);
SYSCALL_MAP (nice);
SYSCALL_MAP_RENAME (ftime, gdb_sys_ni_syscall35);
SYSCALL_MAP (sync);
SYSCALL_MAP (kill);
SYSCALL_MAP (rename);
SYSCALL_MAP (mkdir);
SYSCALL_MAP (rmdir);
SYSCALL_MAP (dup);
SYSCALL_MAP (pipe);
SYSCALL_MAP (times);
SYSCALL_MAP_RENAME (prof, gdb_sys_ni_syscall44);
SYSCALL_MAP (brk);
SYSCALL_MAP_RENAME (setgid, gdb_sys_setgid16);
SYSCALL_MAP_RENAME (getgid, gdb_sys_getgid16);
SYSCALL_MAP (signal);
SYSCALL_MAP_RENAME (geteuid, gdb_sys_geteuid16);
SYSCALL_MAP_RENAME (getegid, gdb_sys_getegid16);
SYSCALL_MAP (acct);
SYSCALL_MAP_RENAME (umount2, gdb_sys_umount);
SYSCALL_MAP_RENAME (lock, gdb_sys_ni_syscall53);
SYSCALL_MAP (ioctl);
SYSCALL_MAP (fcntl);
SYSCALL_MAP_RENAME (mpx, gdb_sys_ni_syscall56);
SYSCALL_MAP (setpgid);
SYSCALL_MAP_RENAME (ulimit, gdb_sys_ni_syscall58);
SYSCALL_MAP_RENAME (oldolduname, gdb_sys_olduname);
SYSCALL_MAP (umask);
SYSCALL_MAP (chroot);
SYSCALL_MAP (ustat);
SYSCALL_MAP (dup2);
SYSCALL_MAP (getppid);
SYSCALL_MAP (getpgrp);
SYSCALL_MAP (setsid);
SYSCALL_MAP (sigaction);
SYSCALL_MAP (sgetmask);
SYSCALL_MAP (ssetmask);
SYSCALL_MAP_RENAME (setreuid, gdb_sys_setreuid16);
SYSCALL_MAP_RENAME (setregid, gdb_sys_setregid16);
SYSCALL_MAP (sigsuspend);
SYSCALL_MAP (sigpending);
SYSCALL_MAP (sethostname);
SYSCALL_MAP (setrlimit);
SYSCALL_MAP_RENAME (getrlimit, gdb_sys_old_getrlimit);
SYSCALL_MAP (getrusage);
SYSCALL_MAP (gettimeofday);
SYSCALL_MAP (settimeofday);
SYSCALL_MAP_RENAME (getgroups, gdb_sys_getgroups16);
SYSCALL_MAP_RENAME (setgroups, gdb_sys_setgroups16);
SYSCALL_MAP_RENAME (select, gdb_old_select);
SYSCALL_MAP (symlink);
SYSCALL_MAP_RENAME (oldlstat, gdb_sys_lstat);
SYSCALL_MAP (readlink);
SYSCALL_MAP (uselib);
SYSCALL_MAP (swapon);
SYSCALL_MAP (reboot);
SYSCALL_MAP_RENAME (readdir, gdb_old_readdir);
SYSCALL_MAP_RENAME (mmap, gdb_old_mmap);
SYSCALL_MAP (munmap);
SYSCALL_MAP (truncate);
SYSCALL_MAP (ftruncate);
SYSCALL_MAP (fchmod);
SYSCALL_MAP_RENAME (fchown, gdb_sys_fchown16);
SYSCALL_MAP (getpriority);
SYSCALL_MAP (setpriority);
SYSCALL_MAP_RENAME (profil, gdb_sys_ni_syscall98);
SYSCALL_MAP (statfs);
SYSCALL_MAP (fstatfs);
SYSCALL_MAP (ioperm);
SYSCALL_MAP (socketcall);
SYSCALL_MAP (syslog);
SYSCALL_MAP (setitimer);
SYSCALL_MAP (getitimer);
SYSCALL_MAP_RENAME (stat, gdb_sys_newstat);
SYSCALL_MAP_RENAME (lstat, gdb_sys_newlstat);
SYSCALL_MAP_RENAME (fstat, gdb_sys_newfstat);
SYSCALL_MAP_RENAME (olduname, gdb_sys_uname);
SYSCALL_MAP (iopl);
SYSCALL_MAP (vhangup);
SYSCALL_MAP_RENAME (idle, gdb_sys_ni_syscall112);
SYSCALL_MAP (vm86old);
SYSCALL_MAP (wait4);
SYSCALL_MAP (swapoff);
SYSCALL_MAP (sysinfo);
SYSCALL_MAP (ipc);
SYSCALL_MAP (fsync);
SYSCALL_MAP (sigreturn);
SYSCALL_MAP (clone);
SYSCALL_MAP (setdomainname);
SYSCALL_MAP_RENAME (uname, gdb_sys_newuname);
SYSCALL_MAP (modify_ldt);
SYSCALL_MAP (adjtimex);
SYSCALL_MAP (mprotect);
SYSCALL_MAP (sigprocmask);
SYSCALL_MAP_RENAME (create_module, gdb_sys_ni_syscall127);
SYSCALL_MAP (init_module);
SYSCALL_MAP (delete_module);
SYSCALL_MAP_RENAME (get_kernel_syms, gdb_sys_ni_syscall130);
SYSCALL_MAP (quotactl);
SYSCALL_MAP (getpgid);
SYSCALL_MAP (fchdir);
SYSCALL_MAP (bdflush);
SYSCALL_MAP (sysfs);
SYSCALL_MAP (personality);
SYSCALL_MAP_RENAME (afs_syscall, gdb_sys_ni_syscall137);
SYSCALL_MAP_RENAME (setfsuid, gdb_sys_setfsuid16);
SYSCALL_MAP_RENAME (setfsgid, gdb_sys_setfsgid16);
SYSCALL_MAP_RENAME (_llseek, gdb_sys_llseek);
SYSCALL_MAP (getdents);
SYSCALL_MAP_RENAME (_newselect, gdb_sys_select);
SYSCALL_MAP (flock);
SYSCALL_MAP (msync);
SYSCALL_MAP (readv);
SYSCALL_MAP (writev);
SYSCALL_MAP (getsid);
SYSCALL_MAP (fdatasync);
SYSCALL_MAP_RENAME (_sysctl, gdb_sys_sysctl);
SYSCALL_MAP (mlock);
SYSCALL_MAP (munlock);
SYSCALL_MAP (mlockall);
SYSCALL_MAP (munlockall);
SYSCALL_MAP (sched_setparam);
SYSCALL_MAP (sched_getparam);
SYSCALL_MAP (sched_setscheduler);
SYSCALL_MAP (sched_getscheduler);
SYSCALL_MAP (sched_yield);
SYSCALL_MAP (sched_get_priority_max);
SYSCALL_MAP (sched_get_priority_min);
SYSCALL_MAP (sched_rr_get_interval);
SYSCALL_MAP (nanosleep);
SYSCALL_MAP (mremap);
SYSCALL_MAP_RENAME (setresuid, gdb_sys_setresuid16);
SYSCALL_MAP_RENAME (getresuid, gdb_sys_getresuid16);
SYSCALL_MAP (vm86);
SYSCALL_MAP_RENAME (query_module, gdb_sys_ni_syscall167);
SYSCALL_MAP (poll);
SYSCALL_MAP (nfsservctl);
SYSCALL_MAP_RENAME (setresgid, gdb_sys_setresgid16);
SYSCALL_MAP_RENAME (getresgid, gdb_sys_getresgid16);
SYSCALL_MAP (prctl);
SYSCALL_MAP (rt_sigreturn);
SYSCALL_MAP (rt_sigaction);
SYSCALL_MAP (rt_sigprocmask);
SYSCALL_MAP (rt_sigpending);
SYSCALL_MAP (rt_sigtimedwait);
SYSCALL_MAP (rt_sigqueueinfo);
SYSCALL_MAP (rt_sigsuspend);
SYSCALL_MAP (pread64);
SYSCALL_MAP (pwrite64);
SYSCALL_MAP_RENAME (chown, gdb_sys_chown16);
SYSCALL_MAP (getcwd);
SYSCALL_MAP (capget);
SYSCALL_MAP (capset);
SYSCALL_MAP (sigaltstack);
SYSCALL_MAP (sendfile);
SYSCALL_MAP_RENAME (getpmsg, gdb_sys_ni_syscall188);
SYSCALL_MAP_RENAME (putpmsg, gdb_sys_ni_syscall189);
SYSCALL_MAP (vfork);
SYSCALL_MAP_RENAME (ugetrlimit, gdb_sys_getrlimit);
SYSCALL_MAP (mmap2);
SYSCALL_MAP (truncate64);
SYSCALL_MAP (ftruncate64);
SYSCALL_MAP (stat64);
SYSCALL_MAP (lstat64);
SYSCALL_MAP (fstat64);
SYSCALL_MAP_RENAME (lchown32, gdb_sys_lchown);
SYSCALL_MAP_RENAME (getuid32, gdb_sys_getuid);
SYSCALL_MAP_RENAME (getgid32, gdb_sys_getgid);
SYSCALL_MAP_RENAME (geteuid32, gdb_sys_geteuid);
SYSCALL_MAP_RENAME (getegid32, gdb_sys_getegid);
SYSCALL_MAP_RENAME (setreuid32, gdb_sys_setreuid);
SYSCALL_MAP_RENAME (setregid32, gdb_sys_setregid);
SYSCALL_MAP_RENAME (getgroups32, gdb_sys_getgroups);
SYSCALL_MAP_RENAME (setgroups32, gdb_sys_setgroups);
SYSCALL_MAP_RENAME (fchown32, gdb_sys_fchown);
SYSCALL_MAP_RENAME (setresuid32, gdb_sys_setresuid);
SYSCALL_MAP_RENAME (getresuid32, gdb_sys_getresuid);
SYSCALL_MAP_RENAME (setresgid32, gdb_sys_setresgid);
SYSCALL_MAP_RENAME (getresgid32, gdb_sys_getresgid);
SYSCALL_MAP_RENAME (chown32, gdb_sys_chown);
SYSCALL_MAP_RENAME (setuid32, gdb_sys_setuid);
SYSCALL_MAP_RENAME (setgid32, gdb_sys_setgid);
SYSCALL_MAP_RENAME (setfsuid32, gdb_sys_setfsuid);
SYSCALL_MAP_RENAME (setfsgid32, gdb_sys_setfsgid);
SYSCALL_MAP (pivot_root);
SYSCALL_MAP (mincore);
SYSCALL_MAP (madvise);
SYSCALL_MAP (getdents64);
SYSCALL_MAP (fcntl64);
SYSCALL_MAP (gettid);
SYSCALL_MAP (readahead);
SYSCALL_MAP (setxattr);
SYSCALL_MAP (lsetxattr);
SYSCALL_MAP (fsetxattr);
SYSCALL_MAP (getxattr);
SYSCALL_MAP (lgetxattr);
SYSCALL_MAP (fgetxattr);
SYSCALL_MAP (listxattr);
SYSCALL_MAP (llistxattr);
SYSCALL_MAP (flistxattr);
SYSCALL_MAP (removexattr);
SYSCALL_MAP (lremovexattr);
SYSCALL_MAP (fremovexattr);
SYSCALL_MAP (tkill);
SYSCALL_MAP (sendfile64);
SYSCALL_MAP (futex);
SYSCALL_MAP (sched_setaffinity);
SYSCALL_MAP (sched_getaffinity);
SYSCALL_MAP (set_thread_area);
SYSCALL_MAP (get_thread_area);
SYSCALL_MAP (io_setup);
SYSCALL_MAP (io_destroy);
SYSCALL_MAP (io_getevents);
SYSCALL_MAP (io_submit);
SYSCALL_MAP (io_cancel);
SYSCALL_MAP (fadvise64);
SYSCALL_MAP (exit_group);
SYSCALL_MAP (lookup_dcookie);
SYSCALL_MAP (epoll_create);
SYSCALL_MAP (epoll_ctl);
SYSCALL_MAP (epoll_wait);
SYSCALL_MAP (remap_file_pages);
SYSCALL_MAP (set_tid_address);
SYSCALL_MAP (timer_create);
SYSCALL_MAP (timer_settime);
SYSCALL_MAP (timer_gettime);
SYSCALL_MAP (timer_getoverrun);
SYSCALL_MAP (timer_delete);
SYSCALL_MAP (clock_settime);
SYSCALL_MAP (clock_gettime);
SYSCALL_MAP (clock_getres);
SYSCALL_MAP (clock_nanosleep);
SYSCALL_MAP (statfs64);
SYSCALL_MAP (fstatfs64);
SYSCALL_MAP (tgkill);
SYSCALL_MAP (utimes);
SYSCALL_MAP (fadvise64_64);
SYSCALL_MAP_RENAME (vserver, gdb_sys_ni_syscall273);
SYSCALL_MAP (mbind);
SYSCALL_MAP (get_mempolicy);
SYSCALL_MAP (set_mempolicy);
SYSCALL_MAP (mq_open);
SYSCALL_MAP (mq_unlink);
SYSCALL_MAP (mq_timedsend);
SYSCALL_MAP (mq_timedreceive);
SYSCALL_MAP (mq_notify);
SYSCALL_MAP (mq_getsetattr);
SYSCALL_MAP (kexec_load);
SYSCALL_MAP (waitid);
SYSCALL_MAP (add_key);
SYSCALL_MAP (request_key);
SYSCALL_MAP (keyctl);
SYSCALL_MAP (ioprio_set);
SYSCALL_MAP (ioprio_get);
SYSCALL_MAP (inotify_init);
SYSCALL_MAP (inotify_add_watch);
SYSCALL_MAP (inotify_rm_watch);
SYSCALL_MAP (migrate_pages);
SYSCALL_MAP (openat);
SYSCALL_MAP (mkdirat);
SYSCALL_MAP (mknodat);
SYSCALL_MAP (fchownat);
SYSCALL_MAP (futimesat);
SYSCALL_MAP (fstatat64);
SYSCALL_MAP (unlinkat);
SYSCALL_MAP (renameat);
SYSCALL_MAP (linkat);
SYSCALL_MAP (symlinkat);
SYSCALL_MAP (readlinkat);
SYSCALL_MAP (fchmodat);
SYSCALL_MAP (faccessat);
SYSCALL_MAP (pselect6);
SYSCALL_MAP (ppoll);
SYSCALL_MAP (unshare);
SYSCALL_MAP (set_robust_list);
SYSCALL_MAP (get_robust_list);
SYSCALL_MAP (splice);
SYSCALL_MAP (sync_file_range);
SYSCALL_MAP (tee);
SYSCALL_MAP (vmsplice);
SYSCALL_MAP (move_pages);
SYSCALL_MAP (getcpu);
SYSCALL_MAP (epoll_pwait);
UNSUPPORTED_SYSCALL_MAP (utimensat);
UNSUPPORTED_SYSCALL_MAP (signalfd);
UNSUPPORTED_SYSCALL_MAP (timerfd_create);
UNSUPPORTED_SYSCALL_MAP (eventfd);
SYSCALL_MAP (fallocate);
UNSUPPORTED_SYSCALL_MAP (timerfd_settime);
UNSUPPORTED_SYSCALL_MAP (timerfd_gettime);
UNSUPPORTED_SYSCALL_MAP (signalfd4);
SYSCALL_MAP (eventfd2);
SYSCALL_MAP (epoll_create1);
SYSCALL_MAP (dup3);
SYSCALL_MAP (pipe2);
SYSCALL_MAP (inotify_init1);
UNSUPPORTED_SYSCALL_MAP (preadv);
UNSUPPORTED_SYSCALL_MAP (pwritev);
UNSUPPORTED_SYSCALL_MAP (rt_tgsigqueueinfo);
UNSUPPORTED_SYSCALL_MAP (perf_event_open);
UNSUPPORTED_SYSCALL_MAP (recvmmsg);
UNSUPPORTED_SYSCALL_MAP (fanotify_init);
UNSUPPORTED_SYSCALL_MAP (fanotify_mark);
UNSUPPORTED_SYSCALL_MAP (prlimit64);
UNSUPPORTED_SYSCALL_MAP (name_to_handle_at);
UNSUPPORTED_SYSCALL_MAP (open_by_handle_at);
UNSUPPORTED_SYSCALL_MAP (clock_adjtime);
UNSUPPORTED_SYSCALL_MAP (syncfs);
UNSUPPORTED_SYSCALL_MAP (sendmmsg);
UNSUPPORTED_SYSCALL_MAP (setns);
UNSUPPORTED_SYSCALL_MAP (process_vm_readv);
UNSUPPORTED_SYSCALL_MAP (process_vm_writev);
UNSUPPORTED_SYSCALL_MAP (kcmp);
UNSUPPORTED_SYSCALL_MAP (finit_module);
UNSUPPORTED_SYSCALL_MAP (sched_setattr);
UNSUPPORTED_SYSCALL_MAP (sched_getattr);
UNSUPPORTED_SYSCALL_MAP (renameat2);
UNSUPPORTED_SYSCALL_MAP (seccomp);
SYSCALL_MAP (getrandom);
UNSUPPORTED_SYSCALL_MAP (memfd_create);
UNSUPPORTED_SYSCALL_MAP (bpf);
UNSUPPORTED_SYSCALL_MAP (execveat);
SYSCALL_MAP (socket);
SYSCALL_MAP (socketpair);
SYSCALL_MAP (bind);
SYSCALL_MAP (connect);
SYSCALL_MAP (listen);
UNSUPPORTED_SYSCALL_MAP (accept4);
SYSCALL_MAP (getsockopt);
SYSCALL_MAP (setsockopt);
SYSCALL_MAP (getsockname);
SYSCALL_MAP (getpeername);
SYSCALL_MAP (sendto);
SYSCALL_MAP (sendmsg);
SYSCALL_MAP (recvfrom);
SYSCALL_MAP (recvmsg);
SYSCALL_MAP (shutdown);
UNSUPPORTED_SYSCALL_MAP (userfaultfd);
UNSUPPORTED_SYSCALL_MAP (membarrier);
UNSUPPORTED_SYSCALL_MAP (mlock2);
UNSUPPORTED_SYSCALL_MAP (copy_file_range);
UNSUPPORTED_SYSCALL_MAP (preadv2);
UNSUPPORTED_SYSCALL_MAP (pwritev2);
UNSUPPORTED_SYSCALL_MAP (pkey_mprotect);
UNSUPPORTED_SYSCALL_MAP (pkey_alloc);
UNSUPPORTED_SYSCALL_MAP (pkey_free);
SYSCALL_MAP (statx);
UNSUPPORTED_SYSCALL_MAP (arch_prctl);
UNSUPPORTED_SYSCALL_MAP (io_pgetevents);
UNSUPPORTED_SYSCALL_MAP (rseq);
SYSCALL_MAP (semget);
SYSCALL_MAP (semctl);
SYSCALL_MAP (shmget);
SYSCALL_MAP (shmctl);
SYSCALL_MAP (shmat);
SYSCALL_MAP (shmdt);
SYSCALL_MAP (msgget);
SYSCALL_MAP (msgsnd);
SYSCALL_MAP (msgrcv);
SYSCALL_MAP (msgctl);
SYSCALL_MAP (clock_gettime64);
UNSUPPORTED_SYSCALL_MAP (clock_settime64);
UNSUPPORTED_SYSCALL_MAP (clock_adjtime64);
UNSUPPORTED_SYSCALL_MAP (clock_getres_time64);
UNSUPPORTED_SYSCALL_MAP (clock_nanosleep_time64);
UNSUPPORTED_SYSCALL_MAP (timer_gettime64);
UNSUPPORTED_SYSCALL_MAP (timer_settime64);
UNSUPPORTED_SYSCALL_MAP (timerfd_gettime64);
UNSUPPORTED_SYSCALL_MAP (timerfd_settime64);
UNSUPPORTED_SYSCALL_MAP (utimensat_time64);
UNSUPPORTED_SYSCALL_MAP (pselect6_time64);
UNSUPPORTED_SYSCALL_MAP (ppoll_time64);
UNSUPPORTED_SYSCALL_MAP (io_pgetevents_time64);
UNSUPPORTED_SYSCALL_MAP (recvmmsg_time64);
UNSUPPORTED_SYSCALL_MAP (mq_timedsend_time64);
UNSUPPORTED_SYSCALL_MAP (mq_timedreceive_time64);
SYSCALL_MAP_RENAME (semtimedop_time64, gdb_sys_semtimedop);
UNSUPPORTED_SYSCALL_MAP (rt_sigtimedwait_time64);
UNSUPPORTED_SYSCALL_MAP (futex_time64);
UNSUPPORTED_SYSCALL_MAP (sched_rr_get_interval_time64);
UNSUPPORTED_SYSCALL_MAP (pidfd_send_signal);
UNSUPPORTED_SYSCALL_MAP (io_uring_setup);
UNSUPPORTED_SYSCALL_MAP (io_uring_enter);
UNSUPPORTED_SYSCALL_MAP (io_uring_register);
UNSUPPORTED_SYSCALL_MAP (open_tree);
UNSUPPORTED_SYSCALL_MAP (move_mount);
UNSUPPORTED_SYSCALL_MAP (fsopen);
UNSUPPORTED_SYSCALL_MAP (fsconfig);
UNSUPPORTED_SYSCALL_MAP (fsmount);
UNSUPPORTED_SYSCALL_MAP (fspick);
UNSUPPORTED_SYSCALL_MAP (pidfd_open);
UNSUPPORTED_SYSCALL_MAP (clone3);
UNSUPPORTED_SYSCALL_MAP (close_range);
UNSUPPORTED_SYSCALL_MAP (openat2);
UNSUPPORTED_SYSCALL_MAP (pidfd_getfd);
UNSUPPORTED_SYSCALL_MAP (faccessat2);
UNSUPPORTED_SYSCALL_MAP (process_madvise);
UNSUPPORTED_SYSCALL_MAP (epoll_pwait2);
UNSUPPORTED_SYSCALL_MAP (mount_setattr);
UNSUPPORTED_SYSCALL_MAP (quotactl_fd);
UNSUPPORTED_SYSCALL_MAP (landlock_create_ruleset);
UNSUPPORTED_SYSCALL_MAP (landlock_add_rule);
UNSUPPORTED_SYSCALL_MAP (landlock_restrict_self);
UNSUPPORTED_SYSCALL_MAP (memfd_secret);
UNSUPPORTED_SYSCALL_MAP (process_mrelease);
UNSUPPORTED_SYSCALL_MAP (futex_waitv);
UNSUPPORTED_SYSCALL_MAP (set_mempolicy_home_node);
UNSUPPORTED_SYSCALL_MAP (cachestat);
UNSUPPORTED_SYSCALL_MAP (fchmodat2);
UNSUPPORTED_SYSCALL_MAP (map_shadow_stack);
UNSUPPORTED_SYSCALL_MAP (futex_wake);
UNSUPPORTED_SYSCALL_MAP (futex_wait);
UNSUPPORTED_SYSCALL_MAP (futex_requeue);
UNSUPPORTED_SYSCALL_MAP (statmount);
UNSUPPORTED_SYSCALL_MAP (listmount);
UNSUPPORTED_SYSCALL_MAP (lsm_get_self_attr);
UNSUPPORTED_SYSCALL_MAP (lsm_set_self_attr);
UNSUPPORTED_SYSCALL_MAP (lsm_list_modules);
UNSUPPORTED_SYSCALL_MAP (mseal);
UNSUPPORTED_SYSCALL_MAP (setxattrat);
UNSUPPORTED_SYSCALL_MAP (getxattrat);
UNSUPPORTED_SYSCALL_MAP (listxattrat);
UNSUPPORTED_SYSCALL_MAP (removexattrat);
#undef SYSCALL_MAP
#undef SYSCALL_MAP_RENAME
#undef UNSUPPORTED_SYSCALL_MAP
default:
return gdb_sys_no_syscall;
}
}
/* Value of the sigcode in case of a boundary fault. */

479
gdb/i386-syscalls.def Normal file
View File

@@ -0,0 +1,479 @@
/* Copyright (C) 2025 Free Software Foundation, Inc.
This file is part of GDB.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
Generated using linux v6.13 and command:
$ egrep -v "^#.*" ./arch/x86/entry/syscalls/syscall_32.tbl \
| awk '{printf "SYSCALL (%s, %s)\n", $1, $3}'
*/
SYSCALL (0, restart_syscall)
SYSCALL (1, exit)
SYSCALL (2, fork)
SYSCALL (3, read)
SYSCALL (4, write)
SYSCALL (5, open)
SYSCALL (6, close)
SYSCALL (7, waitpid)
SYSCALL (8, creat)
SYSCALL (9, link)
SYSCALL (10, unlink)
SYSCALL (11, execve)
SYSCALL (12, chdir)
SYSCALL (13, time)
SYSCALL (14, mknod)
SYSCALL (15, chmod)
SYSCALL (16, lchown)
SYSCALL (17, break)
SYSCALL (18, oldstat)
SYSCALL (19, lseek)
SYSCALL (20, getpid)
SYSCALL (21, mount)
SYSCALL (22, umount)
SYSCALL (23, setuid)
SYSCALL (24, getuid)
SYSCALL (25, stime)
SYSCALL (26, ptrace)
SYSCALL (27, alarm)
SYSCALL (28, oldfstat)
SYSCALL (29, pause)
SYSCALL (30, utime)
SYSCALL (31, stty)
SYSCALL (32, gtty)
SYSCALL (33, access)
SYSCALL (34, nice)
SYSCALL (35, ftime)
SYSCALL (36, sync)
SYSCALL (37, kill)
SYSCALL (38, rename)
SYSCALL (39, mkdir)
SYSCALL (40, rmdir)
SYSCALL (41, dup)
SYSCALL (42, pipe)
SYSCALL (43, times)
SYSCALL (44, prof)
SYSCALL (45, brk)
SYSCALL (46, setgid)
SYSCALL (47, getgid)
SYSCALL (48, signal)
SYSCALL (49, geteuid)
SYSCALL (50, getegid)
SYSCALL (51, acct)
SYSCALL (52, umount2)
SYSCALL (53, lock)
SYSCALL (54, ioctl)
SYSCALL (55, fcntl)
SYSCALL (56, mpx)
SYSCALL (57, setpgid)
SYSCALL (58, ulimit)
SYSCALL (59, oldolduname)
SYSCALL (60, umask)
SYSCALL (61, chroot)
SYSCALL (62, ustat)
SYSCALL (63, dup2)
SYSCALL (64, getppid)
SYSCALL (65, getpgrp)
SYSCALL (66, setsid)
SYSCALL (67, sigaction)
SYSCALL (68, sgetmask)
SYSCALL (69, ssetmask)
SYSCALL (70, setreuid)
SYSCALL (71, setregid)
SYSCALL (72, sigsuspend)
SYSCALL (73, sigpending)
SYSCALL (74, sethostname)
SYSCALL (75, setrlimit)
SYSCALL (76, getrlimit)
SYSCALL (77, getrusage)
SYSCALL (78, gettimeofday)
SYSCALL (79, settimeofday)
SYSCALL (80, getgroups)
SYSCALL (81, setgroups)
SYSCALL (82, select)
SYSCALL (83, symlink)
SYSCALL (84, oldlstat)
SYSCALL (85, readlink)
SYSCALL (86, uselib)
SYSCALL (87, swapon)
SYSCALL (88, reboot)
SYSCALL (89, readdir)
SYSCALL (90, mmap)
SYSCALL (91, munmap)
SYSCALL (92, truncate)
SYSCALL (93, ftruncate)
SYSCALL (94, fchmod)
SYSCALL (95, fchown)
SYSCALL (96, getpriority)
SYSCALL (97, setpriority)
SYSCALL (98, profil)
SYSCALL (99, statfs)
SYSCALL (100, fstatfs)
SYSCALL (101, ioperm)
SYSCALL (102, socketcall)
SYSCALL (103, syslog)
SYSCALL (104, setitimer)
SYSCALL (105, getitimer)
SYSCALL (106, stat)
SYSCALL (107, lstat)
SYSCALL (108, fstat)
SYSCALL (109, olduname)
SYSCALL (110, iopl)
SYSCALL (111, vhangup)
SYSCALL (112, idle)
SYSCALL (113, vm86old)
SYSCALL (114, wait4)
SYSCALL (115, swapoff)
SYSCALL (116, sysinfo)
SYSCALL (117, ipc)
SYSCALL (118, fsync)
SYSCALL (119, sigreturn)
SYSCALL (120, clone)
SYSCALL (121, setdomainname)
SYSCALL (122, uname)
SYSCALL (123, modify_ldt)
SYSCALL (124, adjtimex)
SYSCALL (125, mprotect)
SYSCALL (126, sigprocmask)
SYSCALL (127, create_module)
SYSCALL (128, init_module)
SYSCALL (129, delete_module)
SYSCALL (130, get_kernel_syms)
SYSCALL (131, quotactl)
SYSCALL (132, getpgid)
SYSCALL (133, fchdir)
SYSCALL (134, bdflush)
SYSCALL (135, sysfs)
SYSCALL (136, personality)
SYSCALL (137, afs_syscall)
SYSCALL (138, setfsuid)
SYSCALL (139, setfsgid)
SYSCALL (140, _llseek)
SYSCALL (141, getdents)
SYSCALL (142, _newselect)
SYSCALL (143, flock)
SYSCALL (144, msync)
SYSCALL (145, readv)
SYSCALL (146, writev)
SYSCALL (147, getsid)
SYSCALL (148, fdatasync)
SYSCALL (149, _sysctl)
SYSCALL (150, mlock)
SYSCALL (151, munlock)
SYSCALL (152, mlockall)
SYSCALL (153, munlockall)
SYSCALL (154, sched_setparam)
SYSCALL (155, sched_getparam)
SYSCALL (156, sched_setscheduler)
SYSCALL (157, sched_getscheduler)
SYSCALL (158, sched_yield)
SYSCALL (159, sched_get_priority_max)
SYSCALL (160, sched_get_priority_min)
SYSCALL (161, sched_rr_get_interval)
SYSCALL (162, nanosleep)
SYSCALL (163, mremap)
SYSCALL (164, setresuid)
SYSCALL (165, getresuid)
SYSCALL (166, vm86)
SYSCALL (167, query_module)
SYSCALL (168, poll)
SYSCALL (169, nfsservctl)
SYSCALL (170, setresgid)
SYSCALL (171, getresgid)
SYSCALL (172, prctl)
SYSCALL (173, rt_sigreturn)
SYSCALL (174, rt_sigaction)
SYSCALL (175, rt_sigprocmask)
SYSCALL (176, rt_sigpending)
SYSCALL (177, rt_sigtimedwait)
SYSCALL (178, rt_sigqueueinfo)
SYSCALL (179, rt_sigsuspend)
SYSCALL (180, pread64)
SYSCALL (181, pwrite64)
SYSCALL (182, chown)
SYSCALL (183, getcwd)
SYSCALL (184, capget)
SYSCALL (185, capset)
SYSCALL (186, sigaltstack)
SYSCALL (187, sendfile)
SYSCALL (188, getpmsg)
SYSCALL (189, putpmsg)
SYSCALL (190, vfork)
SYSCALL (191, ugetrlimit)
SYSCALL (192, mmap2)
SYSCALL (193, truncate64)
SYSCALL (194, ftruncate64)
SYSCALL (195, stat64)
SYSCALL (196, lstat64)
SYSCALL (197, fstat64)
SYSCALL (198, lchown32)
SYSCALL (199, getuid32)
SYSCALL (200, getgid32)
SYSCALL (201, geteuid32)
SYSCALL (202, getegid32)
SYSCALL (203, setreuid32)
SYSCALL (204, setregid32)
SYSCALL (205, getgroups32)
SYSCALL (206, setgroups32)
SYSCALL (207, fchown32)
SYSCALL (208, setresuid32)
SYSCALL (209, getresuid32)
SYSCALL (210, setresgid32)
SYSCALL (211, getresgid32)
SYSCALL (212, chown32)
SYSCALL (213, setuid32)
SYSCALL (214, setgid32)
SYSCALL (215, setfsuid32)
SYSCALL (216, setfsgid32)
SYSCALL (217, pivot_root)
SYSCALL (218, mincore)
SYSCALL (219, madvise)
SYSCALL (220, getdents64)
SYSCALL (221, fcntl64)
SYSCALL (224, gettid)
SYSCALL (225, readahead)
SYSCALL (226, setxattr)
SYSCALL (227, lsetxattr)
SYSCALL (228, fsetxattr)
SYSCALL (229, getxattr)
SYSCALL (230, lgetxattr)
SYSCALL (231, fgetxattr)
SYSCALL (232, listxattr)
SYSCALL (233, llistxattr)
SYSCALL (234, flistxattr)
SYSCALL (235, removexattr)
SYSCALL (236, lremovexattr)
SYSCALL (237, fremovexattr)
SYSCALL (238, tkill)
SYSCALL (239, sendfile64)
SYSCALL (240, futex)
SYSCALL (241, sched_setaffinity)
SYSCALL (242, sched_getaffinity)
SYSCALL (243, set_thread_area)
SYSCALL (244, get_thread_area)
SYSCALL (245, io_setup)
SYSCALL (246, io_destroy)
SYSCALL (247, io_getevents)
SYSCALL (248, io_submit)
SYSCALL (249, io_cancel)
SYSCALL (250, fadvise64)
SYSCALL (252, exit_group)
SYSCALL (253, lookup_dcookie)
SYSCALL (254, epoll_create)
SYSCALL (255, epoll_ctl)
SYSCALL (256, epoll_wait)
SYSCALL (257, remap_file_pages)
SYSCALL (258, set_tid_address)
SYSCALL (259, timer_create)
SYSCALL (260, timer_settime)
SYSCALL (261, timer_gettime)
SYSCALL (262, timer_getoverrun)
SYSCALL (263, timer_delete)
SYSCALL (264, clock_settime)
SYSCALL (265, clock_gettime)
SYSCALL (266, clock_getres)
SYSCALL (267, clock_nanosleep)
SYSCALL (268, statfs64)
SYSCALL (269, fstatfs64)
SYSCALL (270, tgkill)
SYSCALL (271, utimes)
SYSCALL (272, fadvise64_64)
SYSCALL (273, vserver)
SYSCALL (274, mbind)
SYSCALL (275, get_mempolicy)
SYSCALL (276, set_mempolicy)
SYSCALL (277, mq_open)
SYSCALL (278, mq_unlink)
SYSCALL (279, mq_timedsend)
SYSCALL (280, mq_timedreceive)
SYSCALL (281, mq_notify)
SYSCALL (282, mq_getsetattr)
SYSCALL (283, kexec_load)
SYSCALL (284, waitid)
SYSCALL (286, add_key)
SYSCALL (287, request_key)
SYSCALL (288, keyctl)
SYSCALL (289, ioprio_set)
SYSCALL (290, ioprio_get)
SYSCALL (291, inotify_init)
SYSCALL (292, inotify_add_watch)
SYSCALL (293, inotify_rm_watch)
SYSCALL (294, migrate_pages)
SYSCALL (295, openat)
SYSCALL (296, mkdirat)
SYSCALL (297, mknodat)
SYSCALL (298, fchownat)
SYSCALL (299, futimesat)
SYSCALL (300, fstatat64)
SYSCALL (301, unlinkat)
SYSCALL (302, renameat)
SYSCALL (303, linkat)
SYSCALL (304, symlinkat)
SYSCALL (305, readlinkat)
SYSCALL (306, fchmodat)
SYSCALL (307, faccessat)
SYSCALL (308, pselect6)
SYSCALL (309, ppoll)
SYSCALL (310, unshare)
SYSCALL (311, set_robust_list)
SYSCALL (312, get_robust_list)
SYSCALL (313, splice)
SYSCALL (314, sync_file_range)
SYSCALL (315, tee)
SYSCALL (316, vmsplice)
SYSCALL (317, move_pages)
SYSCALL (318, getcpu)
SYSCALL (319, epoll_pwait)
SYSCALL (320, utimensat)
SYSCALL (321, signalfd)
SYSCALL (322, timerfd_create)
SYSCALL (323, eventfd)
SYSCALL (324, fallocate)
SYSCALL (325, timerfd_settime)
SYSCALL (326, timerfd_gettime)
SYSCALL (327, signalfd4)
SYSCALL (328, eventfd2)
SYSCALL (329, epoll_create1)
SYSCALL (330, dup3)
SYSCALL (331, pipe2)
SYSCALL (332, inotify_init1)
SYSCALL (333, preadv)
SYSCALL (334, pwritev)
SYSCALL (335, rt_tgsigqueueinfo)
SYSCALL (336, perf_event_open)
SYSCALL (337, recvmmsg)
SYSCALL (338, fanotify_init)
SYSCALL (339, fanotify_mark)
SYSCALL (340, prlimit64)
SYSCALL (341, name_to_handle_at)
SYSCALL (342, open_by_handle_at)
SYSCALL (343, clock_adjtime)
SYSCALL (344, syncfs)
SYSCALL (345, sendmmsg)
SYSCALL (346, setns)
SYSCALL (347, process_vm_readv)
SYSCALL (348, process_vm_writev)
SYSCALL (349, kcmp)
SYSCALL (350, finit_module)
SYSCALL (351, sched_setattr)
SYSCALL (352, sched_getattr)
SYSCALL (353, renameat2)
SYSCALL (354, seccomp)
SYSCALL (355, getrandom)
SYSCALL (356, memfd_create)
SYSCALL (357, bpf)
SYSCALL (358, execveat)
SYSCALL (359, socket)
SYSCALL (360, socketpair)
SYSCALL (361, bind)
SYSCALL (362, connect)
SYSCALL (363, listen)
SYSCALL (364, accept4)
SYSCALL (365, getsockopt)
SYSCALL (366, setsockopt)
SYSCALL (367, getsockname)
SYSCALL (368, getpeername)
SYSCALL (369, sendto)
SYSCALL (370, sendmsg)
SYSCALL (371, recvfrom)
SYSCALL (372, recvmsg)
SYSCALL (373, shutdown)
SYSCALL (374, userfaultfd)
SYSCALL (375, membarrier)
SYSCALL (376, mlock2)
SYSCALL (377, copy_file_range)
SYSCALL (378, preadv2)
SYSCALL (379, pwritev2)
SYSCALL (380, pkey_mprotect)
SYSCALL (381, pkey_alloc)
SYSCALL (382, pkey_free)
SYSCALL (383, statx)
SYSCALL (384, arch_prctl)
SYSCALL (385, io_pgetevents)
SYSCALL (386, rseq)
SYSCALL (393, semget)
SYSCALL (394, semctl)
SYSCALL (395, shmget)
SYSCALL (396, shmctl)
SYSCALL (397, shmat)
SYSCALL (398, shmdt)
SYSCALL (399, msgget)
SYSCALL (400, msgsnd)
SYSCALL (401, msgrcv)
SYSCALL (402, msgctl)
SYSCALL (403, clock_gettime64)
SYSCALL (404, clock_settime64)
SYSCALL (405, clock_adjtime64)
SYSCALL (406, clock_getres_time64)
SYSCALL (407, clock_nanosleep_time64)
SYSCALL (408, timer_gettime64)
SYSCALL (409, timer_settime64)
SYSCALL (410, timerfd_gettime64)
SYSCALL (411, timerfd_settime64)
SYSCALL (412, utimensat_time64)
SYSCALL (413, pselect6_time64)
SYSCALL (414, ppoll_time64)
SYSCALL (416, io_pgetevents_time64)
SYSCALL (417, recvmmsg_time64)
SYSCALL (418, mq_timedsend_time64)
SYSCALL (419, mq_timedreceive_time64)
SYSCALL (420, semtimedop_time64)
SYSCALL (421, rt_sigtimedwait_time64)
SYSCALL (422, futex_time64)
SYSCALL (423, sched_rr_get_interval_time64)
SYSCALL (424, pidfd_send_signal)
SYSCALL (425, io_uring_setup)
SYSCALL (426, io_uring_enter)
SYSCALL (427, io_uring_register)
SYSCALL (428, open_tree)
SYSCALL (429, move_mount)
SYSCALL (430, fsopen)
SYSCALL (431, fsconfig)
SYSCALL (432, fsmount)
SYSCALL (433, fspick)
SYSCALL (434, pidfd_open)
SYSCALL (435, clone3)
SYSCALL (436, close_range)
SYSCALL (437, openat2)
SYSCALL (438, pidfd_getfd)
SYSCALL (439, faccessat2)
SYSCALL (440, process_madvise)
SYSCALL (441, epoll_pwait2)
SYSCALL (442, mount_setattr)
SYSCALL (443, quotactl_fd)
SYSCALL (444, landlock_create_ruleset)
SYSCALL (445, landlock_add_rule)
SYSCALL (446, landlock_restrict_self)
SYSCALL (447, memfd_secret)
SYSCALL (448, process_mrelease)
SYSCALL (449, futex_waitv)
SYSCALL (450, set_mempolicy_home_node)
SYSCALL (451, cachestat)
SYSCALL (452, fchmodat2)
SYSCALL (453, map_shadow_stack)
SYSCALL (454, futex_wake)
SYSCALL (455, futex_wait)
SYSCALL (456, futex_requeue)
SYSCALL (457, statmount)
SYSCALL (458, listmount)
SYSCALL (459, lsm_get_self_attr)
SYSCALL (460, lsm_set_self_attr)
SYSCALL (461, lsm_list_modules)
SYSCALL (462, mseal)
SYSCALL (463, setxattrat)
SYSCALL (464, getxattrat)
SYSCALL (465, listxattrat)
SYSCALL (466, removexattrat)

View File

@@ -665,6 +665,8 @@ jit_object_close_impl (struct gdb_symbol_callbacks *cb,
objfile *objfile = objfile::make (nullptr, current_program_space,
objfile_name.c_str (), OBJF_NOT_FILENAME);
objfile->section_offsets.push_back (0);
objfile->sect_index_text = 0;
objfile->per_bfd->gdbarch = priv_data->gdbarch;
for (gdb_symtab &symtab : obj->symtabs)

View File

@@ -854,7 +854,7 @@ linux_info_proc (struct gdbarch *gdbarch, const char *args,
{
xsnprintf (filename, sizeof filename, "/proc/%ld/cmdline", pid);
gdb_byte *buffer;
ssize_t len = target_fileio_read_alloc (NULL, filename, &buffer);
LONGEST len = target_fileio_read_alloc (nullptr, filename, &buffer);
if (len > 0)
{
@@ -2180,17 +2180,17 @@ linux_fill_prpsinfo (struct elf_internal_linux_prpsinfo *p)
/* The number of fields read by `sscanf'. */
int n_fields = 0;
gdb_assert (p != NULL);
gdb_assert (p != nullptr);
/* Obtaining PID and filename. */
pid = inferior_ptid.pid ();
xsnprintf (filename, sizeof (filename), "/proc/%d/cmdline", (int) pid);
/* The full name of the program which generated the corefile. */
gdb_byte *buf = NULL;
size_t buf_len = target_fileio_read_alloc (NULL, filename, &buf);
gdb_byte *buf = nullptr;
LONGEST buf_len = target_fileio_read_alloc (nullptr, filename, &buf);
gdb::unique_xmalloc_ptr<char> fname ((char *)buf);
if (buf_len < 1 || fname.get ()[0] == '\0')
if (buf_len < 1 || fname.get () == nullptr || fname.get ()[0] == '\0')
{
/* No program name was read, so we won't be able to retrieve more
information about the process. */

View File

@@ -46,6 +46,7 @@
#include "gdbsupport/scoped_fd.h"
#include "gdbsupport/pathstuff.h"
#include "gdbsupport/buildargv.h"
#include "gdbsupport/eintr.h"
#include "cli/cli-style.h"
/* This module provides the interface between GDB and the

View File

@@ -21,7 +21,7 @@ from typing import Optional, Sequence
import gdb
from .server import capability, request, send_event
from .server import capability, export_line, import_line, request, send_event
from .sources import make_source
from .startup import (
DAPException,
@@ -128,7 +128,7 @@ def _breakpoint_descriptor(bp):
result.update(
{
"source": make_source(filename),
"line": line,
"line": export_line(line),
}
)
@@ -281,7 +281,7 @@ def _rewrite_src_breakpoint(
):
return {
"source": source["path"],
"line": line,
"line": import_line(line),
"condition": condition,
"hitCondition": hitCondition,
"logMessage": logMessage,

View File

@@ -21,7 +21,7 @@ import gdb
from .frames import dap_frame_generator
from .modules import module_id
from .scopes import symbol_value
from .server import capability, request
from .server import capability, export_line, request
from .sources import make_source
from .startup import in_gdb_thread
from .state import set_thread
@@ -86,8 +86,11 @@ def _backtrace(thread_id, levels, startFrame, stack_format):
}
line = current_frame.line()
if line is not None:
newframe["line"] = line
newframe["line"] = export_line(line)
if stack_format["line"]:
# Unclear whether export_line should be called
# here, but since it's just for users we pick the
# gdb representation.
name += ", line " + str(line)
objfile = gdb.current_progspace().objfile_for_address(pc)
if objfile is not None:

View File

@@ -15,7 +15,7 @@
import gdb
from .server import capability, request
from .server import capability, export_line, request
from .sources import make_source
@@ -53,7 +53,7 @@ class _BlockTracker:
sal = gdb.find_pc_line(pc)
if sal.symtab is not None:
if sal.line != 0:
result["line"] = sal.line
result["line"] = export_line(sal.line)
if sal.symtab.filename is not None:
# The spec says this can be omitted in some
# situations, but it's a little simpler to just always

View File

@@ -16,7 +16,7 @@
# This is deprecated in 3.9, but required in older versions.
from typing import Optional
from .server import capability, request
from .server import capability, export_line, import_line, request
from .sources import decode_source
from .startup import exec_mi_and_log
@@ -31,12 +31,15 @@ from .startup import exec_mi_and_log
@request("breakpointLocations", expect_stopped=False)
@capability("supportsBreakpointLocationsRequest")
def breakpoint_locations(*, source, line: int, endLine: Optional[int] = None, **extra):
line = import_line(line)
if endLine is None:
endLine = line
else:
endLine = import_line(endLine)
filename = decode_source(source)
lines = set()
for entry in exec_mi_and_log("-symbol-list-lines", filename)["lines"]:
this_line = entry["line"]
if this_line >= line and this_line <= endLine:
lines.add(this_line)
lines.add(export_line(this_line))
return {"breakpoints": [{"line": x} for x in sorted(lines)]}

View File

@@ -17,7 +17,7 @@ import gdb
from .frames import frame_for_id
from .globalvars import get_global_scope
from .server import request
from .server import export_line, request
from .sources import make_source
from .startup import in_gdb_thread
from .varref import BaseReference
@@ -92,7 +92,7 @@ class _ScopeReference(BaseReference):
result["namedVariables"] = self.child_count()
frame = frame_for_id(self.frameId)
if frame.line() is not None:
result["line"] = frame.line()
result["line"] = export_line(frame.line())
filename = frame.filename()
if filename is not None:
result["source"] = make_source(filename)

View File

@@ -46,6 +46,10 @@ _commands = {}
# The global server.
_server = None
# This is set by the initialize request and is used when rewriting
# line numbers.
_lines_start_at_1 = False
class DeferredRequest:
"""If a DAP request function returns a deferred request, no
@@ -571,15 +575,15 @@ def capability(name, value=True):
return wrap
def client_bool_capability(name):
def client_bool_capability(name, default=False):
"""Return the value of a boolean client capability.
If the capability was not specified, or did not have boolean type,
False is returned."""
DEFAULT is returned. DEFAULT defaults to False."""
global _server
if name in _server.config and isinstance(_server.config[name], bool):
return _server.config[name]
return False
return default
@request("initialize", on_dap_thread=True)
@@ -587,6 +591,8 @@ def initialize(**args):
global _server, _capabilities
_server.config = args
_server.send_event_later("initialized")
global _lines_start_at_1
_lines_start_at_1 = client_bool_capability("linesStartAt1", True)
return _capabilities.copy()
@@ -690,3 +696,27 @@ def send_gdb_with_response(fn):
if isinstance(val, (Exception, KeyboardInterrupt)):
raise val
return val
def export_line(line):
"""Rewrite LINE according to client capability.
This applies the linesStartAt1 capability as needed,
when sending a line number from gdb to the client."""
global _lines_start_at_1
if not _lines_start_at_1:
# In gdb, lines start at 1, so we only need to change this if
# the client starts at 0.
line = line - 1
return line
def import_line(line):
"""Rewrite LINE according to client capability.
This applies the linesStartAt1 capability as needed,
when the client sends a line number to gdb."""
global _lines_start_at_1
if not _lines_start_at_1:
# In gdb, lines start at 1, so we only need to change this if
# the client starts at 0.
line = line + 1
return line

View File

@@ -5847,6 +5847,7 @@ static const struct protocol_feature remote_protocol_features[] = {
PACKET_memory_tagging_feature },
{ "error-message", PACKET_ENABLE, remote_supported_packet,
PACKET_accept_error_message },
{ "binary-upload", PACKET_DISABLE, remote_supported_packet, PACKET_x },
};
static char *remote_support_xml;

View File

@@ -69,7 +69,7 @@ gdb_test_multiple "core-file $corefile_1" "load core file no args" {
}
# Generate a core file, this time pass some arguments to the inferior.
set args "aaaaa bbbbb ccccc ddddd eeeee"
set args "aaaaa bbbbb ccccc ddddd e\\\\ e\\\\ e\\\\ e\\\\ e"
set corefile [core_find $binfile {} $args]
if {$corefile == ""} {
untested "unable to create corefile"
@@ -101,6 +101,27 @@ gdb_test_multiple "core-file $corefile_2" "load core file with args" {
gdb_test "show args" \
"Argument list to give program being debugged when it is started is \"$args\"\\."
# Move up to 'main'. Do it this way because we cannot know how many
# frames up 'main' actually is.
gdb_test_multiple "up" "move up to main" {
-re -wrap "#$decimal\\s+\[^\r\n\]+ in main .*" {
pass $gdb_test_name
}
-re -wrap "#$decimal\\s+\[^\r\n\]+ in .*" {
send_gdb "up\n"
exp_continue
}
}
# Check that the inferior was started with the expected arguments.
gdb_test "print argc" " = 6"
gdb_test "print argv\[1\]" " = $hex \"aaaaa\""
gdb_test "print argv\[2\]" " = $hex \"bbbbb\""
gdb_test "print argv\[3\]" " = $hex \"ccccc\""
gdb_test "print argv\[4\]" " = $hex \"ddddd\""
gdb_test "print argv\[5\]" " = $hex \"e e e e e\""
# Find the name of an environment variable that is not set.
set env_var_base "GDB_TEST_ENV_VAR_"
set env_var_name ""

View File

@@ -692,7 +692,7 @@ set show_conv_list \
{$_gdb_setting_str = <internal function _gdb_setting_str>} \
{$_gdb_setting = <internal function _gdb_setting>} \
{$_gdb_major = 16} \
{$_gdb_minor = 1} \
{$_gdb_minor = 3} \
{$_shell_exitsignal = void} \
{$_shell_exitcode = 0} \
}

View File

@@ -1,4 +1,4 @@
# Copyright (C) 2024 Free Software Foundation, Inc.
# Copyright (C) 2024-2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -60,8 +60,10 @@ if { ![gdb_assert { ![expr {$res < 0 || $res == ""}] } $test] } {
set test "got backtrace"
set saw_backtrace false
set no_awk false
set location_re ${srcfile}:${decimal}
gdb_test_multiple "" $test {
-i "$res" -re "#0 +(0x\[0-9a-f\]+ in )?main \(\).*\r\nGSTACK-END\r\n\$" {
-i "$res" -re "#0 +(0x\[0-9a-f\]+ in )?main \(\).*$location_re.*\r\nGSTACK-END\r\n\$" {
set saw_backtrace true
pass $test
exp_continue

View File

@@ -72,77 +72,89 @@ gdb_continue_to_breakpoint "stop at test breakpoint"
gdb_test_no_output "source ${pyfile}"\
"import python scripts"
# Check the unbroken stack.
gdb_test_sequence "bt" "backtrace when the unwind is left unbroken" {
"\\r\\n#0 \[^\r\n\]* inline_func \\(\\) at "
"\\r\\n#1 \[^\r\n\]* normal_func \\(\\) at "
"\\r\\n#2 \[^\r\n\]* inline_func \\(\\) at "
"\\r\\n#3 \[^\r\n\]* normal_func \\(\\) at "
"\\r\\n#4 \[^\r\n\]* inline_func \\(\\) at "
"\\r\\n#5 \[^\r\n\]* normal_func \\(\\) at "
"\\r\\n#6 \[^\r\n\]* main \\(\\) at "
}
# Test with and without filters.
foreach bt_cmd { "bt" "bt -no-filters" } {
with_test_prefix "$bt_cmd" {
with_test_prefix "cycle at level 5" {
# Arrange to introduce a stack cycle at frame 5.
gdb_test_no_output "python stop_at_level=5"
gdb_test "maint flush register-cache" \
"Register cache flushed\\."
gdb_test_lines "bt" "backtrace when the unwind is broken at frame 5" \
[multi_line \
"#0 \[^\r\n\]* inline_func \\(\\) at \[^\r\n\]+" \
"#1 \[^\r\n\]* normal_func \\(\\) at \[^\r\n\]+" \
"#2 \[^\r\n\]* inline_func \\(\\) at \[^\r\n\]+" \
"#3 \[^\r\n\]* normal_func \\(\\) at \[^\r\n\]+" \
"#4 \[^\r\n\]* inline_func \\(\\) at \[^\r\n\]+" \
"#5 \[^\r\n\]* normal_func \\(\\) at \[^\r\n\]+" \
"Backtrace stopped: previous frame identical to this frame \\(corrupt stack\\?\\)"]
}
# Check the unbroken stack.
gdb_test_sequence "$bt_cmd" "backtrace when the unwind is left unbroken" {
"\\r\\n#0 \[^\r\n\]* inline_func \\(\\) at "
"\\r\\n#1 \[^\r\n\]* normal_func \\(\\) at "
"\\r\\n#2 \[^\r\n\]* inline_func \\(\\) at "
"\\r\\n#3 \[^\r\n\]* normal_func \\(\\) at "
"\\r\\n#4 \[^\r\n\]* inline_func \\(\\) at "
"\\r\\n#5 \[^\r\n\]* normal_func \\(\\) at "
"\\r\\n#6 \[^\r\n\]* main \\(\\) at "
}
with_test_prefix "cycle at level 3" {
# Arrange to introduce a stack cycle at frame 3.
gdb_test_no_output "python stop_at_level=3"
gdb_test "maint flush register-cache" \
"Register cache flushed\\."
gdb_test_lines "bt" "backtrace when the unwind is broken at frame 3" \
[multi_line \
"#0 \[^\r\n\]* inline_func \\(\\) at \[^\r\n\]+" \
"#1 \[^\r\n\]* normal_func \\(\\) at \[^\r\n\]+" \
"#2 \[^\r\n\]* inline_func \\(\\) at \[^\r\n\]+" \
"#3 \[^\r\n\]* normal_func \\(\\) at \[^\r\n\]+" \
"Backtrace stopped: previous frame identical to this frame \\(corrupt stack\\?\\)"]
}
with_test_prefix "cycle at level 5" {
# Arrange to introduce a stack cycle at frame 5.
gdb_test_no_output "python stop_at_level=5"
gdb_test "maint flush register-cache" \
"Register cache flushed\\."
gdb_test_lines "$bt_cmd" "backtrace when the unwind is broken at frame 5" \
[multi_line \
"#0 \[^\r\n\]* inline_func \\(\\) at \[^\r\n\]+" \
"#1 \[^\r\n\]* normal_func \\(\\) at \[^\r\n\]+" \
"#2 \[^\r\n\]* inline_func \\(\\) at \[^\r\n\]+" \
"#3 \[^\r\n\]* normal_func \\(\\) at \[^\r\n\]+" \
"#4 \[^\r\n\]* inline_func \\(\\) at \[^\r\n\]+" \
"#5 \[^\r\n\]* normal_func \\(\\) at \[^\r\n\]+" \
"Backtrace stopped: previous frame identical to this frame \\(corrupt stack\\?\\)"]
}
with_test_prefix "cycle at level 1" {
# Arrange to introduce a stack cycle at frame 1.
gdb_test_no_output "python stop_at_level=1"
gdb_test "maint flush register-cache" \
"Register cache flushed\\."
gdb_test_lines "bt" "backtrace when the unwind is broken at frame 1" \
[multi_line \
"#0 \[^\r\n\]* inline_func \\(\\) at \[^\r\n\]+" \
"#1 \[^\r\n\]* normal_func \\(\\) at \[^\r\n\]+" \
"Backtrace stopped: previous frame identical to this frame \\(corrupt stack\\?\\)"]
}
with_test_prefix "cycle at level 3" {
# Arrange to introduce a stack cycle at frame 3.
gdb_test_no_output "python stop_at_level=3"
gdb_test "maint flush register-cache" \
"Register cache flushed\\."
gdb_test_lines "$bt_cmd" "backtrace when the unwind is broken at frame 3" \
[multi_line \
"#0 \[^\r\n\]* inline_func \\(\\) at \[^\r\n\]+" \
"#1 \[^\r\n\]* normal_func \\(\\) at \[^\r\n\]+" \
"#2 \[^\r\n\]* inline_func \\(\\) at \[^\r\n\]+" \
"#3 \[^\r\n\]* normal_func \\(\\) at \[^\r\n\]+" \
"Backtrace stopped: previous frame identical to this frame \\(corrupt stack\\?\\)"]
}
# Flush the register cache (which also flushes the frame cache) so we
# get a full backtrace again, then switch on frame debugging and try
# to back trace. At one point this triggered an assertion.
gdb_test "maint flush register-cache" \
"Register cache flushed\\." ""
gdb_test_no_output "set debug frame 1"
set ok 1
gdb_test_multiple "bt" "backtrace with debugging on" {
-re "^$gdb_prompt $" {
gdb_assert { $ok } $gdb_test_name
}
-re "Python Exception <class 'gdb.error'>: \[^\r\n\]*\r\n" {
set ok 0
exp_continue
}
-re "\[^\r\n\]+\r\n" {
exp_continue
with_test_prefix "cycle at level 1" {
# Arrange to introduce a stack cycle at frame 1.
gdb_test_no_output "python stop_at_level=1"
gdb_test "maint flush register-cache" \
"Register cache flushed\\."
gdb_test_lines "$bt_cmd" "backtrace when the unwind is broken at frame 1" \
[multi_line \
"#0 \[^\r\n\]* inline_func \\(\\) at \[^\r\n\]+" \
"#1 \[^\r\n\]* normal_func \\(\\) at \[^\r\n\]+" \
"Backtrace stopped: previous frame identical to this frame \\(corrupt stack\\?\\)"]
}
# Flush the register cache (which also flushes the frame cache) so we
# get a full backtrace again, then switch on frame debugging and try
# to back trace. At one point this triggered an assertion.
gdb_test "maint flush register-cache" \
"Register cache flushed\\." ""
gdb_test_no_output "set debug frame 1"
set ok 1
gdb_test_multiple "$bt_cmd" "backtrace with debugging on" {
-re "^$gdb_prompt $" {
gdb_assert { $ok } $gdb_test_name
}
-re "Python Exception <class 'gdb.error'>: \[^\r\n\]*\r\n" {
set ok 0
exp_continue
}
-re "\[^\r\n\]+\r\n" {
exp_continue
}
}
gdb_test "p 1 + 2 + 3" " = 6" \
"ensure GDB is still alive"
# Prepare for the next iteration of the test loop
gdb_test_no_output "set debug frame 0"
gdb_test_no_output "python stop_at_level=None"
gdb_test "maint flush register-cache" \
"Register cache flushed\\." "maint flush register-cache at (loop end)"
}
}
gdb_test "p 1 + 2 + 3" " = 6" \
"ensure GDB is still alive"

View File

@@ -62,6 +62,18 @@ read_debug_info (struct gdb_reader_funcs *self,
(GDB_CORE_ADDR) symfile->function_stack_mangle.end,
"jit_function_stack_mangle");
/* Add some line table information. This ensures that GDB can handle
accepting this information, and can scan the table. However, this
information is constructed such that none of the tests actually hit any
of these line entries. */
struct gdb_line_mapping mangle_lines[] =
{
{ 1, (GDB_CORE_ADDR) symfile->function_stack_mangle.begin + 0 },
{ 0, (GDB_CORE_ADDR) symfile->function_stack_mangle.begin + 1 },
};
int mangle_nlines = sizeof (mangle_lines) / sizeof (mangle_lines[0]);
cbs->line_mapping_add (cbs, symtab, mangle_nlines, mangle_lines);
cbs->block_open (cbs, symtab, NULL,
(GDB_CORE_ADDR) symfile->function_add.begin,
(GDB_CORE_ADDR) symfile->function_add.end,

View File

@@ -1162,3 +1162,9 @@ test-thread-apply
# Basic "info threads" integration tests.
test-info-threads
# There was a bug where the "metasyntactic variable" was glued to the
# option.
gdb_test "help maintenance test-options unknown-is-operand" \
"-string STRING.*-filename FILENAME.*" \
"option help has spaces"

View File

@@ -0,0 +1,60 @@
# Copyright 2024 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Test breakpoints when lines start at zero.
require allow_dap_tests
load_lib dap-support.exp
standard_testfile basic-dap.c
if {[build_executable ${testfile}.exp $testfile $srcfile] == -1} {
return
}
if {[dap_initialize {linesStartAt1 [l false]}] == ""} {
return
}
set launch_id [dap_launch $testfile]
# We told gdb that lines start at 0, so subtract one.
set line [expr {[gdb_get_line_number "BREAK"] - 1}]
set obj [dap_check_request_and_response "set breakpoint by line number" \
setBreakpoints \
[format {o source [o path [%s]] breakpoints [a [o line [i %d]]]} \
[list s $srcfile] $line]]
set line_bpno [dap_get_breakpoint_number $obj]
dap_check_request_and_response "configurationDone" configurationDone
dap_check_response "launch response" launch $launch_id
dap_wait_for_event_and_check "inferior started" thread "body reason" started
dap_wait_for_event_and_check "stopped at line breakpoint" stopped \
"body reason" breakpoint \
"body hitBreakpointIds" $line_bpno \
"body allThreadsStopped" true
set bt [lindex [dap_check_request_and_response "backtrace" stackTrace \
{o threadId [i 1]}] \
0]
set stop_line [dict get [lindex [dict get $bt body stackFrames] 0] line]
gdb_assert {$stop_line == $line} "stop line is 0-based"
dap_shutdown

View File

@@ -0,0 +1,62 @@
# Copyright 2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Test a nameless "enum class". This is nonsensical but previously
# made gdb crash.
load_lib dwarf.exp
require dwarf2_support
standard_testfile main.c .S
set asm_file [standard_output_file $srcfile2]
Dwarf::assemble $asm_file {
global srcfile
cu {} {
DW_TAG_compile_unit {
{DW_AT_language @DW_LANG_D}
{DW_AT_name $srcfile}
{DW_AT_comp_dir /tmp}
} {
declare_labels integer_label
integer_label: DW_TAG_base_type {
{DW_AT_byte_size 4 DW_FORM_sdata}
{DW_AT_encoding @DW_ATE_signed}
{DW_AT_name int}
}
DW_TAG_enumeration_type {
{DW_AT_type :$integer_label}
{DW_AT_enum_class 1 DW_FORM_flag}
} {
DW_TAG_enumerator {
{DW_AT_name VALUE}
{DW_AT_const_value 17 DW_FORM_sdata}
}
}
}
}
}
if {[prepare_for_testing "failed to prepare" ${testfile} \
[list $srcfile $asm_file] {nodebug}]} {
return -1
}
# The bug was a crash, so just do anything here to verify gdb is still
# alive.
gdb_test "print 23" " = 23"

View File

@@ -0,0 +1,54 @@
/* This testcase is part of GDB, the GNU debugger.
Copyright 2025 Free Software Foundation, Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include <unistd.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <errno.h>
#include <stdio.h>
int
main (int argc, char *argv[])
{
/* Don't let this test stay alive forever. */
alarm (300);
if (argc != 2)
abort ();
/* Check the file doesn't already exist. */
const char *filename = argv[1];
struct stat buf;
if (stat (filename, &buf) == 0 || errno != ENOENT)
abort ();
/* Create the file, and write something into it. */
FILE *out = fopen (filename, "w");
if (out == NULL)
abort ();
fprintf (out, "Hello World\n");
if (fclose (out) != 0)
abort ();
/* Spin until the marker file is deleted. */
while (stat (filename, &buf) == 0)
sleep (1);
return 0;
}

View File

@@ -0,0 +1,66 @@
# Copyright 2025 Free Software Foundation, Inc.
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# Check that the 'Starting program' message is correctly flushed to
# the TUI terminal as soon as it is available.
require allow_tui_tests
require target_can_use_run_cmd
tuiterm_env
standard_testfile
if {[build_executable "failed to prepare" ${testfile} ${srcfile}] == -1} {
return -1
}
Term::clean_restart 24 80 $testfile
if {![Term::enter_tui]} {
unsupported "TUI not supported"
return
}
# Pick a name for a marker file, and ensure it doesn't exist.
set marker_file [standard_output_file "marker"]
file delete $marker_file
# Run the inferior, which will create MARKER_FILE.
send_gdb "run \"$marker_file\"\n"
# Spin until MARKER_FILE appears.
while { ! [file exists $marker_file] } {
sleep 1
}
# We now know that the inferior has started, and that the 'Starting
# program: ' string should have been printed to the terminal. Don't
# use Term::wait_for here as there will be no prompt after the
# 'Starting program' message.
gdb_assert {[Term::wait_for_region_contents 0 16 80 7 "Starting program: "]} \
"starting program message has appeared"
# Delete MARKER_FILE. This will cause the inferior to exit.
file delete $marker_file
# Now wait for the prompt, and check that the inferior exited message
# appeared.
gdb_assert {[Term::wait_for ""]} \
"wait for prompt after inferior exits"
Term::check_region_contents \
"check for inferior exited message" \
0 16 80 8 \
"\\\[Inferior $decimal \[^\r\n\]+ exited normally\\\]"

View File

@@ -101,3 +101,6 @@ Term::command "finish"
Term::check_box_contents "check source box is empty after return" \
0 0 80 15 "No Source Available"
Term::check_contents "Back in main" "Value returned is .* 13"
Term::resize 30 100
Term::check_box "source box after resize" 0 0 100 19

View File

@@ -272,16 +272,19 @@ proc dap_check_request_and_response {name command {obj {}}} {
# Start gdb, send a DAP initialization request and return the
# response. This approach lets the caller check the feature list, if
# desired. Returns the empty string on failure. NAME is used as the
# test name.
proc dap_initialize {{name "initialize"}} {
# test name. EXTRA are other settings to pass via the "initialize"
# request.
proc dap_initialize {{name "initialize"} {extra ""}} {
if {[dap_gdb_start]} {
return ""
}
return [dap_check_request_and_response $name initialize \
{o clientID [s "gdb testsuite"] \
supportsVariableType [l true] \
supportsVariablePaging [l true] \
supportsMemoryReferences [l true]}]
[format {o clientID [s "gdb testsuite"] \
supportsVariableType [l true] \
supportsVariablePaging [l true] \
supportsMemoryReferences [l true] \
%s} \
$extra]]
}
# Send a launch request specifying FILE as the program to use for the

View File

@@ -56,7 +56,12 @@ void
tui_win_info::refresh_window ()
{
if (handle != NULL)
wnoutrefresh (handle.get ());
{
if (suppress_output)
wnoutrefresh (handle.get ());
else
wrefresh (handle.get ());
}
}
/* Draw a border around the window. */

View File

@@ -314,6 +314,9 @@ tui_source_window_base::refresh_window ()
the screen, potentially creating a flicker. */
wnoutrefresh (handle.get ());
if (m_content.empty ())
return;
int pad_width = getmaxx (m_pad.get ());
int left_margin = this->left_margin ();
int view_width = this->view_width ();

View File

@@ -315,9 +315,11 @@ ui_file_style::parse (const char *buf, size_t *n_read)
case 35:
case 36:
case 37:
m_foreground = color (value - 30);
break;
/* Note: not 38. */
case 39:
m_foreground = color (value - 30);
m_foreground = NONE;
break;
case 40:
@@ -328,9 +330,11 @@ ui_file_style::parse (const char *buf, size_t *n_read)
case 45:
case 46:
case 47:
m_background = color (value - 40);
break;
/* Note: not 48. */
case 49:
m_background = color (value - 40);
m_background = NONE;
break;
case 90:

View File

@@ -1 +1 @@
16.0.50.DATE-git
16.3

View File

@@ -3114,9 +3114,9 @@ _initialize_windows_nat ()
add_com ("signal-event", class_run, signal_event_command, _("\
Signal a crashed process with event ID, to allow its debugging.\n\
This command is needed in support of setting up GDB as JIT debugger on \
MS-Windows. The command should be invoked from the GDB command line using \
the '-ex' command-line option. The ID of the event that blocks the \
This command is needed in support of setting up GDB as JIT debugger on\n\
MS-Windows. The command should be invoked from the GDB command line using\n\
the '-ex' command-line option. The ID of the event that blocks the\n\
crashed process will be supplied by the Windows JIT debugging mechanism."));
#ifdef __CYGWIN__

View File

@@ -623,7 +623,7 @@ mips_target::low_remove_point (raw_bkpt_type type, CORE_ADDR addr,
&priv->watch_mirror);
/* Only update the threads of this process. */
proc->for_each_thread (pid, update_watch_registers_callback);
proc->for_each_thread (update_watch_registers_callback);
return 0;
}

View File

@@ -543,7 +543,7 @@ regcache::raw_compare (int regnum, const void *buf, int offset) const
gdb_assert (buf != NULL);
gdb::array_view<const gdb_byte> regbuf = register_data (this, regnum);
gdb_assert (offset < regbuf.size ());
gdb_assert (offset <= regbuf.size ());
regbuf = regbuf.slice (offset);
return memcmp (buf, regbuf.data (), regbuf.size ()) == 0;

View File

@@ -2777,7 +2777,7 @@ handle_query (char *own_buf, int packet_len, int *new_packet_len_p)
"PacketSize=%x;QPassSignals+;QProgramSignals+;"
"QStartupWithShell+;QEnvironmentHexEncoded+;"
"QEnvironmentReset+;QEnvironmentUnset+;"
"QSetWorkingDir+",
"QSetWorkingDir+;binary-upload+",
PBUFSIZ - 1);
if (target_supports_catch_syscall ())
@@ -4092,6 +4092,38 @@ test_memory_tagging_functions (void)
&& tags.size () == 5);
}
/* Exercise the behavior of doing a 0-length comparison for a register in a
register buffer, which should return true. */
static void test_registers_raw_compare_zero_length ()
{
/* Start off with a dummy target description. */
target_desc dummy_tdesc;
/* Make it 8 bytes long. */
dummy_tdesc.registers_size = 8;
/* Add a couple dummy 32-bit registers. */
dummy_tdesc.reg_defs.emplace_back ("r0", 0, 32);
dummy_tdesc.reg_defs.emplace_back ("r1", 32, 32);
/* Create a dummy buffer that will serve as the register buffer for our
dummy regcache. */
gdb_byte dummy_register_buffer[8];
/* Create our dummy register cache so we can invoke the raw_compare method
we want to validate. */
regcache dummy_regcache;
init_register_cache (&dummy_regcache, &dummy_tdesc, dummy_register_buffer);
/* Create a dummy byte buffer we can pass to the raw_compare method. */
gdb_byte dummy_buffer[8];
/* Validate the 0-length comparison (due to the comparison offset being
equal to the length of the register) returns true. */
SELF_CHECK (dummy_regcache.raw_compare (0, dummy_buffer, 4));
}
} // namespace selftests
#endif /* GDB_SELF_TEST */
@@ -4115,6 +4147,8 @@ captured_main (int argc, char *argv[])
selftests::register_test ("remote_memory_tagging",
selftests::test_memory_tagging_functions);
selftests::register_test ("test_registers_raw_compare_zero_length",
selftests::test_registers_raw_compare_zero_length);
#endif
current_directory = getcwd (NULL, 0);

View File

@@ -151,6 +151,14 @@ win32_isatty (int fd)
# define RL_TIMEOUT_USE_SELECT
#else
# define RL_TIMEOUT_USE_SIGALRM
# ifdef __MINGW32_MAJOR_VERSION
/* mingw.org's MinGW doesn't have 'alarm'. */
unsigned int
alarm (unsigned int seconds)
{
return 0;
}
# endif
#endif
int rl_set_timeout (unsigned int, unsigned int);