rpms/gdb/devel gdb-6.8-ia64-breakpoint-restoration.patch, NONE, 1.1 gdb-6.8-watchpoint-conditionals-test.patch, NONE, 1.1 gdb-6.8-bz377541-vla.patch, 1.1, 1.2 gdb-6.8-inlining.patch, 1.3, 1.4 gdb-6.8-upstream.patch, 1.8, 1.9 gdb.spec, 1.307, 1.308 gdb-6.5-bz196439-valgrind-memcheck-compat-test.patch, 1.1, NONE gdb-6.8-watchpoint-cond-test.patch, 1.2, NONE
Jan Kratochvil
jkratoch at fedoraproject.org
Thu Nov 6 20:53:07 UTC 2008
Author: jkratoch
Update of /cvs/pkgs/rpms/gdb/devel
In directory cvs1.fedora.phx.redhat.com:/tmp/cvs-serv26512
Modified Files:
gdb-6.8-bz377541-vla.patch gdb-6.8-inlining.patch
gdb-6.8-upstream.patch gdb.spec
Added Files:
gdb-6.8-ia64-breakpoint-restoration.patch
gdb-6.8-watchpoint-conditionals-test.patch
Removed Files:
gdb-6.5-bz196439-valgrind-memcheck-compat-test.patch
gdb-6.8-watchpoint-cond-test.patch
Log Message:
* Tue Nov 4 2008 Jan Kratochvil <jan.kratochvil at redhat.com> - 6.8-26
- Fix more the variable-length-arrays support (BZ 468266, feature BZ 377541).
- Fix the watchpoints conditionals.
- Fix on PPC spurious SIGTRAPs on active watchpoints.
- Fix occasional stepping lockup on many threads, seen on ia64.
gdb-6.8-ia64-breakpoint-restoration.patch:
--- NEW FILE gdb-6.8-ia64-breakpoint-restoration.patch ---
gdb/
2008-10-28 Jan Kratochvil <jan.kratochvil at redhat.com>
Fix automatic restoration of breakpoints memory for ia64.
* ia64-tdep.c (ia64_memory_insert_breakpoint): New comment part for
SHADOW_CONTENTS content. Remova variable instr. New variable cleanup.
Force automatic breakpoints restoration. PLACED_SIZE and SHADOW_LEN
are now set larger, to BUNDLE_LEN - 2.
(ia64_memory_remove_breakpoint): Rename variables bundle to bundle_mem
and instr to instr_saved. New variables bundle_saved and
instr_breakpoint. Comment new reasons why we need to disable automatic
restoration of breakpoints. Assert PLACED_SIZE and SHADOW_LEN. New
check of the original memory content.
(ia64_breakpoint_from_pc): Array breakpoint extended to BUNDLE_LEN.
Sanity check the PCPTR parameter SLOTNUM value. New #if check on
BREAKPOINT_MAX vs. BUNDLE_LEN. Increase LENPTR to BUNDLE_LEN - 2.
gdb/testsuite/
2008-10-28 Jan Kratochvil <jan.kratochvil at redhat.com>
* gdb.base/breakpoint-shadow.exp, gdb.base/breakpoint-shadow.c: New.
[ RHEL-5 disable of `set breakpoint always-inserted'. ]
--- ./gdb/ia64-tdep.c 11 Sep 2008 14:23:15 -0000 1.184
+++ ./gdb/ia64-tdep.c 28 Oct 2008 10:28:41 -0000
@@ -545,7 +545,21 @@ fetch_instruction (CORE_ADDR addr, instr
simulators. So I changed the pattern slightly to do "break.i 0x080001"
instead. But that didn't work either (I later found out that this
pattern was used by the simulator that I was using.) So I ended up
- using the pattern seen below. */
+ using the pattern seen below.
+
+ SHADOW_CONTENTS has byte-based addressing (PLACED_ADDRESS and SHADOW_LEN)
+ while we need bit-based addressing as the instructions length is 41 bits and
+ we must not modify/corrupt the adjacent ones in the same bundle.
+ Fortunately we may store larger memory incl. the adjacent bits with the
+ original memory content (not the possibly already stored breakpoints there).
+ We need to be careful in ia64_memory_remove_breakpoint to always restore
+ only the specific bits of this instruction ignoring any adjacent stored
+ bits.
+
+ We use the original addressing with the low nibble 0..2 which gets
+ incorrectly interpreted by the generic GDB code as the byte offset of
+ SHADOW_CONTENTS. We store whole BUNDLE_LEN bytes just without these two
+ possibly skipped bytes. */
#if 0
#define IA64_BREAKPOINT 0x00002000040LL
@@ -559,15 +573,21 @@ ia64_memory_insert_breakpoint (struct gd
CORE_ADDR addr = bp_tgt->placed_address;
char bundle[BUNDLE_LEN];
int slotnum = (int) (addr & 0x0f) / SLOT_MULTIPLIER;
- long long instr;
int val;
int template;
+ struct cleanup *cleanup;
if (slotnum > 2)
error (_("Can't insert breakpoint for slot numbers greater than 2."));
addr &= ~0x0f;
+ /* Enable the automatic memory restoration from breakpoints while
+ we read our instruction bundle. Otherwise, we could store into
+ SHADOW_CONTENTS an already stored breakpoint at the same location.
+ In practice it is already being prevented by the DUPLICATE field and
+ update_global_location_list. */
+ cleanup = make_show_memory_breakpoints_cleanup (0);
val = target_read_memory (addr, bundle, BUNDLE_LEN);
/* Check for L type instruction in 2nd slot, if present then
@@ -578,13 +598,18 @@ ia64_memory_insert_breakpoint (struct gd
slotnum = 2;
}
- instr = slotN_contents (bundle, slotnum);
- memcpy (bp_tgt->shadow_contents, &instr, sizeof (instr));
- bp_tgt->placed_size = bp_tgt->shadow_len = sizeof (instr);
+ /* Slot number 2 may skip at most 2 bytes at the beginning. */
+ bp_tgt->placed_size = bp_tgt->shadow_len = BUNDLE_LEN - 2;
+
+ /* Store the whole bundle, except for the initial skipped bytes by the slot
+ number interpreted as bytes offset in PLACED_ADDRESS. */
+ memcpy (bp_tgt->shadow_contents, bundle + slotnum, bp_tgt->shadow_len);
+
replace_slotN_contents (bundle, IA64_BREAKPOINT, slotnum);
if (val == 0)
- target_write_memory (addr, bundle, BUNDLE_LEN);
+ target_write_memory (addr + slotnum, bundle + slotnum, bp_tgt->shadow_len);
+ do_cleanups (cleanup);
return val;
}
@@ -593,9 +618,9 @@ ia64_memory_remove_breakpoint (struct gd
struct bp_target_info *bp_tgt)
{
CORE_ADDR addr = bp_tgt->placed_address;
- char bundle[BUNDLE_LEN];
+ char bundle_mem[BUNDLE_LEN], bundle_saved[BUNDLE_LEN];
int slotnum = (addr & 0x0f) / SLOT_MULTIPLIER;
- long long instr;
+ long long instr_breakpoint, instr_saved;
int val;
int template;
struct cleanup *cleanup;
@@ -604,23 +629,39 @@ ia64_memory_remove_breakpoint (struct gd
/* Disable the automatic memory restoration from breakpoints while
we read our instruction bundle. Otherwise, the general restoration
- mechanism kicks in and ends up corrupting our bundle, because it
- is not aware of the concept of instruction bundles. */
+ mechanism kicks in and we would possibly remove parts of the adjacent
+ placed breakpoints. It is due to our SHADOW_CONTENTS overlapping the real
+ breakpoint instruction bits region. */
cleanup = make_show_memory_breakpoints_cleanup (1);
- val = target_read_memory (addr, bundle, BUNDLE_LEN);
+ val = target_read_memory (addr, bundle_mem, BUNDLE_LEN);
/* Check for L type instruction in 2nd slot, if present then
bump up the slot number to the 3rd slot */
- template = extract_bit_field (bundle, 0, 5);
+ template = extract_bit_field (bundle_mem, 0, 5);
if (slotnum == 1 && template_encoding_table[template][1] == L)
{
slotnum = 2;
}
- memcpy (&instr, bp_tgt->shadow_contents, sizeof instr);
- replace_slotN_contents (bundle, instr, slotnum);
+ gdb_assert (bp_tgt->placed_size == BUNDLE_LEN - 2);
+ gdb_assert (bp_tgt->placed_size == bp_tgt->shadow_len);
+
+ instr_breakpoint = slotN_contents (bundle_mem, slotnum);
+ if (instr_breakpoint != IA64_BREAKPOINT)
+ warning (_("Breakpoint removal cannot find the placed breakpoint at %s"),
+ paddr_nz (bp_tgt->placed_address));
+
+ /* Extract the original saved instruction from SLOTNUM normalizing its
+ bit-shift for INSTR_SAVED. */
+ memcpy (bundle_saved, bundle_mem, BUNDLE_LEN);
+ memcpy (bundle_saved + slotnum, bp_tgt->shadow_contents, bp_tgt->shadow_len);
+ instr_saved = slotN_contents (bundle_saved, slotnum);
+
+ /* In BUNDLE_MEM be careful to modify only the bits belonging to SLOTNUM and
+ never any other possibly also stored in SHADOW_CONTENTS. */
+ replace_slotN_contents (bundle_mem, instr_saved, slotnum);
if (val == 0)
- target_write_memory (addr, bundle, BUNDLE_LEN);
+ target_write_memory (addr, bundle_mem, BUNDLE_LEN);
do_cleanups (cleanup);
return val;
@@ -631,12 +672,18 @@ ia64_memory_remove_breakpoint (struct gd
const unsigned char *
ia64_breakpoint_from_pc (struct gdbarch *gdbarch, CORE_ADDR *pcptr, int *lenptr)
{
- static unsigned char breakpoint[] =
- { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
- *lenptr = sizeof (breakpoint);
-#if 0
- *pcptr &= ~0x0f;
+ static unsigned char breakpoint[BUNDLE_LEN];
+ int slotnum = (int) (*pcptr & 0x0f) / SLOT_MULTIPLIER;
+
+ if (slotnum > 2)
+ error (_("Can't insert breakpoint for slot numbers greater than 2."));
+
+#if BREAKPOINT_MAX < BUNDLE_LEN
+# error "BREAKPOINT_MAX < BUNDLE_LEN"
#endif
+
+ *lenptr = BUNDLE_LEN - 2;
+
return breakpoint;
}
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ./gdb/testsuite/gdb.base/breakpoint-shadow.c 28 Oct 2008 10:28:41 -0000
@@ -0,0 +1,27 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2008 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/>. */
+
+int
+main (void)
+{
+ volatile int i;
+
+ i = 1; /* break-first */
+ i = 2; /* break-second */
+
+ return 0;
+}
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ ./gdb/testsuite/gdb.base/breakpoint-shadow.exp 28 Oct 2008 10:28:41 -0000
@@ -0,0 +1,65 @@
+# Copyright 2008 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/>.
+
+set testfile breakpoint-shadow
+set srcfile ${testfile}.c
+set binfile ${objdir}/${subdir}/${testfile}
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
+ untested "Couldn't compile test program"
+ return -1
+}
+
+gdb_exit
+gdb_start
+gdb_reinitialize_dir $srcdir/$subdir
+gdb_load ${binfile}
+
+# We need to start the inferior to place the breakpoints in the memory at all.
+if { [gdb_start_cmd] < 0 } {
+ untested start
+ return -1
+}
+gdb_test "" "main \\(\\) at .*" "start"
+
+# The default "auto" mode removes all the breakpoints when we stop (and not
+# running the nonstop mode). We would not be able to test the shadow.
+#RHEL-5:
+#gdb_test "set breakpoint always-inserted on"
+#gdb_test "show breakpoint always-inserted" "Always inserted breakpoint mode is on."
+
+set match "\nDump of assembler code for function main:\r\n(.*)End of assembler dump.\r\n$gdb_prompt $"
+
+set test "disassembly without breakpoints"
+gdb_test_multiple "disass main" $test {
+ -re $match {
+ set orig $expect_out(1,string)
+ pass $test
+ }
+}
+
+gdb_test "b [gdb_get_line_number "break-first"]" "Breakpoint \[0-9\] at .*" "First breakpoint placed"
+gdb_test "b [gdb_get_line_number "break-second"]" "Breakpoint \[0-9\] at .*" "Second breakpoint placed"
+
+set test "disassembly with breakpoints"
+gdb_test_multiple "disass main" $test {
+ -re $match {
+ set got $expect_out(1,string)
+ if [string equal -nocase $orig $got] {
+ pass $test
+ } else {
+ fail $test
+ }
+ }
+}
gdb-6.8-watchpoint-conditionals-test.patch:
--- NEW FILE gdb-6.8-watchpoint-conditionals-test.patch ---
For:
http://sourceware.org/ml/gdb-patches/2008-04/msg00379.html
http://sourceware.org/ml/gdb-cvs/2008-04/msg00104.html
--- /dev/null 2008-11-04 06:31:10.599601840 +0100
+++ gdb-6.8/gdb/testsuite/gdb.base/watchpoint-cond.exp 2008-11-04 06:43:29.000000000 +0100
@@ -0,0 +1,37 @@
+# Copyright 2008 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/>.
+
+set testfile watchpoint-cond
+set srcfile ${testfile}.c
+set binfile ${objdir}/${subdir}/${testfile}
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
+ untested "Couldn't compile test program"
+ return -1
+}
+
+# Get things started.
+
+gdb_exit
+gdb_start
+gdb_reinitialize_dir $srcdir/$subdir
+gdb_load ${binfile}
+
+if { [runto_main] < 0 } {
+ untested watchpoint-cond
+ return -1
+}
+
+gdb_test "watch i if i < 20" "atchpoint \[0-9\]+: i"
+gdb_test "cont" "atchpoint \[0-9\]+: i.*Old value = 20.*New value = 19.*"
--- /dev/null 2008-11-04 06:31:10.599601840 +0100
+++ gdb-6.8/gdb/testsuite/gdb.base/watchpoint-cond.c 2008-11-04 06:42:48.000000000 +0100
@@ -0,0 +1,31 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2008 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/>.
+
+ Please email any bugs, comments, and/or additions to this file to:
+ bug-gdb at prep.ai.mit.edu */
+
+int
+main (int argc, char **argv)
+{
+ static int i = 0; /* `static' to start initialized. */
+ int j = 2;
+
+ for (j = 0; j < 30; j++)
+ i = 30 - j;
+
+ return 0;
+}
gdb-6.8-bz377541-vla.patch:
Index: gdb-6.8-bz377541-vla.patch
===================================================================
RCS file: /cvs/pkgs/rpms/gdb/devel/gdb-6.8-bz377541-vla.patch,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- gdb-6.8-bz377541-vla.patch 3 Nov 2008 03:34:39 -0000 1.1
+++ gdb-6.8-bz377541-vla.patch 6 Nov 2008 20:52:35 -0000 1.2
@@ -1,9 +1,9 @@
Based on:
http://people.redhat.com/jkratoch/vla/
-fortran-dynamic-arrays-HEAD-i.patch
+fortran-dynamic-arrays-HEAD-j.patch
---- ./gdb/c-typeprint.c 2008-10-29 20:56:57.000000000 +0100
-+++ ./gdb/c-typeprint.c 2008-10-29 21:32:13.000000000 +0100
+--- ./gdb/c-typeprint.c 2008-11-06 20:50:14.000000000 +0100
++++ ./gdb/c-typeprint.c 2008-11-06 20:51:03.000000000 +0100
@@ -541,7 +541,12 @@ c_type_print_varspec_suffix (struct type
fprintf_filtered (stream, ")");
@@ -18,8 +18,8 @@
&& !TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED (type))
fprintf_filtered (stream, "%d",
(TYPE_LENGTH (type)
---- ./gdb/dwarf2expr.c 2008-10-29 10:50:23.000000000 +0100
-+++ ./gdb/dwarf2expr.c 2008-10-29 21:32:13.000000000 +0100
+--- ./gdb/dwarf2expr.c 2008-11-06 20:50:14.000000000 +0100
++++ ./gdb/dwarf2expr.c 2008-11-06 20:51:03.000000000 +0100
@@ -750,6 +750,13 @@ execute_stack_op (struct dwarf_expr_cont
ctx->initialized = 0;
goto no_push;
@@ -34,8 +34,8 @@
default:
error (_("Unhandled dwarf expression opcode 0x%x"), op);
}
---- ./gdb/dwarf2expr.h 2008-10-29 10:50:23.000000000 +0100
-+++ ./gdb/dwarf2expr.h 2008-10-29 21:32:13.000000000 +0100
+--- ./gdb/dwarf2expr.h 2008-11-06 20:50:14.000000000 +0100
++++ ./gdb/dwarf2expr.h 2008-11-06 20:51:03.000000000 +0100
@@ -61,10 +61,10 @@ struct dwarf_expr_context
The result must be live until the current expression evaluation
is complete. */
@@ -48,8 +48,8 @@
/* The current depth of dwarf expression recursion, via DW_OP_call*,
DW_OP_fbreg, DW_OP_push_object_address, etc., and the maximum
---- ./gdb/dwarf2loc.c 2008-10-29 10:50:23.000000000 +0100
-+++ ./gdb/dwarf2loc.c 2008-11-01 20:31:51.000000000 +0100
+--- ./gdb/dwarf2loc.c 2008-11-06 20:50:14.000000000 +0100
++++ ./gdb/dwarf2loc.c 2008-11-06 20:51:35.000000000 +0100
@@ -106,6 +106,9 @@ struct dwarf_expr_baton
{
struct frame_info *frame;
@@ -60,7 +60,49 @@
};
/* Helper functions for dwarf2_evaluate_loc_desc. */
-@@ -189,6 +192,105 @@ dwarf_expr_tls_address (void *baton, COR
+@@ -164,22 +167,32 @@ dwarf_expr_frame_base (void *baton, gdb_
+ *start = find_location_expression (symbaton, length,
+ get_frame_address_in_block (frame));
+ }
+- else
++ else if (SYMBOL_OPS (framefunc) == &dwarf2_locexpr_funcs)
+ {
+ struct dwarf2_locexpr_baton *symbaton;
++
+ symbaton = SYMBOL_LOCATION_BATON (framefunc);
+- if (symbaton != NULL)
+- {
+- *length = symbaton->size;
+- *start = symbaton->data;
+- }
+- else
+- *start = NULL;
++ gdb_assert (symbaton != NULL);
++ *start = symbaton->data;
++ *length = symbaton->size;
+ }
++ else if (SYMBOL_OPS (framefunc) == &dwarf2_missing_funcs)
++ {
++ struct dwarf2_locexpr_baton *symbaton;
++
++ symbaton = SYMBOL_LOCATION_BATON (framefunc);
++ gdb_assert (symbaton == NULL);
++ *start = NULL;
++ *length = 0; /* unused */
++ }
++ else
++ internal_error (__FILE__, __LINE__,
++ _("Unsupported SYMBOL_OPS %p for \"%s\""),
++ SYMBOL_OPS (framefunc), SYMBOL_PRINT_NAME (framefunc));
+
+ if (*start == NULL)
+ error (_("Could not find the frame base for \"%s\"."),
+- SYMBOL_NATURAL_NAME (framefunc));
++ SYMBOL_PRINT_NAME (framefunc));
+ }
+
+ /* Using the objfile specified in BATON, find the address for the
+@@ -192,6 +205,117 @@ dwarf_expr_tls_address (void *baton, COR
return target_translate_tls_address (debaton->objfile, offset);
}
@@ -95,7 +137,10 @@
+ xfree (prev_save);
+}
+
-+/* It would be useful to sanity check ADDRESS - such as for some objects with
++/* Set the base address - DW_AT_location - of a variable. It is being later
++ used to derive other object addresses by DW_OP_push_object_address.
++
++ It would be useful to sanity check ADDRESS - such as for some objects with
+ unset VALUE_ADDRESS - but some valid addresses may be zero (such as first
+ objects in relocatable .o files). */
+
@@ -113,9 +158,10 @@
+
+/* Evaluate DWARF expression at DATA ... DATA + SIZE with its result readable
+ by dwarf_expr_fetch (RETVAL, 0). FRAME parameter can be NULL to call
-+ get_selected_frame to find it. */
++ get_selected_frame to find it. Returned dwarf_expr_context freeing is
++ pushed on the cleanup chain. */
+
-+struct dwarf_expr_context *
++static struct dwarf_expr_context *
+dwarf_expr_prep_ctx (struct frame_info *frame, gdb_byte *data,
+ unsigned short size, struct objfile *objfile)
+{
@@ -137,8 +183,13 @@
+ ctx->get_tls_address = dwarf_expr_tls_address;
+ ctx->get_object_address = dwarf_expr_object_address;
+
++ make_cleanup ((make_cleanup_ftype *) free_dwarf_expr_context, ctx);
++
+ dwarf_expr_eval (ctx, data, size);
+
++ /* It was used only during dwarf_expr_eval. */
++ ctx->baton = NULL;
++
+ return ctx;
+}
+
@@ -150,6 +201,7 @@
+{
+ struct dwarf_expr_context *ctx;
+ CORE_ADDR retval;
++ struct cleanup *back_to = make_cleanup (null_cleanup, 0);
+
+ ctx = dwarf_expr_prep_ctx (NULL, dlbaton->data, dlbaton->size,
+ dlbaton->objfile);
@@ -160,40 +212,44 @@
+
+ retval = dwarf_expr_fetch (ctx, 0);
+
++ do_cleanups (back_to);
++
+ return retval;
+}
+
/* Evaluate a location description, starting at DATA and with length
SIZE, to find the current location of variable VAR in the context
of FRAME. */
-@@ -199,7 +301,6 @@ dwarf2_evaluate_loc_desc (struct symbol
+@@ -202,8 +326,8 @@ dwarf2_evaluate_loc_desc (struct symbol
{
struct gdbarch *arch = get_frame_arch (frame);
struct value *retval;
- struct dwarf_expr_baton baton;
struct dwarf_expr_context *ctx;
++ struct cleanup *back_to = make_cleanup (null_cleanup, 0);
if (size == 0)
-@@ -210,17 +311,8 @@ dwarf2_evaluate_loc_desc (struct symbol
+ {
+@@ -213,17 +337,8 @@ dwarf2_evaluate_loc_desc (struct symbol
return retval;
}
- baton.frame = frame;
- baton.objfile = objfile;
--
++ ctx = dwarf_expr_prep_ctx (frame, data, size, objfile);
+
- ctx = new_dwarf_expr_context ();
- ctx->baton = &baton;
- ctx->read_reg = dwarf_expr_read_reg;
- ctx->read_mem = dwarf_expr_read_mem;
- ctx->get_frame_base = dwarf_expr_frame_base;
- ctx->get_tls_address = dwarf_expr_tls_address;
-+ ctx = dwarf_expr_prep_ctx (frame, data, size, objfile);
-
+-
- dwarf_expr_eval (ctx, data, size);
if (ctx->num_pieces > 0)
{
int i;
-@@ -258,6 +351,10 @@ dwarf2_evaluate_loc_desc (struct symbol
+@@ -261,6 +376,10 @@ dwarf2_evaluate_loc_desc (struct symbol
{
CORE_ADDR address = dwarf_expr_fetch (ctx, 0);
@@ -204,24 +260,100 @@
retval = allocate_value (SYMBOL_TYPE (var));
VALUE_LVAL (retval) = lval_memory;
set_value_lazy (retval, 1);
---- ./gdb/dwarf2loc.h 2008-10-29 10:50:23.000000000 +0100
-+++ ./gdb/dwarf2loc.h 2008-11-01 20:16:31.000000000 +0100
-@@ -66,4 +66,13 @@ struct dwarf2_loclist_baton
+@@ -269,7 +388,7 @@ dwarf2_evaluate_loc_desc (struct symbol
+
+ set_value_initialized (retval, ctx->initialized);
+
+- free_dwarf_expr_context (ctx);
++ do_cleanups (back_to);
+
+ return retval;
+ }
+@@ -578,7 +697,7 @@ static int
+ loclist_describe_location (struct symbol *symbol, struct ui_file *stream)
+ {
+ /* FIXME: Could print the entire list of locations. */
+- fprintf_filtered (stream, "a variable with multiple locations");
++ fprintf_filtered (stream, _("a variable with multiple locations"));
+ return 1;
+ }
+
+@@ -594,16 +713,56 @@ loclist_tracepoint_var_ref (struct symbo
+
+ data = find_location_expression (dlbaton, &size, ax->scope);
+ if (data == NULL)
+- error (_("Variable \"%s\" is not available."), SYMBOL_NATURAL_NAME (symbol));
++ error (_("Variable \"%s\" is not available."), SYMBOL_PRINT_NAME (symbol));
+
+ dwarf2_tracepoint_var_ref (symbol, ax, value, data, size);
+ }
+
+-/* The set of location functions used with the DWARF-2 expression
+- evaluator and location lists. */
++/* The set of location functions used with the DWARF-2 location lists. */
+ const struct symbol_ops dwarf2_loclist_funcs = {
+ loclist_read_variable,
+ loclist_read_needs_frame,
+ loclist_describe_location,
+ loclist_tracepoint_var_ref
+ };
++
++static struct value *
++missing_read_variable (struct symbol *symbol, struct frame_info *frame)
++{
++ struct dwarf2_loclist_baton *dlbaton = SYMBOL_LOCATION_BATON (symbol);
++
++ gdb_assert (dlbaton == NULL);
++ error (_("Unable to resolve variable \"%s\""), SYMBOL_PRINT_NAME (symbol));
++}
++
++static int
++missing_read_needs_frame (struct symbol *symbol)
++{
++ return 0;
++}
++
++static int
++missing_describe_location (struct symbol *symbol, struct ui_file *stream)
++{
++ fprintf_filtered (stream, _("a variable we are unable to resolve"));
++ return 1;
++}
++
++static void
++missing_tracepoint_var_ref (struct symbol *symbol, struct agent_expr *ax,
++ struct axs_value *value)
++{
++ struct dwarf2_loclist_baton *dlbaton = SYMBOL_LOCATION_BATON (symbol);
++
++ gdb_assert (dlbaton == NULL);
++ error (_("Unable to resolve variable \"%s\""), SYMBOL_PRINT_NAME (symbol));
++}
++
++/* The set of location functions used with the DWARF-2 evaluator when we are
++ unable to resolve the symbols. */
++const struct symbol_ops dwarf2_missing_funcs = {
++ missing_read_variable,
++ missing_read_needs_frame,
++ missing_describe_location,
++ missing_tracepoint_var_ref
++};
+--- ./gdb/dwarf2loc.h 2008-11-06 20:50:14.000000000 +0100
++++ ./gdb/dwarf2loc.h 2008-11-06 20:52:23.000000000 +0100
+@@ -65,5 +65,11 @@ struct dwarf2_loclist_baton
+
extern const struct symbol_ops dwarf2_locexpr_funcs;
extern const struct symbol_ops dwarf2_loclist_funcs;
-
-+extern void object_address_set (CORE_ADDR address);
++extern const struct symbol_ops dwarf2_missing_funcs;
+
-+extern struct dwarf_expr_context *dwarf_expr_prep_ctx
-+ (struct frame_info *frame, gdb_byte *data, unsigned short size,
-+ struct objfile *objfile);
++extern void object_address_set (CORE_ADDR address);
+
+extern CORE_ADDR dwarf_locexpr_baton_eval
+ (struct dwarf2_locexpr_baton *dlbaton);
-+
+
#endif /* dwarf2loc.h */
---- ./gdb/dwarf2read.c 2008-10-29 20:56:57.000000000 +0100
-+++ ./gdb/dwarf2read.c 2008-11-01 20:30:52.000000000 +0100
+--- ./gdb/dwarf2read.c 2008-11-06 20:50:14.000000000 +0100
++++ ./gdb/dwarf2read.c 2008-11-06 20:51:35.000000000 +0100
@@ -1005,7 +1005,14 @@ static void store_in_ref_table (unsigned
static unsigned int dwarf2_get_ref_die_offset (struct attribute *,
struct dwarf2_cu *);
@@ -338,12 +470,12 @@
+
attr = dwarf2_attr (die, DW_AT_string_length, cu);
- if (attr)
-- {
++ switch (dwarf2_get_attr_constant_value (attr, &length))
+ {
- length = DW_UNSND (attr);
- }
- else
-+ switch (dwarf2_get_attr_constant_value (attr, &length))
- {
+- {
- /* check for the DW_AT_byte_size attribute */
+ case dwarf2_attr_const:
+ /* We currently do not support a constant address where the location
@@ -616,7 +748,7 @@
- return default_value;
+ *val_return = DW_SND (attr);
+ return dwarf2_attr_const;
- }
++ }
+ if (attr->form == DW_FORM_udata
+ || attr->form == DW_FORM_data1
+ || attr->form == DW_FORM_data2
@@ -625,7 +757,7 @@
+ {
+ *val_return = DW_UNSND (attr);
+ return dwarf2_attr_const;
-+ }
+ }
+ if (attr->form == DW_FORM_block
+ || attr->form == DW_FORM_block1
+ || attr->form == DW_FORM_block2
@@ -672,19 +804,28 @@
static void
dwarf2_symbol_mark_computed (struct attribute *attr, struct symbol *sym,
struct dwarf2_cu *cu)
-@@ -9938,34 +10113,18 @@ dwarf2_symbol_mark_computed (struct attr
+@@ -9938,34 +10113,24 @@ dwarf2_symbol_mark_computed (struct attr
SYMBOL_OPS (sym) = &dwarf2_loclist_funcs;
SYMBOL_LOCATION_BATON (sym) = baton;
}
-- else
+ else if (attr_form_is_block (attr))
++ {
++ SYMBOL_OPS (sym) = &dwarf2_locexpr_funcs;
++ SYMBOL_LOCATION_BATON (sym) = dwarf2_attr_to_locexpr_baton (attr, cu);
++ }
+ else
{
- struct dwarf2_locexpr_baton *baton;
--
++ dwarf2_invalid_attrib_class_complaint ("location description",
++ SYMBOL_NATURAL_NAME (sym));
+
- baton = obstack_alloc (&cu->objfile->objfile_obstack,
- sizeof (struct dwarf2_locexpr_baton));
- baton->objfile = objfile;
--
++ /* Some methods are called without checking SYMBOL_OPS validity. */
++ SYMBOL_OPS (sym) = &dwarf2_missing_funcs;
++ SYMBOL_LOCATION_BATON (sym) = NULL;
+
- if (attr_form_is_block (attr))
- {
- /* Note that we're just copying the block's data pointer
@@ -703,21 +844,16 @@
- baton->data = NULL;
- }
-
- SYMBOL_OPS (sym) = &dwarf2_locexpr_funcs;
+- SYMBOL_OPS (sym) = &dwarf2_locexpr_funcs;
- SYMBOL_LOCATION_BATON (sym) = baton;
-+ SYMBOL_LOCATION_BATON (sym) = dwarf2_attr_to_locexpr_baton (attr, cu);
-+ }
-+ else
-+ {
-+ dwarf2_invalid_attrib_class_complaint ("location description",
-+ SYMBOL_NATURAL_NAME (sym));
-+ /* We have no valid SYMBOL_OPS. */
++ /* For functions a missing DW_AT_frame_base does not optimize out the
++ whole function definition, only its frame base resolving. */
+ if (attr->name == DW_AT_location)
+ SYMBOL_CLASS (sym) = LOC_OPTIMIZED_OUT;
}
}
-@@ -10205,6 +10363,27 @@ offset_and_type_eq (const void *item_lhs
+@@ -10205,6 +10370,27 @@ offset_and_type_eq (const void *item_lhs
return ofs_lhs->offset == ofs_rhs->offset;
}
@@ -745,7 +881,7 @@
/* Set the type associated with DIE to TYPE. Save it in CU's hash
table if necessary. */
-@@ -10215,6 +10394,8 @@ set_die_type (struct die_info *die, stru
+@@ -10215,6 +10401,8 @@ set_die_type (struct die_info *die, stru
die->type = type;
@@ -754,8 +890,8 @@
if (cu->per_cu == NULL)
return;
---- ./gdb/eval.c 2008-10-29 20:56:57.000000000 +0100
-+++ ./gdb/eval.c 2008-11-01 19:58:56.000000000 +0100
+--- ./gdb/eval.c 2008-11-06 20:50:14.000000000 +0100
++++ ./gdb/eval.c 2008-11-06 20:51:35.000000000 +0100
@@ -38,6 +38,7 @@
#include "ui-out.h"
#include "exceptions.h"
@@ -764,7 +900,26 @@
#include "gdb_assert.h"
-@@ -1644,9 +1645,12 @@ evaluate_subexp_standard (struct type *e
+@@ -429,6 +430,7 @@ evaluate_subexp_standard (struct type *e
+ long mem_offset;
+ struct type **arg_types;
+ int save_pos1;
++ struct cleanup *old_chain;
+
+ pc = (*pos)++;
+ op = exp->elts[pc].opcode;
+@@ -1280,7 +1282,10 @@ evaluate_subexp_standard (struct type *e
+
+ /* First determine the type code we are dealing with. */
+ arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
++ old_chain = make_cleanup (null_cleanup, 0);
++ object_address_set (VALUE_ADDRESS (arg1));
+ type = check_typedef (value_type (arg1));
++ do_cleanups (old_chain);
+ code = TYPE_CODE (type);
+
+ if (code == TYPE_CODE_PTR)
+@@ -1644,13 +1649,19 @@ evaluate_subexp_standard (struct type *e
{
int subscript_array[MAX_FORTRAN_DIMS];
int array_size_array[MAX_FORTRAN_DIMS];
@@ -777,7 +932,14 @@
if (nargs > MAX_FORTRAN_DIMS)
error (_("Too many subscripts for F77 (%d Max)"), MAX_FORTRAN_DIMS);
-@@ -1678,6 +1682,9 @@ evaluate_subexp_standard (struct type *e
+
++ old_chain = make_cleanup (null_cleanup, 0);
++ object_address_set (VALUE_ADDRESS (arg1));
++
+ tmp_type = check_typedef (value_type (arg1));
+ ndimensions = calc_f77_array_dims (type);
+
+@@ -1678,6 +1689,9 @@ evaluate_subexp_standard (struct type *e
upper = f77_get_upperbound (tmp_type);
lower = f77_get_lowerbound (tmp_type);
@@ -787,12 +949,17 @@
array_size_array[nargs - i - 1] = upper - lower + 1;
/* Zero-normalize subscripts so that offsetting will work. */
-@@ -1698,15 +1705,20 @@ evaluate_subexp_standard (struct type *e
+@@ -1696,17 +1710,25 @@ evaluate_subexp_standard (struct type *e
+ tmp_type = check_typedef (TYPE_TARGET_TYPE (tmp_type));
+ }
- /* Now let us calculate the offset for this item */
+- /* Now let us calculate the offset for this item */
++ /* Kept for the f77_get_upperbound / f77_get_lowerbound calls above. */
++ do_cleanups (old_chain);
- offset_item = subscript_array[ndimensions - 1];
--
++ /* Now let us calculate the offset for this item */
+
- for (i = ndimensions - 1; i > 0; --i)
- offset_item =
- array_size_array[i - 1] * offset_item + subscript_array[i - 1];
@@ -815,7 +982,7 @@
/* Let us now play a dirty trick: we will take arg1
which is a value node pointing to the topmost level
-@@ -1716,7 +1728,7 @@ evaluate_subexp_standard (struct type *e
+@@ -1716,7 +1738,7 @@ evaluate_subexp_standard (struct type *e
returns the correct type value */
deprecated_set_value_type (arg1, tmp_type);
@@ -824,7 +991,7 @@
}
case BINOP_LOGICAL_AND:
-@@ -2300,9 +2312,12 @@ evaluate_subexp_for_sizeof (struct expre
+@@ -2300,9 +2322,12 @@ evaluate_subexp_for_sizeof (struct expre
case OP_VAR_VALUE:
(*pos) += 4;
@@ -840,8 +1007,8 @@
default:
val = evaluate_subexp (NULL_TYPE, exp, pos, EVAL_AVOID_SIDE_EFFECTS);
---- ./gdb/f-lang.h 2008-10-29 10:55:07.000000000 +0100
-+++ ./gdb/f-lang.h 2008-10-29 21:32:13.000000000 +0100
+--- ./gdb/f-lang.h 2008-11-06 20:50:14.000000000 +0100
++++ ./gdb/f-lang.h 2008-11-06 20:51:03.000000000 +0100
@@ -28,6 +28,10 @@ extern void f_error (char *); /* Defined
extern void f_print_type (struct type *, char *, struct ui_file *, int,
int);
@@ -853,8 +1020,8 @@
extern int f_val_print (struct type *, const gdb_byte *, int, CORE_ADDR,
struct ui_file *, int, int, int,
enum val_prettyprint);
---- ./gdb/f-typeprint.c 2008-10-29 10:55:07.000000000 +0100
-+++ ./gdb/f-typeprint.c 2008-11-01 17:51:42.000000000 +0100
+--- ./gdb/f-typeprint.c 2008-11-06 20:50:14.000000000 +0100
++++ ./gdb/f-typeprint.c 2008-11-06 20:51:03.000000000 +0100
@@ -31,7 +31,7 @@
#include "gdbcore.h"
#include "target.h"
@@ -990,8 +1157,8 @@
if (passed_a_ptr)
fprintf_filtered (stream, ")");
---- ./gdb/f-valprint.c 2008-10-29 20:48:30.000000000 +0100
-+++ ./gdb/f-valprint.c 2008-11-01 17:55:30.000000000 +0100
+--- ./gdb/f-valprint.c 2008-11-06 20:50:14.000000000 +0100
++++ ./gdb/f-valprint.c 2008-11-06 20:51:03.000000000 +0100
@@ -54,15 +54,17 @@ int f77_array_offset_tbl[MAX_FORTRAN_DIM
/* The following macro gives us the size of the nth dimension, Where
n is 1 based. */
@@ -1111,8 +1278,8 @@
CHECK_TYPEDEF (type);
switch (TYPE_CODE (type))
{
---- ./gdb/findvar.c 2008-10-29 10:50:23.000000000 +0100
-+++ ./gdb/findvar.c 2008-11-01 20:13:39.000000000 +0100
+--- ./gdb/findvar.c 2008-11-06 20:50:14.000000000 +0100
++++ ./gdb/findvar.c 2008-11-06 20:51:03.000000000 +0100
@@ -34,6 +34,7 @@
#include "regcache.h"
#include "user-regs.h"
@@ -1315,8 +1482,8 @@
}
else
{
---- ./gdb/gdbtypes.c 2008-10-29 21:22:30.000000000 +0100
-+++ ./gdb/gdbtypes.c 2008-11-01 20:20:42.000000000 +0100
+--- ./gdb/gdbtypes.c 2008-11-06 20:50:14.000000000 +0100
++++ ./gdb/gdbtypes.c 2008-11-06 20:51:03.000000000 +0100
@@ -38,6 +38,8 @@
#include "cp-abi.h"
#include "gdb_assert.h"
@@ -1683,8 +1850,8 @@
return type;
}
---- ./gdb/gdbtypes.h 2008-10-29 20:56:57.000000000 +0100
-+++ ./gdb/gdbtypes.h 2008-11-02 11:01:18.000000000 +0100
+--- ./gdb/gdbtypes.h 2008-11-06 20:50:14.000000000 +0100
++++ ./gdb/gdbtypes.h 2008-11-06 20:51:03.000000000 +0100
@@ -310,6 +310,16 @@ enum type_code
#define TYPE_FLAG_NOTTEXT (1 << 17)
#define TYPE_NOTTEXT(t) (TYPE_FLAGS (t) & TYPE_FLAG_NOTTEXT)
@@ -1817,8 +1984,8 @@
extern struct type *create_string_type (struct type *, struct type *);
extern struct type *create_set_type (struct type *, struct type *);
---- ./gdb/printcmd.c 2008-10-29 10:50:23.000000000 +0100
-+++ ./gdb/printcmd.c 2008-10-29 21:32:14.000000000 +0100
+--- ./gdb/printcmd.c 2008-11-06 20:50:14.000000000 +0100
++++ ./gdb/printcmd.c 2008-11-06 20:51:03.000000000 +0100
@@ -888,6 +888,11 @@ print_command_1 (char *exp, int inspect,
else
val = access_value_history (0);
@@ -1832,7 +1999,7 @@
TYPE_CODE (value_type (val)) != TYPE_CODE_VOID))
{
--- ./gdb/testsuite/gdb.base/vla-overflow.c 1970-01-01 01:00:00.000000000 +0100
-+++ ./gdb/testsuite/gdb.base/vla-overflow.c 2008-11-01 17:18:12.000000000 +0100
++++ ./gdb/testsuite/gdb.base/vla-overflow.c 2008-11-06 20:51:03.000000000 +0100
@@ -0,0 +1,30 @@
+/* This testcase is part of GDB, the GNU debugger.
+
@@ -1865,7 +2032,7 @@
+ return 0;
+}
--- ./gdb/testsuite/gdb.base/vla-overflow.exp 1970-01-01 01:00:00.000000000 +0100
-+++ ./gdb/testsuite/gdb.base/vla-overflow.exp 2008-11-01 17:42:32.000000000 +0100
++++ ./gdb/testsuite/gdb.base/vla-overflow.exp 2008-11-06 20:51:35.000000000 +0100
@@ -0,0 +1,108 @@
+# Copyright 2008 Free Software Foundation, Inc.
+
@@ -1972,11 +2139,11 @@
+verbose -log "kb_found in abort() = [expr [memory_v_pages_get] * $pagesize / 1024]"
+
+# `abort' can get expressed as `*__GI_abort'.
-+gdb_test "bt" "in \[^ \]*abort \\(.* in main \\(.*" "Backter after abort()"
++gdb_test "bt" "in \[^ \]*abort \\(.* in main \\(.*" "Backtrace after abort()"
+
+verbose -log "kb_found in bt after abort() = [expr [memory_v_pages_get] * $pagesize / 1024]"
--- ./gdb/testsuite/gdb.base/vla.c 1970-01-01 01:00:00.000000000 +0100
-+++ ./gdb/testsuite/gdb.base/vla.c 2008-10-29 21:32:14.000000000 +0100
++++ ./gdb/testsuite/gdb.base/vla.c 2008-11-06 20:51:03.000000000 +0100
@@ -0,0 +1,55 @@
+/* This testcase is part of GDB, the GNU debugger.
+
@@ -2034,7 +2201,7 @@
+ return 0;
+}
--- ./gdb/testsuite/gdb.base/vla.exp 1970-01-01 01:00:00.000000000 +0100
-+++ ./gdb/testsuite/gdb.base/vla.exp 2008-10-29 21:32:14.000000000 +0100
++++ ./gdb/testsuite/gdb.base/vla.exp 2008-11-06 20:51:03.000000000 +0100
@@ -0,0 +1,62 @@
+# Copyright 2008 Free Software Foundation, Inc.
+
@@ -2098,8 +2265,135 @@
+gdb_test "p temp1" " = '1' <repeats 78 times>" "second: print temp1"
+gdb_test "p temp2" " = '2' <repeats 78 times>" "second: print temp2"
+gdb_test "p temp3" " = '3' <repeats 48 times>" "second: print temp3"
+--- ./gdb/testsuite/gdb.dwarf2/dw2-stripped.c 1970-01-01 01:00:00.000000000 +0100
++++ ./gdb/testsuite/gdb.dwarf2/dw2-stripped.c 2008-11-06 20:51:35.000000000 +0100
+@@ -0,0 +1,42 @@
++/* This testcase is part of GDB, the GNU debugger.
++
++ Copyright 2004 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 2 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, write to the Free Software
++ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
++ USA. */
++
++
++/* The function `func1' traced into must have debug info on offset > 0;
++ (DW_UNSND (attr)). This is the reason of `func0' existence. */
++
++void
++func0(int a, int b)
++{
++}
++
++/* `func1' being traced into must have some arguments to dump. */
++
++void
++func1(int a, int b)
++{
++ func0 (a,b);
++}
++
++int
++main(void)
++{
++ func1 (1, 2);
++ return 0;
++}
+--- ./gdb/testsuite/gdb.dwarf2/dw2-stripped.exp 1970-01-01 01:00:00.000000000 +0100
++++ ./gdb/testsuite/gdb.dwarf2/dw2-stripped.exp 2008-11-06 20:51:35.000000000 +0100
+@@ -0,0 +1,79 @@
++# Copyright 2006 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 2 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, write to the Free Software
++# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++
++# Minimal DWARF-2 unit test
++
++# This test can only be run on targets which support DWARF-2.
++# For now pick a sampling of likely targets.
++if {![istarget *-*-linux*]
++ && ![istarget *-*-gnu*]
++ && ![istarget *-*-elf*]
++ && ![istarget *-*-openbsd*]
++ && ![istarget arm-*-eabi*]
++ && ![istarget powerpc-*-eabi*]} {
++ return 0
++}
++
++set testfile "dw2-stripped"
++set srcfile ${testfile}.c
++set binfile ${objdir}/${subdir}/${testfile}.x
++
++remote_exec build "rm -f ${binfile}"
++
++# get the value of gcc_compiled
++if [get_compiler_info ${binfile}] {
++ return -1
++}
++
++# This test can only be run on gcc as we use additional_flags=FIXME
++if {$gcc_compiled == 0} {
++ return 0
++}
++
++if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-ggdb3}] != "" } {
++ return -1
++}
++
++remote_exec build "objcopy -R .debug_loc ${binfile}"
++set strip_output [remote_exec build "objdump -h ${binfile}"]
++
++set test "stripping test file preservation"
++if [ regexp ".debug_info " $strip_output] {
++ pass "$test (.debug_info preserved)"
++} else {
++ fail "$test (.debug_info got also stripped)"
++}
++
++set test "stripping test file functionality"
++if [ regexp ".debug_loc " $strip_output] {
++ fail "$test (.debug_loc still present)"
++} else {
++ pass "$test (.debug_loc stripped)"
++}
++
++gdb_exit
++gdb_start
++gdb_reinitialize_dir $srcdir/$subdir
++gdb_load ${binfile}
++
++# For C programs, "start" should stop in main().
++
++gdb_test "start" \
++ ".*main \\(\\) at .*" \
++ "start"
++gdb_test "step" \
++ "func.* \\(.*\\) at .*" \
++ "step"
--- ./gdb/testsuite/gdb.fortran/dynamic.exp 1970-01-01 01:00:00.000000000 +0100
-+++ ./gdb/testsuite/gdb.fortran/dynamic.exp 2008-10-29 21:32:14.000000000 +0100
++++ ./gdb/testsuite/gdb.fortran/dynamic.exp 2008-11-06 20:51:03.000000000 +0100
@@ -0,0 +1,141 @@
+# Copyright 2007 Free Software Foundation, Inc.
+
@@ -2243,7 +2537,7 @@
+# maps to foo::vary(1,3)
+gdb_test "p vart(2,9)" "\\$\[0-9\]* = 10"
--- ./gdb/testsuite/gdb.fortran/dynamic.f90 1970-01-01 01:00:00.000000000 +0100
-+++ ./gdb/testsuite/gdb.fortran/dynamic.f90 2008-10-29 21:32:14.000000000 +0100
++++ ./gdb/testsuite/gdb.fortran/dynamic.f90 2008-11-06 20:51:03.000000000 +0100
@@ -0,0 +1,97 @@
+! Copyright 2007 Free Software Foundation, Inc.
+!
@@ -2343,7 +2637,7 @@
+ if (x (3, 1) .ne. 10) call abort
+end
--- ./gdb/testsuite/gdb.fortran/string.exp 1970-01-01 01:00:00.000000000 +0100
-+++ ./gdb/testsuite/gdb.fortran/string.exp 2008-10-29 21:32:14.000000000 +0100
++++ ./gdb/testsuite/gdb.fortran/string.exp 2008-11-06 20:51:03.000000000 +0100
@@ -0,0 +1,59 @@
+# Copyright 2008 Free Software Foundation, Inc.
+
@@ -2405,7 +2699,7 @@
+gdb_test "p e" "\\$\[0-9\]* = 'e '" "p e re-set"
+gdb_test "p f" "\\$\[0-9\]* = \\(\\( 'f ', 'f ', 'f ', 'f ', 'f ', 'f ', 'f '\\) \\( 'f2 ', 'f ', 'f ', 'f ', 'f ', 'f ', 'f '\\) \\( 'f ', 'f ', 'f ', 'f ', 'f ', 'f ', 'f '\\) \\)" "p *f re-set"
--- ./gdb/testsuite/gdb.fortran/string.f90 1970-01-01 01:00:00.000000000 +0100
-+++ ./gdb/testsuite/gdb.fortran/string.f90 2008-10-29 21:32:14.000000000 +0100
++++ ./gdb/testsuite/gdb.fortran/string.f90 2008-11-06 20:51:03.000000000 +0100
@@ -0,0 +1,37 @@
+! Copyright 2008 Free Software Foundation, Inc.
+!
@@ -2444,8 +2738,8 @@
+ h = 'h'
+ call foo (g, h)
+end
---- ./gdb/typeprint.c 2008-10-29 10:50:23.000000000 +0100
-+++ ./gdb/typeprint.c 2008-10-29 21:32:46.000000000 +0100
+--- ./gdb/typeprint.c 2008-11-06 20:50:14.000000000 +0100
++++ ./gdb/typeprint.c 2008-11-06 20:51:35.000000000 +0100
@@ -33,6 +33,7 @@
#include "cp-abi.h"
#include "typeprint.h"
@@ -2464,8 +2758,43 @@
LA_PRINT_TYPE (type, varstring, stream, show, 0);
}
---- ./gdb/valarith.c 2008-02-04 01:23:04.000000000 +0100
-+++ ./gdb/valarith.c 2008-11-01 20:17:00.000000000 +0100
+@@ -113,7 +117,8 @@ whatis_exp (char *exp, int show)
+ {
+ struct expression *expr;
+ struct value *val;
+- struct cleanup *old_chain = NULL;
++ /* Required at least for the object_address_set call. */
++ struct cleanup *old_chain = make_cleanup (null_cleanup, NULL);
+ struct type *real_type = NULL;
+ struct type *type;
+ int full = 0;
+@@ -123,12 +128,13 @@ whatis_exp (char *exp, int show)
+ if (exp)
+ {
+ expr = parse_expression (exp);
+- old_chain = make_cleanup (free_current_contents, &expr);
++ make_cleanup (free_current_contents, &expr);
+ val = evaluate_type (expr);
+ }
+ else
+ val = access_value_history (0);
+
++ object_address_set (VALUE_ADDRESS (val));
+ type = value_type (val);
+
+ if (objectprint)
+@@ -164,8 +170,7 @@ whatis_exp (char *exp, int show)
+ type_print (type, "", gdb_stdout, show);
+ printf_filtered ("\n");
+
+- if (exp)
+- do_cleanups (old_chain);
++ do_cleanups (old_chain);
+ }
+
+ static void
+--- ./gdb/valarith.c 2008-11-06 20:50:14.000000000 +0100
++++ ./gdb/valarith.c 2008-11-06 20:51:03.000000000 +0100
@@ -39,7 +39,6 @@
#define TRUNCATION_TOWARDS_ZERO ((-5 / 2) == -2)
#endif
@@ -2601,8 +2930,8 @@
return v;
}
---- ./gdb/valops.c 2008-10-29 20:56:57.000000000 +0100
-+++ ./gdb/valops.c 2008-10-29 21:57:54.000000000 +0100
+--- ./gdb/valops.c 2008-11-06 20:50:14.000000000 +0100
++++ ./gdb/valops.c 2008-11-06 20:51:35.000000000 +0100
@@ -37,6 +37,7 @@
#include "dictionary.h"
#include "cp-support.h"
@@ -2611,10 +2940,12 @@
#include <errno.h>
#include "gdb_string.h"
-@@ -504,6 +505,46 @@ value_one (struct type *type, enum lval_
+@@ -504,6 +505,49 @@ value_one (struct type *type, enum lval_
return val;
}
++/* object_address_set must be already called before this function. */
++
+const char *
+object_address_data_not_valid (struct type *type)
+{
@@ -2632,8 +2963,8 @@
+
+/* Return non-zero if the variable is valid. If it is valid the function
+ may store the data address (DW_AT_DATA_LOCATION) of TYPE at *ADDRESS_RETURN.
-+ You should set *ADDRESS_RETURN as VALUE_ADDRESS (VAL) before calling this
-+ function as if no DW_AT_DATA_LOCATION is present for TYPE the address at
++ You must set *ADDRESS_RETURN as VALUE_ADDRESS (VAL) before calling this
++ function. If no DW_AT_DATA_LOCATION is present for TYPE the address at
+ *ADDRESS_RETURN is left unchanged. ADDRESS_RETURN must not be NULL, use
+ object_address_data_not_valid () for just the data validity check. */
+
@@ -2642,6 +2973,7 @@
+{
+ gdb_assert (address_return != NULL);
+
++ object_address_set (*address_return);
+ if (object_address_data_not_valid (type) != NULL)
+ {
+ /* Do not try to evaluate DW_AT_data_location as it may even crash
@@ -2658,7 +2990,7 @@
/* Return a value with type TYPE located at ADDR.
Call value_at only if the data needs to be fetched immediately;
-@@ -570,12 +611,21 @@ value_at_lazy (struct type *type, CORE_A
+@@ -570,12 +614,21 @@ value_at_lazy (struct type *type, CORE_A
int
value_fetch_lazy (struct value *val)
{
@@ -2685,7 +3017,7 @@
set_value_lazy (val, 0);
return 0;
-@@ -887,12 +937,17 @@ struct value *
+@@ -887,12 +940,17 @@ struct value *
value_coerce_array (struct value *arg1)
{
struct type *type = check_typedef (value_type (arg1));
@@ -2704,8 +3036,8 @@
}
/* Given a value which is a function, return a value which is a pointer
---- ./gdb/value.h 2008-02-04 01:23:04.000000000 +0100
-+++ ./gdb/value.h 2008-11-01 20:16:57.000000000 +0100
+--- ./gdb/value.h 2008-11-06 20:50:14.000000000 +0100
++++ ./gdb/value.h 2008-11-06 20:51:03.000000000 +0100
@@ -284,6 +284,10 @@ extern struct value *value_from_decfloat
const gdb_byte *decbytes);
extern struct value *value_from_string (char *string);
gdb-6.8-inlining.patch:
Index: gdb-6.8-inlining.patch
===================================================================
RCS file: /cvs/pkgs/rpms/gdb/devel/gdb-6.8-inlining.patch,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- gdb-6.8-inlining.patch 3 Nov 2008 03:34:39 -0000 1.3
+++ gdb-6.8-inlining.patch 6 Nov 2008 20:52:35 -0000 1.4
@@ -624,7 +624,7 @@
#include "elf/dwarf2.h"
#include "dwarf2expr.h"
-@@ -145,14 +146,19 @@ dwarf_expr_frame_base (void *baton, gdb_
+@@ -145,7 +146,10 @@ dwarf_expr_frame_base (void *baton, gdb_
struct symbol *framefunc;
struct dwarf_expr_baton *debaton = (struct dwarf_expr_baton *) baton;
@@ -636,16 +636,6 @@
/* If we found a frame-relative symbol then it was certainly within
some function associated with a frame. If we can't find the frame,
- something has gone wrong. */
- gdb_assert (framefunc != NULL);
-
-- if (SYMBOL_OPS (framefunc) == &dwarf2_loclist_funcs)
-+ if (SYMBOL_LOCATION_BATON (framefunc) == NULL)
-+ *start = NULL;
-+ else if (SYMBOL_OPS (framefunc) == &dwarf2_loclist_funcs)
- {
- struct dwarf2_loclist_baton *symbaton;
- struct frame_info *frame = debaton->frame;
Index: gdb-6.8/gdb/dwarf2read.c
===================================================================
--- gdb-6.8.orig/gdb/dwarf2read.c 2008-07-14 10:28:30.000000000 +0200
gdb-6.8-upstream.patch:
Index: gdb-6.8-upstream.patch
===================================================================
RCS file: /cvs/pkgs/rpms/gdb/devel/gdb-6.8-upstream.patch,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- gdb-6.8-upstream.patch 4 Nov 2008 05:51:22 -0000 1.8
+++ gdb-6.8-upstream.patch 6 Nov 2008 20:52:35 -0000 1.9
@@ -1716,3 +1716,1128 @@
b->loc->cond = parse_exp_1 (&s, b->exp_valid_block, 0);
}
}
+
+
+
+https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=196439
+http://sourceware.org/ml/gdb-patches/2008-04/msg00628.html
+http://sourceware.org/ml/gdb-cvs/2008-05/msg00051.html
+
+Testcase:
+gdb-6.5-bz196439-valgrind-memcheck-compat-test.patch
+
+2008-05-04 Jan Kratochvil <jan.kratochvil at redhat.com>
+
+ * dwarf2loc.c (dwarf_expr_frame_base): Error out on missing
+ SYMBOL_LOCATION_BATON.
+
+===================================================================
+RCS file: /cvs/src/src/gdb/dwarf2loc.c,v
+retrieving revision 1.50
+retrieving revision 1.51
+diff -u -r1.50 -r1.51
+--- src/gdb/dwarf2loc.c 2008/03/26 14:53:28 1.50
++++ src/gdb/dwarf2loc.c 2008/05/04 12:44:16 1.51
+@@ -166,8 +166,13 @@
+ {
+ struct dwarf2_locexpr_baton *symbaton;
+ symbaton = SYMBOL_LOCATION_BATON (framefunc);
+- *length = symbaton->size;
+- *start = symbaton->data;
++ if (symbaton != NULL)
++ {
++ *length = symbaton->size;
++ *start = symbaton->data;
++ }
++ else
++ *start = NULL;
+ }
+
+ if (*start == NULL)
+
+
+
+http://sourceware.org/ml/gdb-patches/2008-04/msg00508.html
+http://sourceware.org/ml/gdb-cvs/2008-05/msg00017.html
+
+Test applicable from:
+gdb-6.8-watchpoint-conditionals-test.patch
+
+gdb/
+2008-05-02 Andreas Schwab <schwab at suse.de>
+
+ * target.h (struct target_ops): Add
+ to_watchpoint_addr_within_range.
+ (target_watchpoint_addr_within_range): New function.
+ * target.c (update_current_target): Inherit
+ to_watchpoint_addr_within_range, defaulting to
+ default_watchpoint_addr_within_range.
+ (default_watchpoint_addr_within_range): New function.
+ (debug_to_watchpoint_addr_within_range): New function.
+ (setup_target_debug): Set to_watchpoint_addr_within_range.
+ * ppc-linux-nat.c (ppc_linux_watchpoint_addr_within_range):
+ New function.
+ (_initialize_ppc_linux_nat): Set to_watchpoint_addr_within_range.
+ * breakpoint.c (watchpoints_triggered): Use
+ target_watchpoint_addr_within_range.
+
+gdb/doc/
+2008-05-02 Andreas Schwab <schwab at suse.de>
+
+ * gdbint.texinfo (Algorithms): Describe
+ target_watchpoint_addr_within_range.
+
+===================================================================
+RCS file: /cvs/src/src/gdb/target.h,v
+retrieving revision 1.117
+retrieving revision 1.118
+diff -u -r1.117 -r1.118
+--- src/gdb/target.h 2008/05/01 19:31:51 1.117
++++ src/gdb/target.h 2008/05/02 11:07:25 1.118
+@@ -367,6 +367,8 @@
+ int to_have_steppable_watchpoint;
+ int to_have_continuable_watchpoint;
+ int (*to_stopped_data_address) (struct target_ops *, CORE_ADDR *);
++ int (*to_watchpoint_addr_within_range) (struct target_ops *,
++ CORE_ADDR, CORE_ADDR, int);
+ int (*to_region_ok_for_hw_watchpoint) (CORE_ADDR, int);
+ void (*to_terminal_init) (void);
+ void (*to_terminal_inferior) (void);
+@@ -1093,6 +1095,9 @@
+ #define target_stopped_data_address_p(CURRENT_TARGET) (1)
+ #endif
+
++#define target_watchpoint_addr_within_range(target, addr, start, length) \
++ (*target.to_watchpoint_addr_within_range) (target, addr, start, length)
++
+ extern const struct target_desc *target_read_description (struct target_ops *);
+
+ /* Command logging facility. */
+===================================================================
+RCS file: /cvs/src/src/gdb/target.c,v
+retrieving revision 1.160
+retrieving revision 1.161
+diff -u -r1.160 -r1.161
+--- src/gdb/target.c 2008/04/24 10:21:44 1.160
++++ src/gdb/target.c 2008/05/02 11:07:25 1.161
+@@ -49,6 +49,9 @@
+
+ static void default_terminal_info (char *, int);
+
++static int default_watchpoint_addr_within_range (struct target_ops *,
++ CORE_ADDR, CORE_ADDR, int);
++
+ static int default_region_ok_for_hw_watchpoint (CORE_ADDR, int);
+
+ static int nosymbol (char *, CORE_ADDR *);
+@@ -131,6 +134,9 @@
+
+ static int debug_to_stopped_data_address (struct target_ops *, CORE_ADDR *);
+
++static int debug_to_watchpoint_addr_within_range (struct target_ops *,
++ CORE_ADDR, CORE_ADDR, int);
++
+ static int debug_to_region_ok_for_hw_watchpoint (CORE_ADDR, int);
+
+ static void debug_to_terminal_init (void);
+@@ -416,9 +422,10 @@
+ INHERIT (to_insert_watchpoint, t);
+ INHERIT (to_remove_watchpoint, t);
+ INHERIT (to_stopped_data_address, t);
+- INHERIT (to_stopped_by_watchpoint, t);
+ INHERIT (to_have_steppable_watchpoint, t);
+ INHERIT (to_have_continuable_watchpoint, t);
++ INHERIT (to_stopped_by_watchpoint, t);
++ INHERIT (to_watchpoint_addr_within_range, t);
+ INHERIT (to_region_ok_for_hw_watchpoint, t);
+ INHERIT (to_terminal_init, t);
+ INHERIT (to_terminal_inferior, t);
+@@ -544,6 +551,8 @@
+ de_fault (to_stopped_data_address,
+ (int (*) (struct target_ops *, CORE_ADDR *))
+ return_zero);
++ de_fault (to_watchpoint_addr_within_range,
++ default_watchpoint_addr_within_range);
+ de_fault (to_region_ok_for_hw_watchpoint,
+ default_region_ok_for_hw_watchpoint);
+ de_fault (to_terminal_init,
+@@ -1881,6 +1890,14 @@
+ }
+
+ static int
++default_watchpoint_addr_within_range (struct target_ops *target,
++ CORE_ADDR addr,
++ CORE_ADDR start, int length)
++{
++ return addr >= start && addr < start + length;
++}
++
++static int
+ return_zero (void)
+ {
+ return 0;
+@@ -2448,6 +2465,23 @@
+ }
+
+ static int
++debug_to_watchpoint_addr_within_range (struct target_ops *target,
++ CORE_ADDR addr,
++ CORE_ADDR start, int length)
++{
++ int retval;
++
++ retval = debug_target.to_watchpoint_addr_within_range (target, addr,
++ start, length);
++
++ fprintf_filtered (gdb_stdlog,
++ "target_watchpoint_addr_within_range (0x%lx, 0x%lx, %d) = %d\n",
++ (unsigned long) addr, (unsigned long) start, length,
++ retval);
++ return retval;
++}
++
++static int
+ debug_to_insert_hw_breakpoint (struct bp_target_info *bp_tgt)
+ {
+ int retval;
+@@ -2790,6 +2824,7 @@
+ current_target.to_remove_watchpoint = debug_to_remove_watchpoint;
+ current_target.to_stopped_by_watchpoint = debug_to_stopped_by_watchpoint;
+ current_target.to_stopped_data_address = debug_to_stopped_data_address;
++ current_target.to_watchpoint_addr_within_range = debug_to_watchpoint_addr_within_range;
+ current_target.to_region_ok_for_hw_watchpoint = debug_to_region_ok_for_hw_watchpoint;
+ current_target.to_terminal_init = debug_to_terminal_init;
+ current_target.to_terminal_inferior = debug_to_terminal_inferior;
+===================================================================
+RCS file: /cvs/src/src/gdb/ppc-linux-nat.c,v
+retrieving revision 1.78
+retrieving revision 1.79
+diff -u -r1.78 -r1.79
+--- src/gdb/ppc-linux-nat.c 2008/01/16 04:48:55 1.78
++++ src/gdb/ppc-linux-nat.c 2008/05/02 11:07:25 1.79
+@@ -889,6 +889,16 @@
+ return ppc_linux_stopped_data_address (¤t_target, &addr);
+ }
+
++static int
++ppc_linux_watchpoint_addr_within_range (struct target_ops *target,
++ CORE_ADDR addr,
++ CORE_ADDR start, int length)
++{
++ addr &= ~7;
++ /* Check whether [start, start+length-1] intersects [addr, addr+7]. */
++ return start <= addr + 7 && start + length - 1 >= addr;
++}
++
+ static void
+ ppc_linux_store_inferior_registers (struct regcache *regcache, int regno)
+ {
+@@ -997,6 +1007,7 @@
+ t->to_remove_watchpoint = ppc_linux_remove_watchpoint;
+ t->to_stopped_by_watchpoint = ppc_linux_stopped_by_watchpoint;
+ t->to_stopped_data_address = ppc_linux_stopped_data_address;
++ t->to_watchpoint_addr_within_range = ppc_linux_watchpoint_addr_within_range;
+
+ t->to_read_description = ppc_linux_read_description;
+
+===================================================================
+RCS file: /cvs/src/src/gdb/breakpoint.c,v
+retrieving revision 1.317
+retrieving revision 1.318
+diff -u -r1.317 -r1.318
+--- src/gdb/breakpoint.c 2008/05/01 20:35:33 1.317
++++ src/gdb/breakpoint.c 2008/05/02 11:07:25 1.318
+@@ -2616,8 +2616,9 @@
+ for (loc = b->loc; loc; loc = loc->next)
+ /* Exact match not required. Within range is
+ sufficient. */
+- if (addr >= loc->address
+- && addr < loc->address + loc->length)
++ if (target_watchpoint_addr_within_range (¤t_target,
++ addr, loc->address,
++ loc->length))
+ {
+ b->watchpoint_triggered = watch_triggered_yes;
+ break;
+===================================================================
+RCS file: /cvs/src/src/gdb/doc/gdbint.texinfo,v
+retrieving revision 1.282
+retrieving revision 1.283
+diff -u -r1.282 -r1.283
+--- src/gdb/doc/gdbint.texinfo 2008/04/30 21:16:46 1.282
++++ src/gdb/doc/gdbint.texinfo 2008/05/02 11:07:25 1.283
+@@ -9,7 +9,7 @@
+ @ifinfo
+ This file documents the internals of the GNU debugger @value{GDBN}.
+ Copyright (C) 1990, 1991, 1992, 1993, 1994, 1996, 1998, 1999, 2000, 2001,
+- 2002, 2003, 2004, 2005, 2006
++ 2002, 2003, 2004, 2005, 2006, 2008
+ Free Software Foundation, Inc.
+ Contributed by Cygnus Solutions. Written by John Gilmore.
+ Second Edition by Stan Shebs.
+@@ -711,10 +711,19 @@
+ resuming, this method should clear it. For instance, the x86 debug
+ control register has sticky triggered flags.
+
++ at findex target_watchpoint_addr_within_range
++ at item target_watchpoint_addr_within_range (@var{target}, @var{addr}, @var{start}, @var{length})
++Check whether @var{addr} (as returned by @code{target_stopped_data_address})
++lies within the hardware-defined watchpoint region described by
++ at var{start} and @var{length}. This only needs to be provided if the
++granularity of a watchpoint is greater than one byte, i.e., if the
++watchpoint can also trigger on nearby addresses outside of the watched
++region.
++
+ @findex HAVE_STEPPABLE_WATCHPOINT
+ @item HAVE_STEPPABLE_WATCHPOINT
+ If defined to a non-zero value, it is not necessary to disable a
+-watchpoint to step over it. Like @code{gdbarch_have_nonsteppable_watchpoint},
++watchpoint to step over it. Like @code{gdbarch_have_nonsteppable_watchpoint},
+ this is usually set when watchpoints trigger at the instruction
+ which will perform an interesting read or write. It should be
+ set if there is a temporary disable bit which allows the processor
+
+
+
+[RFA] Try2: Ignore breakpoints when reading memory.
+http://sourceware.org/ml/gdb-patches/2008-03/msg00106.html
+http://sourceware.org/ml/gdb-cvs/2008-03/msg00058.html
+
+2008-03-13 Vladimir Prus <vladimir at codesourcery.com>
+ Daniel Jacobowitz <dan at codesourcery.com>
+
+ * breakpoint.h (breakpoint_restore_shadows): New
+ declaration.
+ * breakpoint.c (breakpoint_restore_shadows): New.
+ (read_memory_nobpt): Delete.
+ * gdbcore.h (read_memory_nobpt): Delete declaration.
+ * target.c (memory_xfer_partial): Call
+ breakpoint_restore_shadows.
+ (restore_show_memory_breakpoints)
+ (make_show_memory_beakpoints_cleanup): New.
+ (show_memory_breakpoints): New.
+ * target.h (make_show_memory_beakpoints_cleanup): Declare.
+ * ppc-linux-tdep.c (ppc_linux_memory_remove_breakpoint):
+ Make sure we see memory breakpoints when checking if
+ breakpoint is still there.
+ * alpha-tdep.c, alphanbsd-tdep.c, frame.c, frv-tdep.c,
+ hppa-linux-tdep.c, hppa-tdep.c, i386-linux-nat.c, i386-tdep.c,
+ m68klinux-tdep.c, mips-tdep.c, mn10300-tdep.c, s390-tdep.c,
+ sparc-tdep.c: Use target_read_memory instead of read_memory_nobpt.
+
+===================================================================
+RCS file: /cvs/src/src/gdb/Makefile.in,v
+retrieving revision 1.988
+retrieving revision 1.989
+diff -u -r1.988 -r1.989
+--- src/gdb/Makefile.in 2008/03/10 23:14:05 1.988
++++ src/gdb/Makefile.in 2008/03/13 12:22:08 1.989
+@@ -2873,7 +2873,7 @@
+ target.o: target.c $(defs_h) $(gdb_string_h) $(target_h) $(gdbcmd_h) \
+ $(symtab_h) $(inferior_h) $(bfd_h) $(symfile_h) $(objfiles_h) \
+ $(gdb_wait_h) $(dcache_h) $(regcache_h) $(gdb_assert_h) $(gdbcore_h) \
+- $(exceptions_h) $(target_descriptions_h)
++ $(exceptions_h) $(target_descriptions_h) $(gdb_stdint_h)
+ target-descriptions.o: target-descriptions.c $(defs_h) $(arch_utils_h) \
+ $(target_h) $(target_descriptions_h) $(vec_h) $(xml_tdesc_h) \
+ $(gdbcmd_h) $(gdb_assert_h) $(gdbtypes_h) $(reggroups_h) \
+===================================================================
+RCS file: /cvs/src/src/gdb/alpha-tdep.c,v
+retrieving revision 1.182
+retrieving revision 1.183
+diff -u -r1.182 -r1.183
+--- src/gdb/alpha-tdep.c 2008/02/20 15:45:20 1.182
++++ src/gdb/alpha-tdep.c 2008/03/13 12:22:11 1.183
+@@ -638,7 +638,7 @@
+ gdb_byte buf[ALPHA_INSN_SIZE];
+ int status;
+
+- status = read_memory_nobpt (pc, buf, sizeof (buf));
++ status = target_read_memory (pc, buf, sizeof (buf));
+ if (status)
+ memory_error (status, pc);
+ return extract_unsigned_integer (buf, sizeof (buf));
+===================================================================
+RCS file: /cvs/src/src/gdb/alphanbsd-tdep.c,v
+retrieving revision 1.36
+retrieving revision 1.37
+diff -u -r1.36 -r1.37
+--- src/gdb/alphanbsd-tdep.c 2008/01/01 22:53:09 1.36
++++ src/gdb/alphanbsd-tdep.c 2008/03/13 12:22:11 1.37
+@@ -216,7 +216,7 @@
+ LONGEST off;
+ int i;
+
+- if (read_memory_nobpt (pc, (char *) w, 4) != 0)
++ if (target_read_memory (pc, (char *) w, 4) != 0)
+ return -1;
+
+ for (i = 0; i < RETCODE_NWORDS; i++)
+@@ -230,7 +230,7 @@
+ off = i * 4;
+ pc -= off;
+
+- if (read_memory_nobpt (pc, (char *) ret, sizeof (ret)) != 0)
++ if (target_read_memory (pc, (char *) ret, sizeof (ret)) != 0)
+ return -1;
+
+ if (memcmp (ret, sigtramp_retcode, RETCODE_SIZE) == 0)
+===================================================================
+RCS file: /cvs/src/src/gdb/breakpoint.c,v
+retrieving revision 1.305
+retrieving revision 1.306
+diff -u -r1.305 -r1.306
+--- src/gdb/breakpoint.c 2008/03/03 13:24:12 1.305
++++ src/gdb/breakpoint.c 2008/03/13 12:22:11 1.306
+@@ -702,25 +702,16 @@
+ error (_("No breakpoint number %d."), bnum);
+ }
+
+-/* Like target_read_memory() but if breakpoints are inserted, return
+- the shadow contents instead of the breakpoints themselves.
++/* Update BUF, which is LEN bytes read from the target address MEMADDR,
++ by replacing any memory breakpoints with their shadowed contents. */
+
+- Read "memory data" from whatever target or inferior we have.
+- Returns zero if successful, errno value if not. EIO is used
+- for address out of bounds. If breakpoints are inserted, returns
+- shadow contents, not the breakpoints themselves. From breakpoint.c. */
+-
+-int
+-read_memory_nobpt (CORE_ADDR memaddr, gdb_byte *myaddr, unsigned len)
++void
++breakpoint_restore_shadows (gdb_byte *buf, ULONGEST memaddr, LONGEST len)
+ {
+- int status;
+- const struct bp_location *b;
++ struct bp_location *b;
+ CORE_ADDR bp_addr = 0;
+ int bp_size = 0;
+-
+- if (gdbarch_breakpoint_from_pc (current_gdbarch, &bp_addr, &bp_size) == NULL)
+- /* No breakpoints on this machine. */
+- return target_read_memory (memaddr, myaddr, len);
++ int bptoffset = 0;
+
+ ALL_BP_LOCATIONS (b)
+ {
+@@ -739,59 +730,35 @@
+ if (bp_size == 0)
+ /* bp isn't valid, or doesn't shadow memory. */
+ continue;
++
+ if (bp_addr + bp_size <= memaddr)
+ /* The breakpoint is entirely before the chunk of memory we
+ are reading. */
+ continue;
++
+ if (bp_addr >= memaddr + len)
+ /* The breakpoint is entirely after the chunk of memory we are
+ reading. */
+ continue;
+- /* Copy the breakpoint from the shadow contents, and recurse for
+- the things before and after. */
+- {
+- /* Offset within shadow_contents. */
+- int bptoffset = 0;
+-
+- if (bp_addr < memaddr)
+- {
+- /* Only copy the second part of the breakpoint. */
+- bp_size -= memaddr - bp_addr;
+- bptoffset = memaddr - bp_addr;
+- bp_addr = memaddr;
+- }
+-
+- if (bp_addr + bp_size > memaddr + len)
+- {
+- /* Only copy the first part of the breakpoint. */
+- bp_size -= (bp_addr + bp_size) - (memaddr + len);
+- }
+
+- memcpy (myaddr + bp_addr - memaddr,
+- b->target_info.shadow_contents + bptoffset, bp_size);
++ /* Offset within shadow_contents. */
++ if (bp_addr < memaddr)
++ {
++ /* Only copy the second part of the breakpoint. */
++ bp_size -= memaddr - bp_addr;
++ bptoffset = memaddr - bp_addr;
++ bp_addr = memaddr;
++ }
+
+- if (bp_addr > memaddr)
+- {
+- /* Copy the section of memory before the breakpoint. */
+- status = read_memory_nobpt (memaddr, myaddr, bp_addr - memaddr);
+- if (status != 0)
+- return status;
+- }
++ if (bp_addr + bp_size > memaddr + len)
++ {
++ /* Only copy the first part of the breakpoint. */
++ bp_size -= (bp_addr + bp_size) - (memaddr + len);
++ }
+
+- if (bp_addr + bp_size < memaddr + len)
+- {
+- /* Copy the section of memory after the breakpoint. */
+- status = read_memory_nobpt (bp_addr + bp_size,
+- myaddr + bp_addr + bp_size - memaddr,
+- memaddr + len - (bp_addr + bp_size));
+- if (status != 0)
+- return status;
+- }
+- return 0;
+- }
++ memcpy (buf + bp_addr - memaddr,
++ b->target_info.shadow_contents + bptoffset, bp_size);
+ }
+- /* Nothing overlaps. Just call read_memory_noerr. */
+- return target_read_memory (memaddr, myaddr, len);
+ }
+
+
+@@ -4299,7 +4266,7 @@
+ /* Adjust the breakpoint's address prior to allocating a location.
+ Once we call allocate_bp_location(), that mostly uninitialized
+ location will be placed on the location chain. Adjustment of the
+- breakpoint may cause read_memory_nobpt() to be called and we do
++ breakpoint may cause target_read_memory() to be called and we do
+ not want its scan of the location chain to find a breakpoint and
+ location that's only been partially initialized. */
+ adjusted_address = adjust_breakpoint_address (sal.pc, bptype);
+===================================================================
+RCS file: /cvs/src/src/gdb/breakpoint.h,v
+retrieving revision 1.66
+retrieving revision 1.67
+diff -u -r1.66 -r1.67
+--- src/gdb/breakpoint.h 2008/03/03 13:24:12 1.66
++++ src/gdb/breakpoint.h 2008/03/13 12:22:12 1.67
+@@ -859,4 +859,9 @@
+ target. */
+ int watchpoints_triggered (struct target_waitstatus *);
+
++/* Update BUF, which is LEN bytes read from the target address MEMADDR,
++ by replacing any memory breakpoints with their shadowed contents. */
++void breakpoint_restore_shadows (gdb_byte *buf, ULONGEST memaddr,
++ LONGEST len);
++
+ #endif /* !defined (BREAKPOINT_H) */
+===================================================================
+RCS file: /cvs/src/src/gdb/frame.c,v
+retrieving revision 1.237
+retrieving revision 1.238
+diff -u -r1.237 -r1.238
+--- src/gdb/frame.c 2008/02/28 16:24:24 1.237
++++ src/gdb/frame.c 2008/03/13 12:22:12 1.238
+@@ -1691,8 +1691,8 @@
+ safe_frame_unwind_memory (struct frame_info *this_frame,
+ CORE_ADDR addr, gdb_byte *buf, int len)
+ {
+- /* NOTE: read_memory_nobpt returns zero on success! */
+- return !read_memory_nobpt (addr, buf, len);
++ /* NOTE: target_read_memory returns zero on success! */
++ return !target_read_memory (addr, buf, len);
+ }
+
+ /* Architecture method. */
+===================================================================
+RCS file: /cvs/src/src/gdb/frv-tdep.c,v
+retrieving revision 1.118
+retrieving revision 1.119
+diff -u -r1.118 -r1.119
+--- src/gdb/frv-tdep.c 2008/01/11 13:19:59 1.118
++++ src/gdb/frv-tdep.c 2008/03/13 12:22:12 1.119
+@@ -449,7 +449,7 @@
+ char instr[frv_instr_size];
+ int status;
+
+- status = read_memory_nobpt (addr, instr, sizeof instr);
++ status = target_read_memory (addr, instr, sizeof instr);
+
+ if (status != 0)
+ break;
+===================================================================
+RCS file: /cvs/src/src/gdb/gdbcore.h,v
+retrieving revision 1.28
+retrieving revision 1.29
+diff -u -r1.28 -r1.29
+--- src/gdb/gdbcore.h 2008/01/01 22:53:10 1.28
++++ src/gdb/gdbcore.h 2008/03/13 12:22:12 1.29
+@@ -39,18 +39,6 @@
+
+ extern int have_core_file_p (void);
+
+-/* Read "memory data" from whatever target or inferior we have.
+- Returns zero if successful, errno value if not. EIO is used for
+- address out of bounds. If breakpoints are inserted, returns shadow
+- contents, not the breakpoints themselves. From breakpoint.c. */
+-
+-/* NOTE: cagney/2004-06-10: Code reading from a live inferior can use
+- the get_frame_memory methods, code reading from an exec can use the
+- target methods. */
+-
+-extern int read_memory_nobpt (CORE_ADDR memaddr, gdb_byte *myaddr,
+- unsigned len);
+-
+ /* Report a memory error with error(). */
+
+ extern void memory_error (int status, CORE_ADDR memaddr);
+===================================================================
+RCS file: /cvs/src/src/gdb/hppa-linux-tdep.c,v
+retrieving revision 1.27
+retrieving revision 1.28
+diff -u -r1.27 -r1.28
+--- src/gdb/hppa-linux-tdep.c 2008/02/18 16:11:21 1.27
++++ src/gdb/hppa-linux-tdep.c 2008/03/13 12:22:12 1.28
+@@ -101,7 +101,7 @@
+ {
+ char buf[4];
+
+- read_memory_nobpt (npc, buf, 4);
++ target_read_memory (npc, buf, 4);
+ insn[i] = extract_unsigned_integer (buf, 4);
+ if ((insn[i] & pattern[i].mask) == pattern[i].data)
+ npc += 4;
+===================================================================
+RCS file: /cvs/src/src/gdb/hppa-tdep.c,v
+retrieving revision 1.247
+retrieving revision 1.248
+diff -u -r1.247 -r1.248
+--- src/gdb/hppa-tdep.c 2008/02/18 16:11:21 1.247
++++ src/gdb/hppa-tdep.c 2008/03/13 12:22:12 1.248
+@@ -545,7 +545,7 @@
+ char buf[4];
+ int off;
+
+- status = read_memory_nobpt (pc, buf, 4);
++ status = target_read_memory (pc, buf, 4);
+ if (status != 0)
+ return 0;
+
+@@ -1552,7 +1552,7 @@
+ old_save_sp = save_sp;
+ old_stack_remaining = stack_remaining;
+
+- status = read_memory_nobpt (pc, buf, 4);
++ status = target_read_memory (pc, buf, 4);
+ inst = extract_unsigned_integer (buf, 4);
+
+ /* Yow! */
+@@ -1603,7 +1603,7 @@
+ && reg_num <= 26)
+ {
+ pc += 4;
+- status = read_memory_nobpt (pc, buf, 4);
++ status = target_read_memory (pc, buf, 4);
+ inst = extract_unsigned_integer (buf, 4);
+ if (status != 0)
+ return pc;
+@@ -1616,7 +1616,7 @@
+ reg_num = inst_saves_fr (inst);
+ save_fr &= ~(1 << reg_num);
+
+- status = read_memory_nobpt (pc + 4, buf, 4);
++ status = target_read_memory (pc + 4, buf, 4);
+ next_inst = extract_unsigned_integer (buf, 4);
+
+ /* Yow! */
+@@ -1647,13 +1647,13 @@
+ <= (gdbarch_ptr_bit (gdbarch) == 64 ? 11 : 7))
+ {
+ pc += 8;
+- status = read_memory_nobpt (pc, buf, 4);
++ status = target_read_memory (pc, buf, 4);
+ inst = extract_unsigned_integer (buf, 4);
+ if (status != 0)
+ return pc;
+ if ((inst & 0xfc000000) != 0x34000000)
+ break;
+- status = read_memory_nobpt (pc + 4, buf, 4);
++ status = target_read_memory (pc + 4, buf, 4);
+ next_inst = extract_unsigned_integer (buf, 4);
+ if (status != 0)
+ return pc;
+@@ -2857,7 +2857,7 @@
+ {
+ gdb_byte buf[HPPA_INSN_SIZE];
+
+- read_memory_nobpt (npc, buf, HPPA_INSN_SIZE);
++ target_read_memory (npc, buf, HPPA_INSN_SIZE);
+ insn[i] = extract_unsigned_integer (buf, HPPA_INSN_SIZE);
+ if ((insn[i] & pattern[i].mask) == pattern[i].data)
+ npc += 4;
+===================================================================
+RCS file: /cvs/src/src/gdb/i386-linux-nat.c,v
+retrieving revision 1.86
+retrieving revision 1.87
+diff -u -r1.86 -r1.87
+--- src/gdb/i386-linux-nat.c 2008/03/01 04:39:36 1.86
++++ src/gdb/i386-linux-nat.c 2008/03/13 12:22:13 1.87
+@@ -770,7 +770,7 @@
+ that's about to be restored, and set the trace flag there. */
+
+ /* First check if PC is at a system call. */
+- if (read_memory_nobpt (pc, buf, LINUX_SYSCALL_LEN) == 0
++ if (target_read_memory (pc, buf, LINUX_SYSCALL_LEN) == 0
+ && memcmp (buf, linux_syscall, LINUX_SYSCALL_LEN) == 0)
+ {
+ ULONGEST syscall;
+===================================================================
+RCS file: /cvs/src/src/gdb/i386-tdep.c,v
+retrieving revision 1.251
+retrieving revision 1.252
+diff -u -r1.251 -r1.252
+--- src/gdb/i386-tdep.c 2008/03/11 05:21:38 1.251
++++ src/gdb/i386-tdep.c 2008/03/13 12:22:13 1.252
+@@ -344,7 +344,7 @@
+ long delta = 0;
+ int data16 = 0;
+
+- read_memory_nobpt (pc, &op, 1);
++ target_read_memory (pc, &op, 1);
+ if (op == 0x66)
+ {
+ data16 = 1;
+@@ -410,12 +410,12 @@
+ if (current_pc <= pc)
+ return pc;
+
+- read_memory_nobpt (pc, &op, 1);
++ target_read_memory (pc, &op, 1);
+
+ if (op != 0x58) /* popl %eax */
+ return pc;
+
+- read_memory_nobpt (pc + 1, buf, 4);
++ target_read_memory (pc + 1, buf, 4);
+ if (memcmp (buf, proto1, 3) != 0 && memcmp (buf, proto2, 4) != 0)
+ return pc;
+
+@@ -454,7 +454,7 @@
+ gdb_byte buf[8];
+ gdb_byte op;
+
+- read_memory_nobpt (pc, &op, 1);
++ target_read_memory (pc, &op, 1);
+
+ if (op == 0x68 || op == 0x6a)
+ {
+@@ -541,7 +541,7 @@
+ struct i386_insn *insn;
+ gdb_byte op;
+
+- read_memory_nobpt (pc, &op, 1);
++ target_read_memory (pc, &op, 1);
+
+ for (insn = skip_insns; insn->len > 0; insn++)
+ {
+@@ -554,7 +554,7 @@
+ gdb_assert (insn->len > 1);
+ gdb_assert (insn->len <= I386_MAX_INSN_LEN);
+
+- read_memory_nobpt (pc + 1, buf, insn->len - 1);
++ target_read_memory (pc + 1, buf, insn->len - 1);
+ for (i = 1; i < insn->len; i++)
+ {
+ if ((buf[i - 1] & insn->mask[i]) != insn->insn[i])
+@@ -632,7 +632,7 @@
+ gdb_byte op;
+ int check = 1;
+
+- read_memory_nobpt (pc, &op, 1);
++ target_read_memory (pc, &op, 1);
+
+ while (check)
+ {
+@@ -641,7 +641,7 @@
+ if (op == 0x90)
+ {
+ pc += 1;
+- read_memory_nobpt (pc, &op, 1);
++ target_read_memory (pc, &op, 1);
+ check = 1;
+ }
+ /* Ignore no-op instruction `mov %edi, %edi'.
+@@ -657,11 +657,11 @@
+
+ else if (op == 0x8b)
+ {
+- read_memory_nobpt (pc + 1, &op, 1);
++ target_read_memory (pc + 1, &op, 1);
+ if (op == 0xff)
+ {
+ pc += 2;
+- read_memory_nobpt (pc, &op, 1);
++ target_read_memory (pc, &op, 1);
+ check = 1;
+ }
+ }
+@@ -685,7 +685,7 @@
+ if (limit <= pc)
+ return limit;
+
+- read_memory_nobpt (pc, &op, 1);
++ target_read_memory (pc, &op, 1);
+
+ if (op == 0x55) /* pushl %ebp */
+ {
+@@ -720,7 +720,7 @@
+ if (limit <= pc + skip)
+ return limit;
+
+- read_memory_nobpt (pc + skip, &op, 1);
++ target_read_memory (pc + skip, &op, 1);
+
+ /* Check for `movl %esp, %ebp' -- can be written in two ways. */
+ switch (op)
+@@ -754,7 +754,7 @@
+
+ NOTE: You can't subtract a 16-bit immediate from a 32-bit
+ reg, so we don't have to worry about a data16 prefix. */
+- read_memory_nobpt (pc, &op, 1);
++ target_read_memory (pc, &op, 1);
+ if (op == 0x83)
+ {
+ /* `subl' with 8-bit immediate. */
+@@ -810,7 +810,7 @@
+ offset -= cache->locals;
+ for (i = 0; i < 8 && pc < current_pc; i++)
+ {
+- read_memory_nobpt (pc, &op, 1);
++ target_read_memory (pc, &op, 1);
+ if (op < 0x50 || op > 0x57)
+ break;
+
+@@ -900,7 +900,7 @@
+
+ for (i = 0; i < 6; i++)
+ {
+- read_memory_nobpt (pc + i, &op, 1);
++ target_read_memory (pc + i, &op, 1);
+ if (pic_pat[i] != op)
+ break;
+ }
+@@ -908,7 +908,7 @@
+ {
+ int delta = 6;
+
+- read_memory_nobpt (pc + delta, &op, 1);
++ target_read_memory (pc + delta, &op, 1);
+
+ if (op == 0x89) /* movl %ebx, x(%ebp) */
+ {
+@@ -921,7 +921,7 @@
+ else /* Unexpected instruction. */
+ delta = 0;
+
+- read_memory_nobpt (pc + delta, &op, 1);
++ target_read_memory (pc + delta, &op, 1);
+ }
+
+ /* addl y,%ebx */
+===================================================================
+RCS file: /cvs/src/src/gdb/m68klinux-tdep.c,v
+retrieving revision 1.27
+retrieving revision 1.28
+diff -u -r1.27 -r1.28
+--- src/gdb/m68klinux-tdep.c 2008/01/01 22:53:12 1.27
++++ src/gdb/m68klinux-tdep.c 2008/03/13 12:22:13 1.28
+@@ -69,7 +69,7 @@
+ char buf[12];
+ unsigned long insn0, insn1, insn2;
+
+- if (read_memory_nobpt (pc - 4, buf, sizeof (buf)))
++ if (target_read_memory (pc - 4, buf, sizeof (buf)))
+ return 0;
+ insn1 = extract_unsigned_integer (buf + 4, 4);
+ insn2 = extract_unsigned_integer (buf + 8, 4);
+===================================================================
+RCS file: /cvs/src/src/gdb/mips-tdep.c,v
+retrieving revision 1.469
+retrieving revision 1.470
+diff -u -r1.469 -r1.470
+--- src/gdb/mips-tdep.c 2008/02/20 14:34:43 1.469
++++ src/gdb/mips-tdep.c 2008/03/13 12:22:13 1.470
+@@ -926,7 +926,7 @@
+ }
+ else
+ instlen = MIPS_INSN32_SIZE;
+- status = read_memory_nobpt (addr, buf, instlen);
++ status = target_read_memory (addr, buf, instlen);
+ if (status)
+ memory_error (status, addr);
+ return extract_unsigned_integer (buf, instlen);
+===================================================================
+RCS file: /cvs/src/src/gdb/mn10300-tdep.c,v
+retrieving revision 1.154
+retrieving revision 1.155
+diff -u -r1.154 -r1.155
+--- src/gdb/mn10300-tdep.c 2008/02/05 16:20:20 1.154
++++ src/gdb/mn10300-tdep.c 2008/03/13 12:22:13 1.155
+@@ -620,7 +620,7 @@
+ goto finish_prologue;
+
+ /* Get the next two bytes so the prologue scan can continue. */
+- status = read_memory_nobpt (addr, buf, 2);
++ status = target_read_memory (addr, buf, 2);
+ if (status != 0)
+ goto finish_prologue;
+ }
+@@ -761,7 +761,7 @@
+ if (!fmov_found)
+ {
+ addr = restore_addr;
+- status = read_memory_nobpt (addr, buf, 2);
++ status = target_read_memory (addr, buf, 2);
+ if (status != 0)
+ goto finish_prologue;
+ stack_extra_size = 0;
+===================================================================
+RCS file: /cvs/src/src/gdb/ppc-linux-tdep.c,v
+retrieving revision 1.94
+retrieving revision 1.95
+diff -u -r1.94 -r1.95
+--- src/gdb/ppc-linux-tdep.c 2008/02/20 14:31:40 1.94
++++ src/gdb/ppc-linux-tdep.c 2008/03/13 12:22:13 1.95
+@@ -281,12 +281,15 @@
+ int val;
+ int bplen;
+ gdb_byte old_contents[BREAKPOINT_MAX];
++ struct cleanup *cleanup;
+
+ /* Determine appropriate breakpoint contents and size for this address. */
+ bp = gdbarch_breakpoint_from_pc (gdbarch, &addr, &bplen);
+ if (bp == NULL)
+ error (_("Software breakpoints not implemented for this target."));
+
++ /* Make sure we see the memory breakpoints. */
++ cleanup = make_show_memory_breakpoints_cleanup (1);
+ val = target_read_memory (addr, old_contents, bplen);
+
+ /* If our breakpoint is no longer at the address, this means that the
+@@ -295,6 +298,7 @@
+ if (val == 0 && memcmp (bp, old_contents, bplen) == 0)
+ val = target_write_memory (addr, bp_tgt->shadow_contents, bplen);
+
++ do_cleanups (cleanup);
+ return val;
+ }
+
+===================================================================
+RCS file: /cvs/src/src/gdb/s390-tdep.c,v
+retrieving revision 1.170
+retrieving revision 1.171
+diff -u -r1.170 -r1.171
+--- src/gdb/s390-tdep.c 2008/01/31 15:43:32 1.170
++++ src/gdb/s390-tdep.c 2008/03/13 12:22:13 1.171
+@@ -503,12 +503,12 @@
+ static int s390_instrlen[] = { 2, 4, 4, 6 };
+ int instrlen;
+
+- if (read_memory_nobpt (at, &instr[0], 2))
++ if (target_read_memory (at, &instr[0], 2))
+ return -1;
+ instrlen = s390_instrlen[instr[0] >> 6];
+ if (instrlen > 2)
+ {
+- if (read_memory_nobpt (at + 2, &instr[2], instrlen - 2))
++ if (target_read_memory (at + 2, &instr[2], instrlen - 2))
+ return -1;
+ }
+ return instrlen;
+@@ -1132,19 +1132,19 @@
+ int d2;
+
+ if (word_size == 4
+- && !read_memory_nobpt (pc - 4, insn, 4)
++ && !target_read_memory (pc - 4, insn, 4)
+ && is_rs (insn, op_lm, &r1, &r3, &d2, &b2)
+ && r3 == S390_SP_REGNUM - S390_R0_REGNUM)
+ return 1;
+
+ if (word_size == 4
+- && !read_memory_nobpt (pc - 6, insn, 6)
++ && !target_read_memory (pc - 6, insn, 6)
+ && is_rsy (insn, op1_lmy, op2_lmy, &r1, &r3, &d2, &b2)
+ && r3 == S390_SP_REGNUM - S390_R0_REGNUM)
+ return 1;
+
+ if (word_size == 8
+- && !read_memory_nobpt (pc - 6, insn, 6)
++ && !target_read_memory (pc - 6, insn, 6)
+ && is_rsy (insn, op1_lmg, op2_lmg, &r1, &r3, &d2, &b2)
+ && r3 == S390_SP_REGNUM - S390_R0_REGNUM)
+ return 1;
+@@ -1658,7 +1658,7 @@
+ CORE_ADDR pc = frame_pc_unwind (next_frame);
+ bfd_byte sigreturn[2];
+
+- if (read_memory_nobpt (pc, sigreturn, 2))
++ if (target_read_memory (pc, sigreturn, 2))
+ return NULL;
+
+ if (sigreturn[0] != 0x0a /* svc */)
+===================================================================
+RCS file: /cvs/src/src/gdb/sparc-tdep.c,v
+retrieving revision 1.193
+retrieving revision 1.194
+diff -u -r1.193 -r1.194
+--- src/gdb/sparc-tdep.c 2008/01/11 14:43:15 1.193
++++ src/gdb/sparc-tdep.c 2008/03/13 12:22:13 1.194
+@@ -99,7 +99,7 @@
+ int i;
+
+ /* If we can't read the instruction at PC, return zero. */
+- if (read_memory_nobpt (pc, buf, sizeof (buf)))
++ if (target_read_memory (pc, buf, sizeof (buf)))
+ return 0;
+
+ insn = 0;
+===================================================================
+RCS file: /cvs/src/src/gdb/target.c,v
+retrieving revision 1.155
+retrieving revision 1.156
+diff -u -r1.155 -r1.156
+--- src/gdb/target.c 2008/02/28 16:26:17 1.155
++++ src/gdb/target.c 2008/03/13 12:22:13 1.156
+@@ -39,6 +39,7 @@
+ #include "gdbcore.h"
+ #include "exceptions.h"
+ #include "target-descriptions.h"
++#include "gdb_stdint.h"
+
+ static void target_info (char *, int);
+
+@@ -203,6 +204,11 @@
+
+ static int trust_readonly = 0;
+
++/* Nonzero if we should show true memory content including
++ memory breakpoint inserted by gdb. */
++
++static int show_memory_breakpoints = 0;
++
+ /* Non-zero if we want to see trace of target level stuff. */
+
+ static int targetdebug = 0;
+@@ -1064,7 +1070,11 @@
+ if (res <= 0)
+ return -1;
+ else
+- return res;
++ {
++ if (readbuf && !show_memory_breakpoints)
++ breakpoint_restore_shadows (readbuf, memaddr, reg_len);
++ return res;
++ }
+ }
+
+ /* If none of those methods found the memory we wanted, fall back
+@@ -1082,22 +1092,41 @@
+ res = ops->to_xfer_partial (ops, TARGET_OBJECT_MEMORY, NULL,
+ readbuf, writebuf, memaddr, reg_len);
+ if (res > 0)
+- return res;
++ break;
+
+ /* We want to continue past core files to executables, but not
+ past a running target's memory. */
+ if (ops->to_has_all_memory)
+- return res;
++ break;
+
+ ops = ops->beneath;
+ }
+ while (ops != NULL);
+
++ if (readbuf && !show_memory_breakpoints)
++ breakpoint_restore_shadows (readbuf, memaddr, reg_len);
++
+ /* If we still haven't got anything, return the last error. We
+ give up. */
+ return res;
+ }
+
++static void
++restore_show_memory_breakpoints (void *arg)
++{
++ show_memory_breakpoints = (uintptr_t) arg;
++}
++
++struct cleanup *
++make_show_memory_breakpoints_cleanup (int show)
++{
++ int current = show_memory_breakpoints;
++ show_memory_breakpoints = show;
++
++ return make_cleanup (restore_show_memory_breakpoints,
++ (void *) (uintptr_t) current);
++}
++
+ static LONGEST
+ target_xfer_partial (struct target_ops *ops,
+ enum target_object object, const char *annex,
+===================================================================
+RCS file: /cvs/src/src/gdb/target.h,v
+retrieving revision 1.111
+retrieving revision 1.112
+diff -u -r1.111 -r1.112
+--- src/gdb/target.h 2008/02/28 16:26:17 1.111
++++ src/gdb/target.h 2008/03/13 12:22:14 1.112
+@@ -1250,6 +1250,11 @@
+
+ /* Any target can call this to switch to remote protocol (in remote.c). */
+ extern void push_remote_target (char *name, int from_tty);
++
++/* Set the show memory breakpoints mode to show, and installs a cleanup
++ to restore it back to the current value. */
++extern struct cleanup *make_show_memory_breakpoints_cleanup (int show);
++
+
+ /* Imported from machine dependent code */
+
+
+
+
+[commit] SIGILL in ld.so when running program from GDB on ia64-linux
+http://sourceware.org/ml/gdb-patches/2008-04/msg00674.html
+http://sourceware.org/ml/gdb-cvs/2008-04/msg00173.html
+
+2008-04-29 Joel Brobecker <brobecker at adacore.com>
+
+ * ia64-tdep.c (ia64_memory_remove_breakpoint): Set
+ show_memory_breakpoints to 1 while reading the instruction bundle.
+
+===================================================================
+RCS file: /cvs/src/src/gdb/ia64-tdep.c,v
+retrieving revision 1.174
+retrieving revision 1.175
+diff -u -r1.174 -r1.175
+--- src/gdb/ia64-tdep.c 2008/04/22 11:03:41 1.174
++++ src/gdb/ia64-tdep.c 2008/04/29 21:14:06 1.175
+@@ -598,9 +598,15 @@
+ long long instr;
+ int val;
+ int template;
++ struct cleanup *cleanup;
+
+ addr &= ~0x0f;
+
++ /* Disable the automatic memory restoration from breakpoints while
++ we read our instruction bundle. Otherwise, the general restoration
++ mechanism kicks in and ends up corrupting our bundle, because it
++ is not aware of the concept of instruction bundles. */
++ cleanup = make_show_memory_breakpoints_cleanup (1);
+ val = target_read_memory (addr, bundle, BUNDLE_LEN);
+
+ /* Check for L type instruction in 2nd slot, if present then
+@@ -616,6 +622,7 @@
+ if (val == 0)
+ target_write_memory (addr, bundle, BUNDLE_LEN);
+
++ do_cleanups (cleanup);
+ return val;
+ }
+
Index: gdb.spec
===================================================================
RCS file: /cvs/pkgs/rpms/gdb/devel/gdb.spec,v
retrieving revision 1.307
retrieving revision 1.308
diff -u -r1.307 -r1.308
--- gdb.spec 4 Nov 2008 05:51:22 -0000 1.307
+++ gdb.spec 6 Nov 2008 20:52:36 -0000 1.308
@@ -192,9 +192,6 @@
# ia32el.
Patch179: gdb-6.3-ia32el-fix-waitpid-20060615.patch
-# Testcase for corrupted or missing location list information (BZ 196439).
-Patch187: gdb-6.5-bz196439-valgrind-memcheck-compat-test.patch
-
# Fix debuginfo addresses resolving for --emit-relocs Linux kernels (BZ 203661).
Patch188: gdb-6.5-bz203661-emit-relocs.patch
@@ -342,8 +339,8 @@
# Fix/implement the Fortran dynamic arrays support (BZ 377541).
# Fix the variable-length-arrays support (BZ 468266, feature BZ 377541).
-Patch339: gdb-6.8-bz377541-vla-bound-undefined.patch
-Patch340: gdb-6.8-bz377541-vla-loc-kind.patch
+Patch345: gdb-6.8-bz377541-vla-bound-undefined.patch
+Patch346: gdb-6.8-bz377541-vla-loc-kind.patch
Patch305: gdb-6.8-bz377541-vla.patch
# Backport fix of a segfault + PIE regression since 6.7.1 on PIE executables.
@@ -419,8 +416,11 @@
# Fix occasional crash on a removed watchpoint.
Patch338: gdb-6.8-breakpoint-gone.patch
+# Fix occasional stepping lockup on many threads, seen on ia64.
+Patch342: gdb-6.8-ia64-breakpoint-restoration.patch
+
# Test the watchpoints conditionals works.
-Patch343: gdb-6.8-watchpoint-cond-test.patch
+Patch343: gdb-6.8-watchpoint-conditionals-test.patch
BuildRequires: ncurses-devel glibc-devel gcc make gzip texinfo dejagnu gettext
BuildRequires: flex bison sharutils expat-devel
@@ -545,7 +545,6 @@
%patch177 -p1
%patch178 -p1
%patch179 -p1
-%patch187 -p1
%patch188 -p1
%patch190 -p1
%patch194 -p1
@@ -595,8 +594,8 @@
%patch298 -p1
%patch301 -p1
%patch304 -p1
-%patch339 -p1
-%patch340 -p1
+%patch345 -p1
+%patch346 -p1
%patch305 -p1
%patch306 -p1
%patch309 -p1
@@ -624,6 +623,7 @@
%patch336 -p1
%patch337 -p1
%patch338 -p1
+%patch342 -p1
%patch343 -p1
%patch124 -p1
@@ -889,7 +889,10 @@
%changelog
* Tue Nov 4 2008 Jan Kratochvil <jan.kratochvil at redhat.com> - 6.8-26
+- Fix more the variable-length-arrays support (BZ 468266, feature BZ 377541).
- Fix the watchpoints conditionals.
+- Fix on PPC spurious SIGTRAPs on active watchpoints.
+- Fix occasional stepping lockup on many threads, seen on ia64.
* Mon Nov 3 2008 Jan Kratochvil <jan.kratochvil at redhat.com> - 6.8-25
- Fix the variable-length-arrays support (BZ 468266, feature BZ 377541).
--- gdb-6.5-bz196439-valgrind-memcheck-compat-test.patch DELETED ---
--- gdb-6.8-watchpoint-cond-test.patch DELETED ---
More information about the fedora-extras-commits
mailing list