Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
c4aa08d
gdb/amd-dbgapi-target: Move Linux code to amd-dbagapi-posix-hdep.c
lancesix May 8, 2024
9e6e6a2
gdb/amd-dbgapi-target: Add amd-dbgapi-mingw-hdep.c for Windows
lancesix May 8, 2024
f67ddc1
gdb/amd-dbgapi-target: Update xfer_partial to always use dbgapi
lancesix Apr 16, 2024
2bbd3cb
Adjust gdb.base/exitsignal.exp for MinGW, trigger fault
palves May 23, 2026
addf544
Adjust gdb.base/exitsignal.exp for MinGW, second-chance SIGSEGV
palves May 23, 2026
2949fd1
Adjust gdb.base/exitsignal.exp for MinGW, separate program names
palves May 23, 2026
b8adb91
gdb.base/exitsignal.exp: Exit with non-zero
palves May 23, 2026
d02f36a
gdb.base/exitsignal.exp: Test attaching too
palves May 23, 2026
c04f1f5
gdb/testsuite: Add mechanism to compile Windows native programs on Cy…
palves May 23, 2026
4fce4ba
Windows gdb+gdbserver: Share exit status logic
palves May 20, 2026
613b8ee
Windows gdb+gdbserver: Decode Cygwin ExitProcess codes
palves May 20, 2026
ab20bdf
Adjust gdb.python/py-events.exp for Cygwin/MinGW, thread IDs
palves May 20, 2026
22143ca
Adjust gdb.python/py-events.exp for Cygwin/MinGW, no fork
palves May 20, 2026
2b675b2
Adjust gdb.python/py-events.exp for Cygwin/MinGW, "info proc" => "inf…
palves May 20, 2026
085ef1c
Add tests for Ada "in" operator
tromey May 29, 2026
e0fe0e3
check bfd_alloc/bfd_malloc return in elflink.c
amodra Jun 12, 2026
95451ea
oss-fuzz: vms-alpha segfault in image_write_section
amodra Jun 13, 2026
17699d9
[gdb/testsuite] Convert gdb.dwarf2/dw2-strp.exp to dwarf assembly
vries Jun 14, 2026
c311f4d
gdb/python: fix 'exited' event when GDB exits from core file debugging
T-J-Teru Jun 4, 2026
b55fa82
[pre-commit] Add file mode check
vries Jun 15, 2026
4513063
[gdb] Fix file mode of gdb/microblaze-linux-nat.c
vries Jun 15, 2026
d4d5cf1
[gdb] Fix flake8 warning in gdb.python/py-inf-exited-at-exit.py
vries Jun 15, 2026
2b5689d
[gdb/contrib] Describe words in codespell-ignore-words.txt
vries Jun 15, 2026
34ac318
[gdb/contrib] Extend codespell-ignore-words.txt
vries Jun 15, 2026
ffc1651
[gdb] Fix typos
vries Jun 15, 2026
5c4abfa
[gdb] Fix codespell false positives by ignoring
vries Jun 15, 2026
a25ca58
[gdb] Fix codespell false positive by string splitting
vries Jun 15, 2026
88d4232
[gdb] Fix codespell false positives by renaming
vries Jun 15, 2026
664cc2d
[pre-commit] Include gdb in codespell check
vries Jun 15, 2026
0c73540
[pre-commit] Simplify codespell configuration
vries Jun 15, 2026
0626ddb
[gdb] Fix typo in gdb/microblaze-linux-nat.c
vries Jun 15, 2026
cc9b5e6
[gdb] Drop some files and a dir from codespell skip list
vries Jun 15, 2026
6926c5e
[gdb] Expand dirs in codespell skip list
vries Jun 15, 2026
1c4da52
[gdb] Add endianity to codespell-ignore-words.txt
vries Jun 15, 2026
dcca095
Port expandargstr from gcc/libiberty
windsunil Jun 11, 2026
3011711
Automatic date update in version.in
Jun 16, 2026
0e58174
Merge remote-tracking branch 'origin/master' into amd-staging
lancesix Jun 23, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ repos:
rev: v2.4.2
hooks:
- id: codespell
files: '^(gdbsupport|gdbserver|gdb/(doc|stubs|features|nat|contrib|dwarf2|tui|target|data-directory|po|system-gdbinit|mi|syscalls|arch|regformats|compile|python|guile|config|unittests|cli|testsuite/gdb.(ctf|dap|debuginfod|gdb|go|guile|mi|modula2|objc|opencl|opt|pascal|perf|replay|reverse|rocm|server|stabs|testsuite|tui|xml)))/'
files: '^(gdb|gdbserver|gdbsupport)/'
args: [--toml, gdb/pyproject.toml]
- id: codespell
name: codespell-log
Expand Down Expand Up @@ -112,6 +112,11 @@ repos:
additional_dependencies: ["pyyaml"]
always_run: true
require_serial: true
- id: check-file-mode
name: check-file-mode
language: script
entry: gdb/contrib/check-file-mode.sh
files: '^(gdb|gdbserver|gdbsupport)/.*$'
- repo: https://github.com/nmoroze/tclint
rev: v0.8.0
hooks:
Expand Down
16 changes: 9 additions & 7 deletions bfd/elflink.c
Original file line number Diff line number Diff line change
Expand Up @@ -653,6 +653,8 @@ bfd_elf_link_record_dynamic_symbol (struct bfd_link_info *info,
if (p != NULL)
{
unversioned_name = bfd_malloc (p - name + 1);
if (unversioned_name == NULL)
return false;
memcpy (unversioned_name, name, p - name);
unversioned_name[p - name] = 0;
name = unversioned_name;
Expand Down Expand Up @@ -15569,16 +15571,16 @@ get_dynamic_reloc_section_name (bfd * abfd,
asection * sec,
bool is_rela)
{
char *name;
const char *old_name = bfd_section_name (sec);
const char *prefix = is_rela ? ".rela" : ".rel";

if (old_name == NULL)
size_t plen = is_rela ? 5 : 4;
const char *old_name = bfd_section_name (sec);
size_t nlen = strlen (old_name);
char *name = bfd_alloc (abfd, plen + nlen + 1);
if (name == NULL)
return NULL;

name = bfd_alloc (abfd, strlen (prefix) + strlen (old_name) + 1);
sprintf (name, "%s%s", prefix, old_name);

memcpy (name, prefix, plen);
memcpy (name + plen, old_name, nlen + 1);
return name;
}

Expand Down
2 changes: 1 addition & 1 deletion bfd/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

In releases, the date is not included in either version strings or
sonames. */
#define BFD_VERSION_DATE 20260608
#define BFD_VERSION_DATE 20260616
#define BFD_VERSION @bfd_version@
#define BFD_VERSION_STRING @bfd_version_package@ @bfd_version_string@
#define REPORT_BUGS_TO @report_bugs_to@
3 changes: 2 additions & 1 deletion bfd/vms-alpha.c
Original file line number Diff line number Diff line change
Expand Up @@ -1603,7 +1603,8 @@ image_write_section (bfd *abfd)
{
asection *sec = PRIV (image_section);

if ((sec->flags & SEC_IN_MEMORY) != 0 && sec->contents == NULL)
if (sec == NULL
|| ((sec->flags & SEC_IN_MEMORY) != 0 && sec->contents == NULL))
return NULL;
return sec;
}
Expand Down
3 changes: 3 additions & 0 deletions gdb/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -1289,6 +1289,7 @@ HFILES_NO_SRCDIR = \
amd64-nat.h \
amd64-ravenscar-thread.h \
amd64-tdep.h \
amd-dbgapi-hdep.h \
amd-dbgapi-target.h \
amdgpu-tdep.h \
annotate.h \
Expand Down Expand Up @@ -1797,6 +1798,8 @@ ALLDEPFILES = \
alpha-netbsd-tdep.c \
alpha-obsd-tdep.c \
alpha-tdep.c \
amd-dbgapi-mingw-hdep.c \
amd-dbgapi-posix-hdep.c \
amd-dbgapi-target.c \
amd64-bsd-nat.c \
amd64-darwin-tdep.c \
Expand Down
4 changes: 3 additions & 1 deletion gdb/ada-lang.c
Original file line number Diff line number Diff line change
Expand Up @@ -815,6 +815,7 @@ ada_main_name ()
of NULLs. */

const struct ada_opname_map ada_opname_table[] = {
/* codespell:ignore-begin. */
{"Oadd", "\"+\"", BINOP_ADD},
{"Osubtract", "\"-\"", BINOP_SUB},
{"Omultiply", "\"*\"", BINOP_MUL},
Expand All @@ -836,6 +837,7 @@ const struct ada_opname_map ada_opname_table[] = {
{"Onot", "\"not\"", UNOP_LOGICAL_NOT},
{"Oadd", "\"+\"", UNOP_PLUS},
{"Osubtract", "\"-\"", UNOP_NEG},
/* codespell:ignore-end. */
{NULL, NULL}
};

Expand Down Expand Up @@ -9371,7 +9373,7 @@ ada_aggregate_component::dump (ui_file *stream, int depth)
gdb_printf (stream, _("%*sAggregate\n"), depth, "");
if (m_base != nullptr)
{
gdb_printf (stream, _("%*swith delta\n"), depth + 1, "");
gdb_printf (stream, _("%*s" "with delta\n"), depth + 1, "");
m_base->dump (stream, depth + 2);
}
for (const auto &item : m_components)
Expand Down
38 changes: 38 additions & 0 deletions gdb/amd-dbgapi-hdep.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/* Host dependent utilities used by the amd-dbgapi target.

Copyright (C) 2024-2026 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/>. */

#ifndef GDB_AMD_DBGAPI_HDEP_H
#define GDB_AMD_DBGAPI_HDEP_H

#include <amd-dbgapi/amd-dbgapi.h>

/* Null amd_dbgapi_notifier_t. */
extern const amd_dbgapi_notifier_t null_amd_dbgapi_notifier;

/* Clear the notifier. */
extern void amd_dbgapi_notifier_clear (amd_dbgapi_notifier_t notifier);

/* Get the file descriptor associated with the notifier. */
extern int amd_dbgapi_notifier_get_fd (amd_dbgapi_notifier_t notifier);

/* Ensure that we do not keep a reference to NOTIFIER, which is about
to get invalidated. */
extern void amd_dbgapi_notifier_release (amd_dbgapi_notifier_t notifier);

#endif /* GDB_AMD_DBGAPI_HDEP_H */
172 changes: 172 additions & 0 deletions gdb/amd-dbgapi-mingw-hdep.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,172 @@
/* Host dependent utilities for the amd-dbgapi target on MinGW.

Copyright (C) 2024-2026 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/>. */

#include "amd-dbgapi-hdep.h"
#include <amd-dbgapi/amd-dbgapi.h>

#include <winsock2.h>
#include <windows.h>
#include <io.h>
#include <cstdio>
#include <unordered_map>
#include <algorithm>

#include "serial.h"

/* See amd-dbgapi-hdep.h. */
const amd_dbgapi_notifier_t null_amd_dbgapi_notifier = nullptr;

/* Use a custom implementation of serial for events from dbgapi. This is
really similar to what is implemented in ser-event.c, except that here:
- The underlying event object is not managed by us, but by dbgapi
instead.
- We keep a handy mapping from event object handles to serial
events for lookup.
*/

struct amd_dbgapi_serial_event_state
{
/* The Windows event handle, provided by dbgapi. */
HANDLE event;
};

/* Mapping from event object handles to serial events for lookup. */
static std::unordered_map<HANDLE, serial *> serial_event_cache;

/* serial_ops::open implementation for the amd-dbgapi serial
event. */

static void
amd_dbgapi_serial_event_state_open (struct serial *scb,
const char *name)
{
auto *state = new amd_dbgapi_serial_event_state;
scb->state = state;

HANDLE dummy_file = CreateFile ("nul", 0, 0, nullptr, OPEN_EXISTING, 0,
nullptr);
scb->fd = _open_osfhandle ((intptr_t) dummy_file, 0);
};

/* serial_ops::close implementation for the amd-dbgapi serial
event. */

static void
amd_dbgapi_serial_event_state_close (struct serial *scb)
{
scb->fd = -1;
delete (amd_dbgapi_serial_event_state *) scb->state;
scb->state = nullptr;
}

/* serial_ops::wait_handle implementation for the amd-dbgapi serial
event. */

static void
amd_dbgapi_serial_event_state_wait_handle (struct serial *scb,
HANDLE *read,
HANDLE *except)
{
auto *state = (amd_dbgapi_serial_event_state *) scb->state;
*read = state->event;
}

static const struct serial_ops amd_dbgapi_serial_event_ops =
{
"amd-dbgapi-event",
amd_dbgapi_serial_event_state_open,
amd_dbgapi_serial_event_state_close,
nullptr, /* fdopen */
nullptr, /* readchar */
nullptr, /* write */
nullptr, /* flush_output */
nullptr, /* flush_input */
nullptr, /* send_break */
nullptr, /* go_raw */
nullptr, /* get_tty_state */
nullptr, /* copy_tty_state */
nullptr, /* set_tty_state */
nullptr, /* print_tty_state */
nullptr, /* setbaudrate */
nullptr, /* setstopbits */
nullptr, /* setparity */
nullptr, /* drain_output */
nullptr, /* async */
nullptr, /* read_prim */
nullptr, /* write_prim */
nullptr, /* avail */
amd_dbgapi_serial_event_state_wait_handle,
nullptr, /* done_wait_handle */
};

/* Return the serial object associated with EVENT_HANDLE, creating it
if necessary. */

static serial *
get_serial_event (HANDLE event_handle)
{
auto it = serial_event_cache.find (event_handle);

/* If we already have a FD for this event, return it. */
if (it != serial_event_cache.end ())
return it->second;

serial *scb = serial_open_ops (&amd_dbgapi_serial_event_ops);

/* Set the underlying Windows event object. */
auto *state = (amd_dbgapi_serial_event_state *) scb->state;
state->event = event_handle;
serial_event_cache.insert ({event_handle, scb});

/* Keep one reference for the cache. This will be released by
amd_dbgapi_notifier_release. */
serial_ref (scb);

return scb;
}

/* See amd-dbgapi-hdep.h. */

void
amd_dbgapi_notifier_clear (amd_dbgapi_notifier_t notifier)
{
ResetEvent (notifier);
}

/* See amd-dbgapi-hdep.h. */

int
amd_dbgapi_notifier_get_fd (amd_dbgapi_notifier_t notifier)
{
return get_serial_event (notifier)->fd;
}

/* See amd-dbgapi-hdep.h. */

void
amd_dbgapi_notifier_release (amd_dbgapi_notifier_t notifier)
{
/* Remove the serial from the cache. */
auto it = serial_event_cache.find (notifier);
if (it != serial_event_cache.end ())
{
serial_event_cache.erase (it);
serial_unref (get_serial_event (notifier));
}
}
55 changes: 55 additions & 0 deletions gdb/amd-dbgapi-posix-hdep.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/* Host dependent utilities for the amd-dbgapi target on POSIX.

Copyright (C) 2019-2026 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/>. */

#include "amd-dbgapi-hdep.h"
#include <amd-dbgapi/amd-dbgapi.h>

/* See amd-dbgapi-hdep.h. */
const amd_dbgapi_notifier_t null_amd_dbgapi_notifier = -1;

/* See amd-dbgapi-hdep.h. */

void
amd_dbgapi_notifier_clear (amd_dbgapi_notifier_t notifier)
{
int ret;

/* Drain the notifier pipe. */
do
{
char buf;
ret = read (notifier, &buf, 1);
}
while (ret >= 0 || (ret == -1 && errno == EINTR));
}

/* See amd-dbgapi-hdep.h. */

int
amd_dbgapi_notifier_get_fd (amd_dbgapi_notifier_t notifier)
{
return notifier;
}

/* See amd-dbgapi-hdep.h. */
void
amd_dbgapi_notifier_release (amd_dbgapi_notifier_t notifier)
{
/* Nothing to do. */
}
Loading
Loading