Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
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 20260818
#define BFD_VERSION_DATE 20260819
#define BFD_VERSION @bfd_version@
#define BFD_VERSION_STRING @bfd_version_package@ @bfd_version_string@
#define REPORT_BUGS_TO @report_bugs_to@
9 changes: 5 additions & 4 deletions gdb/dwarf2/read.c
Original file line number Diff line number Diff line change
Expand Up @@ -3770,15 +3770,16 @@ process_queue (dwarf2_per_objfile *per_objfile)
if (signatured_type *sig_type = per_cu->as_signatured_type ();
sig_type != nullptr)
{
sprintf (buf, "TU %s at offset %s", hex_string (sig_type->signature),
sect_offset_str (per_cu->sect_off ()));
xsnprintf (buf, sizeof (buf), "TU %s at offset %s",
hex_string (sig_type->signature),
sect_offset_str (per_cu->sect_off ()));
/* There can be 100s of TUs. Only print them in verbose mode. */
debug_print_threshold = 2;
}
else
{
sprintf (buf, "CU at offset %s",
sect_offset_str (per_cu->sect_off ()));
xsnprintf (buf, sizeof (buf), "CU at offset %s",
sect_offset_str (per_cu->sect_off ()));
debug_print_threshold = 1;
}

Expand Down
14 changes: 6 additions & 8 deletions gdb/elfread.c
Original file line number Diff line number Diff line change
Expand Up @@ -804,20 +804,17 @@ static int
elf_gnu_ifunc_resolve_by_got (const char *name, CORE_ADDR *addr_p)
{
gnu_ifunc_debug_printf ("resolving \"%s\" by GOT", name);
char *name_got_plt;
const size_t got_suffix_len = strlen (SYMBOL_GOT_PLT_SUFFIX);
int found = 0;
const char *func = __func__;

name_got_plt = (char *) alloca (strlen (name) + got_suffix_len + 1);
sprintf (name_got_plt, "%s" SYMBOL_GOT_PLT_SUFFIX, name);
std::string name_got_plt = std::string (name) + SYMBOL_GOT_PLT_SUFFIX;

/* FIXME: we only search the initial namespace.

To search other namespaces, we would need to provide context, e.g. in
form of an objfile in that namespace. */
current_program_space->iterate_over_objfiles_in_search_order
([name, name_got_plt, &addr_p, &found, func] (struct objfile *objfile)
([name, &name_got_plt, &addr_p, &found, func] (struct objfile *objfile)
{
bfd *obfd = objfile->obfd.get ();
struct gdbarch *gdbarch = objfile->arch ();
Expand All @@ -828,8 +825,8 @@ elf_gnu_ifunc_resolve_by_got (const char *name, CORE_ADDR *addr_p)
gdb_byte *buf = (gdb_byte *) alloca (ptr_size);

bound_minimal_symbol msym
= lookup_minimal_symbol (current_program_space, name_got_plt,
objfile);
= lookup_minimal_symbol (current_program_space,
name_got_plt.c_str (), objfile);
if (msym.minsym == NULL)
return 0;
if (msym.minsym->type () != mst_slot_got_plt)
Expand All @@ -850,7 +847,8 @@ elf_gnu_ifunc_resolve_by_got (const char *name, CORE_ADDR *addr_p)
addr = gdbarch_addr_bits_remove (gdbarch, addr);

gnu_ifunc_debug_printf_func (func, "GOT entry \"%s\" points to %s",
name_got_plt, paddress (gdbarch, addr));
name_got_plt.c_str (),
paddress (gdbarch, addr));

if (elf_gnu_ifunc_record_cache (name, addr))
{
Expand Down
6 changes: 5 additions & 1 deletion gdb/testsuite/gdb.ada/bp_c_mixed_case.exp
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,12 @@ gdb_test "p <MixedCaseFunc>" \
" = void" \
"p <MixedCaseFunc>, in Ada"

# The optional leading dot is for ppc64 v1 ABI function descriptors.
gdb_test "p <NoDebugMixedCaseFunc>" \
" = {<text variable, no debug info>} $hex <NoDebugMixedCaseFunc>" \
[quotemeta \
[string cat \
{$@DECIMAL = {<text variable, no debug info>} @HEX} \
{ <@/[.]?/NoDebugMixedCaseFunc>}]] \
"p <NoDebugMixedCaseFunc>, in Ada"

# Try inserting a breakpoint inside a C function. Because the function's
Expand Down
14 changes: 10 additions & 4 deletions gdb/testsuite/gdb.ada/unchecked_union.exp
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,23 @@ standard_ada_testfile unchecked_union
proc multi_line_string {str} {
set result {}
foreach line $str {
lappend result [string_to_regexp $line]
lappend result [quotemeta $line]
}
set res [multi_line {*}$result]
verbose -log "RES: '$res'"
return $res
}

# Note the quotemeta expression here. gnat-llvm emits slightly a
# different encoding here, which lets gdb see the discriminant for a
# branch.
set inner_string \
[list \
" case ? is" \
" when 0 =>" \
" small: range 0 .. 255;" \
" second: range 0 .. 255;" \
" when ? =>" \
" when @/\[1?\]/ =>" \
" bval: range 0 .. 255;" \
" when others =>" \
" large: range 255 .. 510;" \
Expand All @@ -50,12 +53,15 @@ set inner_full \
$inner_string \
[list "end record"]]

# Note the quotemeta expression here. gnat-llvm emits slightly a
# different encoding here, which lets gdb see the discriminant for a
# branch.
set pair_string \
[list \
" case ? is" \
" when ? =>" \
" when @/\[0?\]/ =>" \
" field_one: range 0 .. 255;" \
" when ? =>" \
" when @/(\\?|others)/ =>" \
" field_two: range 255 .. 510;" \
" end case;"]

Expand Down
19 changes: 19 additions & 0 deletions gdb/testsuite/gdb.base/tailcall-msym.exp
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,25 @@ if { [prepare_for_testing "prepare" ${testfile}-updated $asm_file {nodebug}] } {
return
}

foreach func {caller callee main dummy_func} {
set re_found \
"^$valnum_re = {<text variable, no debug info>} $hex <$func>"

set found 0
gdb_test_multiple "p $func" "" {
-re -wrap $re_found {
set found 1
}
-re -wrap "" {
}
}

if {!$found} {
unsupported "couldn't find function $func"
return
}
}

if {![runto callee]} {
return
}
Expand Down
4 changes: 3 additions & 1 deletion gdb/testsuite/gdb.opt/break-on-_exit.exp
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,6 @@ gdb_test "info shared"

# If the skip_prologue analysis of _exit is too eager, we may not hit the
# breakpoint.
gdb_continue_to_breakpoint "_exit" "_exit \\(\\) .*"
# The optional leading dot is for ppc64 v1 ABI function descriptors.
gdb_continue_to_breakpoint "_exit" \
[quotemeta {@/[.]?/_exit () @...}]
2 changes: 1 addition & 1 deletion gdb/testsuite/gdb.python/py-failed-init.exp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ save_vars { env(PYTHONHOME) } {
}

gdb_test "python print (1)" \
"Python not initialized"
"(Python not initialized|1)"

set output_seen 0
gdb_test_multiple "quit" "" {
Expand Down
4 changes: 3 additions & 1 deletion gdb/testsuite/gdb.python/py-selected-context.exp
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ proc event_regexp { inferior {thread "None"} {frame "None"}} {
# inferior. INF should be an inferior number, e.g. '1', '2', etc.
proc check_inferior { inf testname } {
gdb_test "info inferiors" \
"\r\n\\*\\s+[string_to_regexp $inf]\\s+\[^\r\n\]*(?=\r\n)" \
[multi_line \
"" \
[subst_vars {[*]\s+$inf\s+[^\r\n]*(?=\r\n).*}]] \
$testname
}

Expand Down
3 changes: 2 additions & 1 deletion gdb/testsuite/gdb.rocm/watchpoint-at-end-of-shader.exp
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,8 @@ proc do_test {precise_memory has_xfail} {
setup_xfail "*-*-*"
}
gdb_test "continue" \
[multi_line "Switching to \[^\r\n\]+(?=\r\n)" \
[multi_line \
{Switching to [^\r\n]+} \
"" \
"Thread $::decimal \[^\r\n\]*hit Hardware watchpoint $::decimal: -location \\*v" \
"" \
Expand Down
27 changes: 24 additions & 3 deletions gdb/testsuite/gdb.tui/tailcall-msym.exp
Original file line number Diff line number Diff line change
Expand Up @@ -136,15 +136,36 @@ if { [build_executable "build" $real_testfile $asm_file {nodebug}] } {

Term::clean_restart 24 80 $real_testfile

if {![runto callee]} {
if {![Term::prepare_for_tui]} {
unsupported "TUI not supported"
return
}

if {![Term::enter_tui]} {
unsupported "TUI not supported"
foreach func {caller callee main dummy_func} {
set re_found \
"^$valnum_re = {<text variable, no debug info>} $hex <$func>"

set found 0
gdb_test_multiple "p $func" "" {
-re -wrap $re_found {
set found 1
}
-re -wrap "" {
}
}

if {!$found} {
unsupported "couldn't find function $func"
return
}
}

if {![runto callee]} {
return
}

Term::command_no_prompt_prefix "tui enable"

# Check the function name on display in the status bar. The interesting
# case here is 'caller', which is a tailcall function in an objfile with
# no debug information.
Expand Down
25 changes: 17 additions & 8 deletions gdb/tracepoint.c
Original file line number Diff line number Diff line change
Expand Up @@ -1164,6 +1164,9 @@ collection_list::stringify ()
gdb_printf ("\n");
if (!m_memranges.empty () && info_verbose)
gdb_printf ("Collecting memranges: \n");

char *buf_end = temp_buf.data () + temp_buf.size ();

for (i = 0, count = 0, end = temp_buf.data ();
i < m_memranges.size (); i++)
{
Expand Down Expand Up @@ -1193,11 +1196,12 @@ collection_list::stringify ()
"FFFFFFFF" (or more, depending on sizeof (unsigned)).
Special-case it. */
if (m_memranges[i].type == memrange_absolute)
sprintf (end, "M-1,%s,%lX", phex_nz (m_memranges[i].start, 0),
(long) length);
xsnprintf (end, buf_end - end, "M-1,%s,%lX",
phex_nz (m_memranges[i].start, 0), (long) length);
else
sprintf (end, "M%X,%s,%lX", m_memranges[i].type,
phex_nz (m_memranges[i].start, 0), (long) length);
xsnprintf (end, buf_end - end, "M%X,%s,%lX",
m_memranges[i].type, phex_nz (m_memranges[i].start, 0),
(long) length);
}

count += strlen (end);
Expand All @@ -1213,7 +1217,9 @@ collection_list::stringify ()
count = 0;
end = temp_buf.data ();
}
sprintf (end, "X%08X,", (int) m_aexprs[i]->buf.size ());

xsnprintf (end, buf_end - end, "X%08X,",
(int) m_aexprs[i]->buf.size ());
end += 10; /* 'X' + 8 hex digits + ',' */
count += 10;

Expand Down Expand Up @@ -2816,11 +2822,14 @@ encode_source_string (int tpnum, ULONGEST addr,
{
if (80 + strlen (srctype) > buf_size)
error (_("Buffer too small for source encoding"));
sprintf (buf, "%x:%s:%s:%x:%x:",
tpnum, phex_nz (addr),
srctype, 0, (int) strlen (src));

xsnprintf (buf, buf_size, "%x:%s:%s:%x:%x:",
tpnum, phex_nz (addr),
srctype, 0, (int) strlen (src));

if (strlen (buf) + strlen (src) * 2 >= buf_size)
error (_("Source string too long for buffer"));

bin2hex ((gdb_byte *) src, buf + strlen (buf), strlen (src));
return -1;
}
Expand Down
18 changes: 9 additions & 9 deletions gdbsupport/common-utils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -92,18 +92,18 @@ std::string
string_printf (const char* fmt, ...)
{
va_list vp;
int size;

va_start (vp, fmt);
size = vsnprintf (NULL, 0, fmt, vp);
int size = vsnprintf (NULL, 0, fmt, vp);
va_end (vp);

std::string str (size, '\0');

/* C++11 and later guarantee std::string uses contiguous memory and
always includes the terminating '\0'. */
va_start (vp, fmt);
vsprintf (&str[0], fmt, vp);
int ret = vsnprintf (&str[0], size + 1, fmt, vp);
gdb_assert (ret == size);
va_end (vp);

return str;
Expand All @@ -115,17 +115,17 @@ std::string
string_vprintf (const char* fmt, va_list args)
{
va_list vp;
size_t size;

va_copy (vp, args);
size = vsnprintf (NULL, 0, fmt, vp);
int size = vsnprintf (NULL, 0, fmt, vp);
va_end (vp);

std::string str (size, '\0');

/* C++11 and later guarantee std::string uses contiguous memory and
always includes the terminating '\0'. */
vsprintf (&str[0], fmt, args);
int ret = vsnprintf (&str[0], size + 1, fmt, args);
gdb_assert (ret == size);

return str;
}
Expand All @@ -152,18 +152,18 @@ std::string &
string_vappendf (std::string &str, const char *fmt, va_list args)
{
va_list vp;
int grow_size;

va_copy (vp, args);
grow_size = vsnprintf (NULL, 0, fmt, vp);
int grow_size = vsnprintf (NULL, 0, fmt, vp);
va_end (vp);

size_t curr_size = str.size ();
str.resize (curr_size + grow_size);

/* C++11 and later guarantee std::string uses contiguous memory and
always includes the terminating '\0'. */
vsprintf (&str[curr_size], fmt, args);
int ret = vsnprintf (&str[curr_size], grow_size + 1, fmt, args);
gdb_assert (ret == grow_size);

return str;
}
Expand Down
Loading
Loading