aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bfd/version.h2
-rw-r--r--gdb/arch-utils.c7
-rw-r--r--gdb/disasm.c7
-rw-r--r--gdb/event-top.h25
-rw-r--r--gdb/gdb_bfd.c23
-rw-r--r--gdb/gmp-utils.h4
-rw-r--r--gdb/record-full.c1
-rw-r--r--gdb/solib-frv.c2
-rw-r--r--gdb/testsuite/gdb.base/bitshift.exp25
-rw-r--r--gdb/testsuite/gdb.base/default.exp2
-rw-r--r--gdb/testsuite/gdb.base/limited-length.c2
-rw-r--r--gdb/testsuite/gdb.base/limited-length.exp10
-rw-r--r--gdb/testsuite/gdb.reverse/step-precsave.exp2
-rw-r--r--gdb/valarith.c24
-rw-r--r--gdb/value.c9
-rw-r--r--gdb/version.in2
16 files changed, 104 insertions, 43 deletions
diff --git a/bfd/version.h b/bfd/version.h
index c404586..089cedb 100644
--- a/bfd/version.h
+++ b/bfd/version.h
@@ -16,7 +16,7 @@
In releases, the date is not included in either version strings or
sonames. */
-#define BFD_VERSION_DATE 20240702
+#define BFD_VERSION_DATE 20240826
#define BFD_VERSION @bfd_version@
#define BFD_VERSION_STRING @bfd_version_package@ @bfd_version_string@
#define REPORT_BUGS_TO @report_bugs_to@
diff --git a/gdb/arch-utils.c b/gdb/arch-utils.c
index 83e2947..ccbfffc 100644
--- a/gdb/arch-utils.c
+++ b/gdb/arch-utils.c
@@ -37,6 +37,7 @@
#include "auxv.h"
#include "observable.h"
#include "solib-target.h"
+#include "event-top.h"
#include "gdbsupport/version.h"
@@ -1040,7 +1041,11 @@ default_print_insn (bfd_vma memaddr, disassemble_info *info)
info->mach, current_program_space->exec_bfd ());
gdb_assert (disassemble_fn != NULL);
- return (*disassemble_fn) (memaddr, info);
+ int res = (*disassemble_fn) (memaddr, info);
+
+ QUIT;
+
+ return res;
}
/* See arch-utils.h. */
diff --git a/gdb/disasm.c b/gdb/disasm.c
index 16736e5..7209cfc 100644
--- a/gdb/disasm.c
+++ b/gdb/disasm.c
@@ -197,7 +197,12 @@ gdb_disassembler_memory_reader::dis_asm_read_memory
(bfd_vma memaddr, gdb_byte *myaddr, unsigned int len,
struct disassemble_info *info) noexcept
{
- return target_read_code (memaddr, myaddr, len);
+ auto res = catch_exceptions<int, -1> ([&]
+ {
+ return target_read_code (memaddr, myaddr, len);
+ });
+
+ return res;
}
/* Wrapper of memory_error. */
diff --git a/gdb/event-top.h b/gdb/event-top.h
index 846d1e4..d590552 100644
--- a/gdb/event-top.h
+++ b/gdb/event-top.h
@@ -24,6 +24,8 @@
#include <signal.h>
+#include "extension.h"
+
struct cmd_list_element;
/* The current quit handler (and its type). This is called from the
@@ -81,6 +83,29 @@ extern void quit_serial_event_set ();
extern void quit_serial_event_clear ();
+/* Wrap f (args) and handle exceptions by:
+ - returning val, and
+ - calling set_quit_flag or set_force_quit_flag, if needed. */
+
+template <typename R, R val, typename F, typename... Args>
+static R
+catch_exceptions (F &&f, Args&&... args)
+{
+ try
+ {
+ return f (std::forward<Args> (args)...);
+ }
+ catch (const gdb_exception &ex)
+ {
+ if (ex.reason == RETURN_QUIT)
+ set_quit_flag ();
+ else if (ex.reason == RETURN_FORCED_QUIT)
+ set_force_quit_flag ();
+ }
+
+ return val;
+}
+
extern void display_gdb_prompt (const char *new_prompt);
extern void gdb_setup_readline (int);
extern void gdb_disable_readline (void);
diff --git a/gdb/gdb_bfd.c b/gdb/gdb_bfd.c
index cb9a91d..80c706c 100644
--- a/gdb/gdb_bfd.c
+++ b/gdb/gdb_bfd.c
@@ -930,29 +930,6 @@ gdb_bfd_openw (const char *filename, const char *target)
return gdb_bfd_ref_ptr::new_reference (result);
}
-/* Wrap f (args) and handle exceptions by:
- - returning val, and
- - calling set_quit_flag or set_force_quit_flag, if needed. */
-
-template <typename R, R val, typename F, typename... Args>
-static R
-catch_exceptions (F &&f, Args&&... args)
-{
- try
- {
- return f (std::forward<Args> (args)...);
- }
- catch (const gdb_exception &ex)
- {
- if (ex.reason == RETURN_QUIT)
- set_quit_flag ();
- else if (ex.reason == RETURN_FORCED_QUIT)
- set_force_quit_flag ();
- }
-
- return val;
-}
-
/* See gdb_bfd.h. */
gdb_bfd_ref_ptr
diff --git a/gdb/gmp-utils.h b/gdb/gmp-utils.h
index 51e06ab..878ce1d 100644
--- a/gdb/gmp-utils.h
+++ b/gdb/gmp-utils.h
@@ -280,13 +280,13 @@ struct gdb_mpz
gdb_mpz operator>> (unsigned long nbits) const
{
gdb_mpz result;
- mpz_tdiv_q_2exp (result.m_val, m_val, nbits);
+ mpz_fdiv_q_2exp (result.m_val, m_val, nbits);
return result;
}
gdb_mpz &operator>>= (unsigned long nbits)
{
- mpz_tdiv_q_2exp (m_val, m_val, nbits);
+ mpz_fdiv_q_2exp (m_val, m_val, nbits);
return *this;
}
diff --git a/gdb/record-full.c b/gdb/record-full.c
index c51aadf..3e42889 100644
--- a/gdb/record-full.c
+++ b/gdb/record-full.c
@@ -2072,6 +2072,7 @@ record_full_core_target::resume (ptid_t ptid, int step,
enum gdb_signal signal)
{
record_full_resume_step = step;
+ record_full_resume_ptid = ptid;
record_full_resumed = 1;
record_full_execution_dir = ::execution_direction;
}
diff --git a/gdb/solib-frv.c b/gdb/solib-frv.c
index 39508fa..a4cd82d 100644
--- a/gdb/solib-frv.c
+++ b/gdb/solib-frv.c
@@ -382,6 +382,8 @@ frv_current_sos ()
li->map = loadmap;
li->got_value = got_addr;
li->lm_addr = lm_addr;
+ sop->lm_info = std::move (li);
+
/* Fetch the name. */
addr = extract_unsigned_integer (lm_buf.l_name,
sizeof (lm_buf.l_name),
diff --git a/gdb/testsuite/gdb.base/bitshift.exp b/gdb/testsuite/gdb.base/bitshift.exp
index cfb1e7b..dccc36b 100644
--- a/gdb/testsuite/gdb.base/bitshift.exp
+++ b/gdb/testsuite/gdb.base/bitshift.exp
@@ -123,10 +123,12 @@ proc make_val_cast {lang signed bits val} {
return "$val as ${sign_prefix}$bits"
} else {
# C-like cast.
- if {$signed} {
+ if {!$signed} {
+ set sign_prefix "unsigned "
+ } elseif {$lang == "opencl"} {
set sign_prefix ""
} else {
- set sign_prefix "un"
+ set sign_prefix "signed "
}
if {$bits == 8} {
set type "char"
@@ -143,7 +145,7 @@ proc make_val_cast {lang signed bits val} {
} else {
error "$lang: unsupported bits"
}
- return "(${sign_prefix}signed $type) $val"
+ return "(${sign_prefix}$type) $val"
}
}
@@ -178,7 +180,7 @@ proc test_shifts {} {
"unknown" "ada" "modula-2" "pascal" "fortran"
}
if {[lsearch -exact $skip_langs $lang] >= 0} {
- return
+ continue
}
gdb_test_no_output "set language $lang"
@@ -344,8 +346,11 @@ proc test_shifts {} {
with_test_prefix "rsh neg lhs" {
test_shift $lang "print -1 >> 0" " = -1"
test_shift $lang "print -1 >> 1" " = -1"
+ test_shift $lang "print -2 >> 1" " = -1"
+ test_shift $lang "print -3 >> 1" " = -2"
test_shift $lang "print -8 >> 1" " = -4"
test_shift $lang "print [make_int64 $lang -8] >> 1" " = -4"
+ test_rshift_tl $lang "print -8 >> 100" " = -1"
}
# Make sure an unsigned 64-bit value with high bit set isn't
@@ -360,6 +365,18 @@ proc test_shifts {} {
test_rshift_tl $lang \
"print -1 >> [make_uint64 $lang 0xffffffffffffffff]" " = -1"
}
+
+ # Check if shift value isn't silently truncated to 32bit.
+ with_test_prefix "lower-32bit-zero" {
+ test_lshift_tl $lang \
+ "print 1 << [make_uint64 $lang 0x100000000]" " = 0"
+ test_rshift_tl $lang \
+ "print 1 >> [make_uint64 $lang 0x100000000]" " = 0"
+ test_lshift_tl $lang \
+ "print -1 << [make_uint64 $lang 0x100000000]" " = 0"
+ test_rshift_tl $lang \
+ "print -1 >> [make_uint64 $lang 0x100000000]" " = -1"
+ }
}
}
diff --git a/gdb/testsuite/gdb.base/default.exp b/gdb/testsuite/gdb.base/default.exp
index 291722e..8f33121 100644
--- a/gdb/testsuite/gdb.base/default.exp
+++ b/gdb/testsuite/gdb.base/default.exp
@@ -692,7 +692,7 @@ set show_conv_list \
{$_gdb_setting_str = <internal function _gdb_setting_str>} \
{$_gdb_setting = <internal function _gdb_setting>} \
{$_gdb_major = 15} \
- {$_gdb_minor = 1} \
+ {$_gdb_minor = 2} \
{$_shell_exitsignal = void} \
{$_shell_exitcode = 0} \
}
diff --git a/gdb/testsuite/gdb.base/limited-length.c b/gdb/testsuite/gdb.base/limited-length.c
index 627c34d..c8ece16 100644
--- a/gdb/testsuite/gdb.base/limited-length.c
+++ b/gdb/testsuite/gdb.base/limited-length.c
@@ -41,6 +41,8 @@ int large_2d_array[][10] = {
{90, 91, 92, 93, 94, 95, 96, 97, 98, 99}
};
+char large_empty_string[100000] = "";
+
int
main ()
{
diff --git a/gdb/testsuite/gdb.base/limited-length.exp b/gdb/testsuite/gdb.base/limited-length.exp
index a24adcb..2d160e1 100644
--- a/gdb/testsuite/gdb.base/limited-length.exp
+++ b/gdb/testsuite/gdb.base/limited-length.exp
@@ -240,3 +240,13 @@ with_test_prefix "with unlimited print elements" {
"value is not available" \
"output expression referring unavailable element from history"
}
+
+gdb_test_no_output "set max-value-size 10000"
+gdb_test_no_output "set print elements 200"
+
+gdb_test "print large_empty_string" \
+ " = \\\{0 '\\\\000' <repeats 10000 times>, <unavailable> <repeats 90000 times>\\\}" \
+ "print large empty string which is not fully available"
+gdb_test -nonl "output large_empty_string" \
+ "\\\{0 '\\\\000' <repeats 10000 times>, <unavailable> <repeats 90000 times>\\\}" \
+ "output large empty string which is not fully available"
diff --git a/gdb/testsuite/gdb.reverse/step-precsave.exp b/gdb/testsuite/gdb.reverse/step-precsave.exp
index d937763..9ae67b3 100644
--- a/gdb/testsuite/gdb.reverse/step-precsave.exp
+++ b/gdb/testsuite/gdb.reverse/step-precsave.exp
@@ -69,6 +69,8 @@ with_timeout_factor 10 {
gdb_test "kill" "" "kill process, prepare to debug log file" \
"Kill the program being debugged\\? \\(y or n\\) " "y"
+clean_restart ${binfile}
+
gdb_test "record restore $precsave" \
"Restored records from core file .*" \
"reload core file"
diff --git a/gdb/valarith.c b/gdb/valarith.c
index 7034fa6..a95d108 100644
--- a/gdb/valarith.c
+++ b/gdb/valarith.c
@@ -1086,7 +1086,7 @@ type_length_bits (type *type)
static bool
check_valid_shift_count (enum exp_opcode op, type *result_type,
type *shift_count_type, const gdb_mpz &shift_count,
- unsigned long &nbits)
+ ULONGEST &nbits)
{
if (!shift_count_type->is_unsigned ())
{
@@ -1112,7 +1112,7 @@ check_valid_shift_count (enum exp_opcode op, type *result_type,
}
}
- nbits = shift_count.as_integer<unsigned long> ();
+ nbits = shift_count.as_integer<ULONGEST> ();
if (nbits >= type_length_bits (result_type))
{
/* In Go, shifting by large amounts is defined. Be silent and
@@ -1291,7 +1291,7 @@ scalar_binop (struct value *arg1, struct value *arg2, enum exp_opcode op)
case BINOP_LSH:
{
- unsigned long nbits;
+ ULONGEST nbits;
if (!check_valid_shift_count (op, result_type, type2, v2, nbits))
v = 0;
else
@@ -1301,9 +1301,23 @@ scalar_binop (struct value *arg1, struct value *arg2, enum exp_opcode op)
case BINOP_RSH:
{
- unsigned long nbits;
+ ULONGEST nbits;
if (!check_valid_shift_count (op, result_type, type2, v2, nbits))
- v = 0;
+ {
+ /* Pretend the too-large shift was decomposed in a
+ number of smaller shifts. An arithmetic signed
+ right shift of a negative number always yields -1
+ with such semantics. This is the right thing to
+ do for Go, and we might as well do it for
+ languages where it is undefined. Also, pretend a
+ shift by a negative number was a shift by the
+ negative number cast to unsigned, which is the
+ same as shifting by a too-large number. */
+ if (v1 < 0 && !result_type->is_unsigned ())
+ v = -1;
+ else
+ v = 0;
+ }
else
v = v1 >> nbits;
}
diff --git a/gdb/value.c b/gdb/value.c
index e71f38b..ede4313 100644
--- a/gdb/value.c
+++ b/gdb/value.c
@@ -1716,10 +1716,6 @@ value::record_latest ()
fetch_lazy ();
}
- ULONGEST limit = m_limited_length;
- if (limit != 0)
- mark_bytes_unavailable (limit, m_enclosing_type->length () - limit);
-
/* Mark the value as recorded in the history for the availability check. */
m_in_history = true;
@@ -3931,6 +3927,11 @@ value::fetch_lazy_memory ()
if (len > 0)
read_value_memory (this, 0, stack (), addr,
contents_all_raw ().data (), len);
+
+ /* If only part of an array was loaded, mark the rest as unavailable. */
+ if (m_limited_length > 0)
+ mark_bytes_unavailable (m_limited_length,
+ m_enclosing_type->length () - m_limited_length);
}
/* See value.h. */
diff --git a/gdb/version.in b/gdb/version.in
index 19415a5..b5bc579 100644
--- a/gdb/version.in
+++ b/gdb/version.in
@@ -1 +1 @@
-15.0.91.DATE-git
+15.1.90.DATE-git