aboutsummaryrefslogtreecommitdiff
path: root/gdb
diff options
context:
space:
mode:
Diffstat (limited to 'gdb')
-rw-r--r--gdb/progspace.c8
-rw-r--r--gdb/riscv-tdep.c13
-rw-r--r--gdb/testsuite/Makefile.in5
-rw-r--r--gdb/testsuite/gdb.python/py-missing-objfile.exp10
4 files changed, 25 insertions, 11 deletions
diff --git a/gdb/progspace.c b/gdb/progspace.c
index 569dfc8..eda6379 100644
--- a/gdb/progspace.c
+++ b/gdb/progspace.c
@@ -202,12 +202,14 @@ program_space::exec_close ()
if (ebfd != nullptr)
{
/* Removing target sections may close the exec_ops target.
- Clear ebfd before doing so to prevent recursion. */
- bfd *saved_ebfd = ebfd.get ();
+ Clear ebfd before doing so to prevent recursion. We
+ move it to another ref_ptr instead of saving it to a raw
+ pointer to avoid it looking like possible use-after-free. */
+ gdb_bfd_ref_ptr saved_ebfd = std::move (ebfd);
ebfd.reset (nullptr);
ebfd_mtime = 0;
- remove_target_sections (saved_ebfd);
+ remove_target_sections (saved_ebfd.get ());
m_exec_filename.reset ();
}
diff --git a/gdb/riscv-tdep.c b/gdb/riscv-tdep.c
index a735c09..8998a29 100644
--- a/gdb/riscv-tdep.c
+++ b/gdb/riscv-tdep.c
@@ -4884,7 +4884,7 @@ try_read (struct regcache *regcache, int regnum, ULONGEST &addr)
if (regcache->raw_read (regnum, &addr)
!= register_status::REG_VALID)
{
- warning (_("Can not read at address %lx"), addr);
+ warning (_("Can not read at address %s"), hex_string (addr));
return false;
}
return true;
@@ -5270,8 +5270,8 @@ private:
|| try_save_pc_rd_mem (ival, regcache))
return !has_error ();
- warning (_("Currently this instruction with len 4(%lx) is unsupported"),
- ival);
+ warning (_("Currently this instruction with len 4(%s) is unsupported"),
+ hex_string (ival));
return false;
}
@@ -5380,8 +5380,8 @@ private:
|| !save_mem (addr + offset, 4) || set_ordinary_record_type ());
}
- warning (_("Currently this instruction with len 2(%lx) is unsupported"),
- ival);
+ warning (_("Currently this instruction with len 2(%s) is unsupported"),
+ hex_string (ival));
return false;
}
@@ -5415,7 +5415,8 @@ public:
are not defined yet, so just ignore it. */
gdb_assert (m_length > 0 && m_length % 2 == 0);
- warning (_("Can not record unknown instruction (opcode = %lx)"), ival);
+ warning (_("Can not record unknown instruction (opcode = %s)"),
+ hex_string (ival));
return false;
}
diff --git a/gdb/testsuite/Makefile.in b/gdb/testsuite/Makefile.in
index 0d5ad90..4a6665d 100644
--- a/gdb/testsuite/Makefile.in
+++ b/gdb/testsuite/Makefile.in
@@ -440,14 +440,15 @@ expect-read1 expect-readmore:
# function, making it read one byte at a time. Running the testsuite
# with this catches racy tests.
read1.so: lib/read1.c
- $(ECHO_CC) $(CC) -o $@ ${srcdir}/lib/read1.c -Wall -g -shared -fPIC $(CFLAGS)
+ $(ECHO_CC) $(CC) -o $@ ${srcdir}/lib/read1.c -Wall -g -shared -fPIC \
+ $(filter-out -fsanitize=%,$(CFLAGS))
# Build the readmore.so preload library. This overrides the `read'
# function, making it try harder to read more at a time. Running the
# testsuite with this catches racy tests.
readmore.so: lib/read1.c
$(ECHO_CC) $(CC) -o $@ ${srcdir}/lib/read1.c -Wall -g -shared -fPIC \
- $(CFLAGS) -DREADMORE
+ $(filter-out -fsanitize=%,$(CFLAGS)) -DREADMORE
# Build the read1 machinery.
.PHONY: read1 readmore
diff --git a/gdb/testsuite/gdb.python/py-missing-objfile.exp b/gdb/testsuite/gdb.python/py-missing-objfile.exp
index e4a1b3f..29bc555 100644
--- a/gdb/testsuite/gdb.python/py-missing-objfile.exp
+++ b/gdb/testsuite/gdb.python/py-missing-objfile.exp
@@ -79,6 +79,16 @@ proc setup_debugdir { dirname files } {
# executable (when EXEC_LOADED is true) and/or the library (when LIB_LOADED
# is true).
proc check_loaded_debug { exec_loaded lib_loaded } {
+ set re_warn \
+ [string_to_regexp \
+ "Warning: the current language does not match this frame."]
+ set cmd "set lang c"
+ gdb_test_multiple $cmd "" {
+ -re -wrap "${cmd}(\r\n$re_warn)?" {
+ pass $gdb_test_name
+ }
+ }
+
if { $exec_loaded } {
gdb_test "whatis global_exec_var" "^type = volatile struct exec_type"