Rebase to FSF GDB 7.7.91.20140721 (pre-7.8 snapshot).
- Rebase the Intel VLA patchset. - New fix of the optimized-out entry data values crash (BZ 1111910). - [testsuite] Fix paginate-*.exp race for "read1".
This commit is contained in:
parent
33d54d9950
commit
a972d47b4c
2
.gitignore
vendored
2
.gitignore
vendored
@ -1,2 +1,2 @@
|
|||||||
/gdb-libstdc++-v3-python-r155978.tar.bz2
|
/gdb-libstdc++-v3-python-r155978.tar.bz2
|
||||||
/gdb-7.7.90.20140711.tar.bz2
|
/gdb-7.7.91.20140721.tar.bz2
|
||||||
|
194
gdb-entryval-crash-1of3.patch
Normal file
194
gdb-entryval-crash-1of3.patch
Normal file
@ -0,0 +1,194 @@
|
|||||||
|
http://sourceware.org/ml/gdb-patches/2014-07/msg00530.html
|
||||||
|
Subject: [read_frame_arg patch] Handle partially optimized out values similarly to unavailable values (Re: [patchv2] Fix crash on optimized-out entry data values)
|
||||||
|
|
||||||
|
|
||||||
|
--V88s5gaDVPzZ0KCq
|
||||||
|
Content-Type: text/plain; charset=us-ascii
|
||||||
|
Content-Disposition: inline
|
||||||
|
|
||||||
|
On Thu, 17 Jul 2014 14:23:06 +0200, Pedro Alves wrote:
|
||||||
|
> On 07/16/2014 10:58 PM, Jan Kratochvil wrote:
|
||||||
|
> > This patch is apparently not suitable for gdb-7.8 which is I guess often
|
||||||
|
> > crashing on -O2 -g entry values so there could be some rather minimal crash
|
||||||
|
> > avoiding patch instead.
|
||||||
|
>
|
||||||
|
> Yeah.
|
||||||
|
>
|
||||||
|
> So this was originally "caused" (more exposed) by 4f14910f:
|
||||||
|
>
|
||||||
|
> gdb/ChangeLog
|
||||||
|
> 2013-11-26 Andrew Burgess <aburgess@broadcom.com>
|
||||||
|
>
|
||||||
|
> * value.c (allocate_optimized_out_value): Mark value as non-lazy.
|
||||||
|
>
|
||||||
|
> I tried a few approaches in value_available_contents_eq
|
||||||
|
> today, and ended up thinking that the simplest should be to
|
||||||
|
> just revert that patch until we have the fuller fix in place.
|
||||||
|
|
||||||
|
OK, that seems as the best solution for 7.8 to me.
|
||||||
|
|
||||||
|
|
||||||
|
> While doing just that fixes the crash, it surprisingly causes
|
||||||
|
> one of your new tests to FAIL:
|
||||||
|
>
|
||||||
|
> (gdb) frame
|
||||||
|
> #0 bar (ref=ref@entry=@0x7fffffffd184: 10) at gdb.arch/amd64-entry-value-paramref.cc:23
|
||||||
|
> 23 vv++; /* break-here */
|
||||||
|
> (gdb) FAIL: gdb.arch/amd64-entry-value-paramref.exp: frame
|
||||||
|
|
||||||
|
There is a bug in that entry value code of mine, fix attached.
|
||||||
|
The testcase then PASSes with the reverted optimization by Andrew Burgess.
|
||||||
|
|
||||||
|
For the attached fix - if you nitpick the missing conditional case:
|
||||||
|
value_optimized_out (val_deref) && value_optimized_out (entryval_deref)
|
||||||
|
It is not detected there but that IMO does not matter much as
|
||||||
|
* It is for 7.8 only, for trunk it will get compared correctly thanks to the
|
||||||
|
new implementation of value_available_contents_eq()
|
||||||
|
called value_contents_eq().
|
||||||
|
* If the conditional
|
||||||
|
if (val != val_deref
|
||||||
|
&& !value_optimized_out (val_deref)
|
||||||
|
&& !value_optimized_out (entryval_deref)
|
||||||
|
&& value_available_contents_eq (val_deref, 0,
|
||||||
|
entryval_deref, 0,
|
||||||
|
TYPE_LENGTH (type_deref)))
|
||||||
|
val_equal = 1;
|
||||||
|
fails it may just print
|
||||||
|
bar (ref=@0x7fffffffd904: <optimized out>, ref@entry=@0x7fffffffd904: <optimized out>)
|
||||||
|
(or some variant with some partially optimized-out/unavailable parts)
|
||||||
|
instead of the more correct
|
||||||
|
bar (ref=ref@entry=@0x7fffffffd904: <optimized out>)
|
||||||
|
which is not much a bug.
|
||||||
|
|
||||||
|
The attached fix no longe makes sense after the new implementation
|
||||||
|
of value_available_contents_eq() called value_contents_eq() gets applied as it
|
||||||
|
handles all the optimized-out/unavailable values on its own, therefore the
|
||||||
|
attached patch is really only for 7.8.
|
||||||
|
|
||||||
|
|
||||||
|
> Turns out it's the code disabled in value_of_dwarf_reg_entry:
|
||||||
|
>
|
||||||
|
> target_val = dwarf_entry_parameter_to_value (parameter,
|
||||||
|
> TYPE_LENGTH (target_type),
|
||||||
|
> target_type, caller_frame,
|
||||||
|
> caller_per_cu);
|
||||||
|
>
|
||||||
|
> /* value_as_address dereferences TYPE_CODE_REF. */
|
||||||
|
> addr = extract_typed_address (value_contents (outer_val), checked_type);
|
||||||
|
>
|
||||||
|
> /* The target entry value has artificial address of the entry value
|
||||||
|
> reference. */
|
||||||
|
> VALUE_LVAL (target_val) = lval_memory;
|
||||||
|
> set_value_address (target_val, addr);
|
||||||
|
>
|
||||||
|
> It looks quite wrong to me to just change a value's lval like that.
|
||||||
|
>
|
||||||
|
> I ran the testsuite with that code disabled (like in the patch below),
|
||||||
|
> and that caused no regressions. I can't say I really understand the
|
||||||
|
> intention here though. What would we be missing if we removed that code?
|
||||||
|
|
||||||
|
I cannot reproduce any wrong case having the code above #if 0-ed.
|
||||||
|
|
||||||
|
I just do not find it correct to have it disabled. But at the same time I do
|
||||||
|
like much / I do not find correct the code myself. It is a bit problematic to
|
||||||
|
have struct value describing a memory content which is no longer present
|
||||||
|
there.
|
||||||
|
|
||||||
|
What happens there:
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
volatile int vv;
|
||||||
|
static __attribute__((noinline)) int
|
||||||
|
bar (int &ref) {
|
||||||
|
ref = 20;
|
||||||
|
vv++; /* break-here */
|
||||||
|
return ref;
|
||||||
|
}
|
||||||
|
int main (void) {
|
||||||
|
int var = 10;
|
||||||
|
return bar (var);
|
||||||
|
}
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
<4><c7>: Abbrev Number: 13 (DW_TAG_GNU_call_site_parameter)
|
||||||
|
<c8> DW_AT_location : 1 byte block: 55 (DW_OP_reg5 (rdi))
|
||||||
|
<ca> DW_AT_GNU_call_site_value: 2 byte block: 91 74 (DW_OP_fbreg: -12)
|
||||||
|
<cd> DW_AT_GNU_call_site_data_value: 1 byte block: 3a (DW_OP_lit10)
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
gdb -ex 'b value_addr' -ex r --args ../gdb ./1 -ex 'watch vv' -ex r -ex 'p &ref@entry'
|
||||||
|
->
|
||||||
|
6 return ref;
|
||||||
|
bar (ref=@0x7fffffffd944: 20, ref@entry=@0x7fffffffd944: 10) at 1.C:25
|
||||||
|
------------------------------------------------------------------------------
|
||||||
|
At /* break-here */ struct value variable 'ref' is TYPE_CODE_REF.
|
||||||
|
|
||||||
|
With FSF GDB HEAD:
|
||||||
|
(gdb) x/gx arg1.contents
|
||||||
|
0x6004000a4ad0: 0x00007fffffffd944
|
||||||
|
(gdb) p ((struct value *)arg1.location.computed.closure).lval
|
||||||
|
$1 = lval_memory
|
||||||
|
(gdb) p/x ((struct value *)arg1.location.computed.closure).location.address
|
||||||
|
$3 = 0x7fffffffd944
|
||||||
|
|
||||||
|
With your #if0-ed code:
|
||||||
|
(gdb) x/gx arg1.contents
|
||||||
|
0x6004000a4ad0: 0x00007fffffffd944
|
||||||
|
(gdb) p ((struct value *)arg1.location.computed.closure).lval
|
||||||
|
$8 = not_lval
|
||||||
|
(gdb) p/x ((struct value *)arg1.location.computed.closure).location.address
|
||||||
|
$9 = 0x0
|
||||||
|
|
||||||
|
I do not see how to access
|
||||||
|
((struct value *)arg1.location.computed.closure).location.address
|
||||||
|
from GDB CLI. Trying
|
||||||
|
(gdb) p &ref@entry
|
||||||
|
will invoke value_addr()'s:
|
||||||
|
if (TYPE_CODE (type) == TYPE_CODE_REF)
|
||||||
|
/* Copy the value, but change the type from (T&) to (T*). We
|
||||||
|
keep the same location information, which is efficient, and
|
||||||
|
allows &(&X) to get the location containing the reference. */
|
||||||
|
and therefore the address gets fetched already from
|
||||||
|
arg1.contents
|
||||||
|
and not from
|
||||||
|
((struct value *)arg1.location.computed.closure).location.address
|
||||||
|
.
|
||||||
|
|
||||||
|
And for any other type than TYPE_CODE_REF this code you #if 0-ed does not get
|
||||||
|
executed at all. This DW_AT_GNU_call_site_data_value DWARF was meant
|
||||||
|
primarily for Fortran but with -O0 entry values do not get produced
|
||||||
|
and with -Og and higher Fortran always optimizes out the passing by reference.
|
||||||
|
|
||||||
|
If you do not like the #if 0 code there I am OK with removing it as I do not
|
||||||
|
know how to make it's use reproducible for user anyway. In the worst case
|
||||||
|
- if there really is some way how to exploit it - one should just get
|
||||||
|
Attempt to take address of value not located in memory.
|
||||||
|
instead of some wrong value and it may be easy to fix then.
|
||||||
|
|
||||||
|
|
||||||
|
Thanks for the analysis,
|
||||||
|
Jan
|
||||||
|
|
||||||
|
--V88s5gaDVPzZ0KCq
|
||||||
|
Content-Type: text/plain; charset=us-ascii
|
||||||
|
Content-Disposition: inline; filename=1
|
||||||
|
|
||||||
|
gdb/
|
||||||
|
2014-07-20 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||||
|
|
||||||
|
* stack.c (read_frame_arg): Verify value_optimized_out before calling
|
||||||
|
value_available_contents_eq.
|
||||||
|
|
||||||
|
diff --git a/gdb/stack.c b/gdb/stack.c
|
||||||
|
index 0d6d8e7..4db5df5 100644
|
||||||
|
--- a/gdb/stack.c
|
||||||
|
+++ b/gdb/stack.c
|
||||||
|
@@ -413,6 +413,8 @@ read_frame_arg (struct symbol *sym, struct frame_info *frame,
|
||||||
|
/* If the reference addresses match but dereferenced
|
||||||
|
content does not match print them. */
|
||||||
|
if (val != val_deref
|
||||||
|
+ && !value_optimized_out (val_deref)
|
||||||
|
+ && !value_optimized_out (entryval_deref)
|
||||||
|
&& value_available_contents_eq (val_deref, 0,
|
||||||
|
entryval_deref, 0,
|
||||||
|
TYPE_LENGTH (type_deref)))
|
||||||
|
|
||||||
|
--V88s5gaDVPzZ0KCq--
|
||||||
|
|
44
gdb-entryval-crash-2of3.patch
Normal file
44
gdb-entryval-crash-2of3.patch
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
revert:
|
||||||
|
commit 4f14910fa1331398cc695011a6af43a89252b4b1
|
||||||
|
Author: Andrew Burgess <aburgess@broadcom.com>
|
||||||
|
Date: Tue Nov 26 16:21:53 2013 +0000
|
||||||
|
|
||||||
|
Mark entirely optimized out value as non-lazy.
|
||||||
|
|
||||||
|
If a value is entirely optimized out, then there's nothing for
|
||||||
|
value_fetch_lazy to fetch. Sequences like:
|
||||||
|
|
||||||
|
if (value_lazy (retval))
|
||||||
|
value_fetch_lazy (retval);
|
||||||
|
|
||||||
|
End up allocating the value contents buffer, wasting memory, for no
|
||||||
|
use.
|
||||||
|
|
||||||
|
gdb/ChangeLog
|
||||||
|
2013-11-26 Andrew Burgess <aburgess@broadcom.com>
|
||||||
|
|
||||||
|
* value.c (allocate_optimized_out_value): Mark value as non-lazy.
|
||||||
|
|
||||||
|
### a/gdb/ChangeLog
|
||||||
|
### b/gdb/ChangeLog
|
||||||
|
## -1,3 +1,7 @@
|
||||||
|
+2013-11-26 Andrew Burgess <aburgess@broadcom.com>
|
||||||
|
+
|
||||||
|
+ * value.c (allocate_optimized_out_value): Mark value as non-lazy.
|
||||||
|
+
|
||||||
|
2013-11-26 Tom Tromey <tromey@redhat.com>
|
||||||
|
|
||||||
|
* dwarf2-frame.c (dwarf2_frame_cache): Revert patch from
|
||||||
|
diff --git a/gdb/value.c b/gdb/value.c
|
||||||
|
index 29abe5f..f073d71 100644
|
||||||
|
--- a/gdb/value.c
|
||||||
|
+++ b/gdb/value.c
|
||||||
|
@@ -906,7 +906,7 @@ allocate_optimized_out_value (struct type *type)
|
||||||
|
struct value *retval = allocate_value_lazy (type);
|
||||||
|
|
||||||
|
set_value_optimized_out (retval, 1);
|
||||||
|
- set_value_lazy (retval, 0);
|
||||||
|
+
|
||||||
|
return retval;
|
||||||
|
}
|
||||||
|
|
@ -65,6 +65,7 @@ Content-Disposition: inline; filename="optimfix3.patch"
|
|||||||
gdb/
|
gdb/
|
||||||
2014-07-09 Jan Kratochvil <jan.kratochvil@redhat.com>
|
2014-07-09 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||||
|
|
||||||
|
removed:
|
||||||
* value.c (struct value): Extend the comment for fields optimized_out
|
* value.c (struct value): Extend the comment for fields optimized_out
|
||||||
and unavailable.
|
and unavailable.
|
||||||
(value_available_contents_bits_eq): Handle OPTIMIZED_OUT values as
|
(value_available_contents_bits_eq): Handle OPTIMIZED_OUT values as
|
||||||
@ -80,52 +81,6 @@ gdb/testsuite/
|
|||||||
* gdb.arch/amd64-optimout-repeat.c: New file.
|
* gdb.arch/amd64-optimout-repeat.c: New file.
|
||||||
* gdb.arch/amd64-optimout-repeat.exp: New file.
|
* gdb.arch/amd64-optimout-repeat.exp: New file.
|
||||||
|
|
||||||
diff --git a/gdb/value.c b/gdb/value.c
|
|
||||||
index 557056f..c017c75 100644
|
|
||||||
--- a/gdb/value.c
|
|
||||||
+++ b/gdb/value.c
|
|
||||||
@@ -198,12 +198,14 @@ struct value
|
|
||||||
unsigned int lazy : 1;
|
|
||||||
|
|
||||||
/* If nonzero, this is the value of a variable that does not
|
|
||||||
- actually exist in the program. If nonzero, and LVAL is
|
|
||||||
+ actually exist in the program at all. If nonzero, and LVAL is
|
|
||||||
lval_register, this is a register ($pc, $sp, etc., never a
|
|
||||||
program variable) that has not been saved in the frame. All
|
|
||||||
optimized-out values are treated pretty much the same, except
|
|
||||||
registers have a different string representation and related
|
|
||||||
- error strings. */
|
|
||||||
+ error strings. When it is zero it still maybe only partially
|
|
||||||
+ available (equally partially optimized out) - see the
|
|
||||||
+ 'unavailable' field below. */
|
|
||||||
unsigned int optimized_out : 1;
|
|
||||||
|
|
||||||
/* If value is a variable, is it initialized or not. */
|
|
||||||
@@ -334,7 +336,9 @@ struct value
|
|
||||||
valid if lazy is nonzero. */
|
|
||||||
gdb_byte *contents;
|
|
||||||
|
|
||||||
- /* Unavailable ranges in CONTENTS. We mark unavailable ranges,
|
|
||||||
+ /* If OPTIMIZED_OUT is nonzero then UNAVAILABLE must be VEC_empty
|
|
||||||
+ (not necessarily NULL). Otherwise it specifies
|
|
||||||
+ unavailable ranges in CONTENTS. We mark unavailable ranges,
|
|
||||||
rather than available, since the common and default case is for a
|
|
||||||
value to be available. This is filled in at value read time. The
|
|
||||||
unavailable ranges are tracked in bits. */
|
|
||||||
@@ -701,6 +705,13 @@ value_available_contents_bits_eq (const struct value *val1, int offset1,
|
|
||||||
/* See function description in value.h. */
|
|
||||||
gdb_assert (!val1->lazy && !val2->lazy);
|
|
||||||
|
|
||||||
+ gdb_assert (!val1->optimized_out || VEC_empty (range_s, val1->unavailable));
|
|
||||||
+ gdb_assert (!val2->optimized_out || VEC_empty (range_s, val2->unavailable));
|
|
||||||
+ if (val1->optimized_out != val2->optimized_out)
|
|
||||||
+ return 0;
|
|
||||||
+ if (val1->optimized_out && val2->optimized_out)
|
|
||||||
+ return 1;
|
|
||||||
+
|
|
||||||
while (length > 0)
|
|
||||||
{
|
|
||||||
range_s *r1, *r2;
|
|
||||||
diff --git a/gdb/testsuite/gdb.arch/amd64-entry-value-paramref.S b/gdb/testsuite/gdb.arch/amd64-entry-value-paramref.S
|
diff --git a/gdb/testsuite/gdb.arch/amd64-entry-value-paramref.S b/gdb/testsuite/gdb.arch/amd64-entry-value-paramref.S
|
||||||
new file mode 100644
|
new file mode 100644
|
||||||
index 0000000..a1e9d0a
|
index 0000000..a1e9d0a
|
415
gdb-testsuite-pagination-read1.patch
Normal file
415
gdb-testsuite-pagination-read1.patch
Normal file
@ -0,0 +1,415 @@
|
|||||||
|
http://sourceware.org/ml/gdb-patches/2014-07/msg00553.html
|
||||||
|
Subject: [testsuite patch] Fix paginate-*.exp race for "read1"
|
||||||
|
|
||||||
|
|
||||||
|
--17pEHd4RhPHOinZp
|
||||||
|
Content-Type: text/plain; charset=us-ascii
|
||||||
|
Content-Disposition: inline
|
||||||
|
|
||||||
|
Hi Pedro,
|
||||||
|
|
||||||
|
these testcase have racy results:
|
||||||
|
gdb.base/double-prompt-target-event-error.exp
|
||||||
|
gdb.base/paginate-after-ctrl-c-running.exp
|
||||||
|
gdb.base/paginate-bg-execution.exp
|
||||||
|
gdb.base/paginate-execution-startup.exp
|
||||||
|
gdb.base/paginate-inferior-exit.exp
|
||||||
|
|
||||||
|
reproducible with "read1" from:
|
||||||
|
reproducer for races of expect incomplete reads
|
||||||
|
http://sourceware.org/bugzilla/show_bug.cgi?id=12649
|
||||||
|
|
||||||
|
# Prevent gdb_test_multiple considering an error -re "<return>" match.
|
||||||
|
# For unknown reason -notransfer -re "<return>" { exp_continue } does not
|
||||||
|
# prevent it.
|
||||||
|
|
||||||
|
Tested on Fedora 20 x86_64 and Fedora Rawhide x86_64 that -notransfer does not
|
||||||
|
work there:
|
||||||
|
expect-5.45-10.fc20.x86_64
|
||||||
|
expect-5.45-16.fc21.x86_64
|
||||||
|
|
||||||
|
Sure if someone gets -notransfer working this patch could be dropped.
|
||||||
|
|
||||||
|
|
||||||
|
Jan
|
||||||
|
|
||||||
|
--17pEHd4RhPHOinZp
|
||||||
|
Content-Type: text/plain; charset=us-ascii
|
||||||
|
Content-Disposition: inline; filename=1
|
||||||
|
|
||||||
|
gdb/testsuite/
|
||||||
|
2014-07-22 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||||
|
|
||||||
|
* gdb.base/double-prompt-target-event-error.exp: Use
|
||||||
|
gdb_test_pagination.
|
||||||
|
* gdb.base/paginate-after-ctrl-c-running.exp: Likewise.
|
||||||
|
* gdb.base/paginate-bg-execution.exp: Likewise.
|
||||||
|
* gdb.base/paginate-execution-startup.exp: Likewise.
|
||||||
|
* gdb.base/paginate-inferior-exit.exp: Likewise.
|
||||||
|
* lib/gdb.exp (pagination_prompt): Remove.
|
||||||
|
(gdb_test_pagination): New.
|
||||||
|
|
||||||
|
diff --git a/gdb/testsuite/gdb.base/double-prompt-target-event-error.exp b/gdb/testsuite/gdb.base/double-prompt-target-event-error.exp
|
||||||
|
index 5571cdf..803e256 100644
|
||||||
|
--- a/gdb/testsuite/gdb.base/double-prompt-target-event-error.exp
|
||||||
|
+++ b/gdb/testsuite/gdb.base/double-prompt-target-event-error.exp
|
||||||
|
@@ -28,7 +28,7 @@ if {[prepare_for_testing "failed to prepare" $testfile $srcfile debug] == -1} {
|
||||||
|
|
||||||
|
proc cancel_pagination_in_target_event { command } {
|
||||||
|
global binfile srcfile
|
||||||
|
- global gdb_prompt pagination_prompt
|
||||||
|
+ global gdb_prompt
|
||||||
|
|
||||||
|
set testline [gdb_get_line_number "after sleep"]
|
||||||
|
|
||||||
|
@@ -60,25 +60,23 @@ proc cancel_pagination_in_target_event { command } {
|
||||||
|
|
||||||
|
# Wait for pagination prompt after the "Continuing" line,
|
||||||
|
# indicating the program was running and then stopped.
|
||||||
|
+ global saw_continuing
|
||||||
|
set saw_continuing 0
|
||||||
|
set test "continue to pagination"
|
||||||
|
- gdb_test_multiple "$command" $test {
|
||||||
|
- -re "$pagination_prompt$" {
|
||||||
|
- if {$saw_continuing} {
|
||||||
|
- pass $test
|
||||||
|
- } else {
|
||||||
|
- send_gdb "\n"
|
||||||
|
- exp_continue
|
||||||
|
- }
|
||||||
|
+ gdb_test_pagination $command $test {
|
||||||
|
+ global saw_continuing
|
||||||
|
+ if {$saw_continuing} {
|
||||||
|
+ pass $test
|
||||||
|
+ } else {
|
||||||
|
+ send_gdb "\n"
|
||||||
|
+ exp_continue
|
||||||
|
}
|
||||||
|
+ } {
|
||||||
|
-re "Continuing" {
|
||||||
|
+ global saw_continuing
|
||||||
|
set saw_continuing 1
|
||||||
|
exp_continue
|
||||||
|
}
|
||||||
|
- -notransfer -re "<return>" {
|
||||||
|
- # Otherwise gdb_test_multiple considers this an error.
|
||||||
|
- exp_continue
|
||||||
|
- }
|
||||||
|
}
|
||||||
|
|
||||||
|
# We're now stopped in a pagination query while handling a
|
||||||
|
@@ -88,15 +86,20 @@ proc cancel_pagination_in_target_event { command } {
|
||||||
|
send_gdb "\003p 1\n"
|
||||||
|
|
||||||
|
set test "no double prompt"
|
||||||
|
- gdb_test_multiple "" $test {
|
||||||
|
- -re "$gdb_prompt.*$gdb_prompt.*$gdb_prompt $" {
|
||||||
|
- fail $test
|
||||||
|
- }
|
||||||
|
- -re "$gdb_prompt .* = 1\r\n$gdb_prompt $" {
|
||||||
|
+ global saw_prompt
|
||||||
|
+ set saw_prompt 0
|
||||||
|
+ gdb_test_pagination "" $test {
|
||||||
|
+ exp_continue
|
||||||
|
+ } {
|
||||||
|
+ -re " = 1\r\n$gdb_prompt $" {
|
||||||
|
pass $test
|
||||||
|
}
|
||||||
|
- -notransfer -re "<return>" {
|
||||||
|
- # Otherwise gdb_test_multiple considers this an error.
|
||||||
|
+ -re "\r\n$gdb_prompt " {
|
||||||
|
+ global saw_prompt
|
||||||
|
+ if { $saw_prompt != 0 } {
|
||||||
|
+ fail $test
|
||||||
|
+ }
|
||||||
|
+ set saw_prompt 1
|
||||||
|
exp_continue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
diff --git a/gdb/testsuite/gdb.base/paginate-after-ctrl-c-running.exp b/gdb/testsuite/gdb.base/paginate-after-ctrl-c-running.exp
|
||||||
|
index 0ed8c92..3323fe7 100644
|
||||||
|
--- a/gdb/testsuite/gdb.base/paginate-after-ctrl-c-running.exp
|
||||||
|
+++ b/gdb/testsuite/gdb.base/paginate-after-ctrl-c-running.exp
|
||||||
|
@@ -24,7 +24,6 @@ if {[build_executable "failed to prepare" $testfile $srcfile debug] == -1} {
|
||||||
|
|
||||||
|
proc test_ctrlc_while_target_running_paginates {} {
|
||||||
|
global binfile srcfile
|
||||||
|
- global gdb_prompt pagination_prompt
|
||||||
|
|
||||||
|
set testline [gdb_get_line_number "after sleep"]
|
||||||
|
|
||||||
|
@@ -61,19 +60,13 @@ proc test_ctrlc_while_target_running_paginates {} {
|
||||||
|
# the user can respond to the pagination query.
|
||||||
|
set test "got prompt"
|
||||||
|
set saw_pagination_prompt 0
|
||||||
|
- gdb_test_multiple "" $test {
|
||||||
|
- -re "$pagination_prompt$" {
|
||||||
|
- set saw_pagination_prompt 1
|
||||||
|
- send_gdb "\n"
|
||||||
|
- exp_continue
|
||||||
|
- }
|
||||||
|
+ gdb_test_pagination "" $test {
|
||||||
|
+ send_gdb "\n"
|
||||||
|
+ exp_continue
|
||||||
|
+ } {
|
||||||
|
-re "$gdb_prompt $" {
|
||||||
|
gdb_assert $saw_pagination_prompt $test
|
||||||
|
}
|
||||||
|
- -notransfer -re "<return>" {
|
||||||
|
- # Otherwise gdb_test_multiple considers this an error.
|
||||||
|
- exp_continue
|
||||||
|
- }
|
||||||
|
}
|
||||||
|
|
||||||
|
# Confirm GDB can still process input.
|
||||||
|
diff --git a/gdb/testsuite/gdb.base/paginate-bg-execution.exp b/gdb/testsuite/gdb.base/paginate-bg-execution.exp
|
||||||
|
index dcff8ad..3ba46a3 100644
|
||||||
|
--- a/gdb/testsuite/gdb.base/paginate-bg-execution.exp
|
||||||
|
+++ b/gdb/testsuite/gdb.base/paginate-bg-execution.exp
|
||||||
|
@@ -27,7 +27,6 @@ if {[build_executable "failed to prepare" $testfile $srcfile debug] == -1} {
|
||||||
|
|
||||||
|
proc test_bg_execution_pagination_return {} {
|
||||||
|
global binfile
|
||||||
|
- global pagination_prompt
|
||||||
|
|
||||||
|
with_test_prefix "paginate" {
|
||||||
|
clean_restart $binfile
|
||||||
|
@@ -43,21 +42,12 @@ proc test_bg_execution_pagination_return {} {
|
||||||
|
|
||||||
|
gdb_test "continue&" "Continuing\."
|
||||||
|
|
||||||
|
- set test "pagination handled, breakpoint hit"
|
||||||
|
- set saw_pagination_prompt 0
|
||||||
|
- gdb_test_multiple "" $test {
|
||||||
|
- -re "$pagination_prompt$" {
|
||||||
|
- set saw_pagination_prompt 1
|
||||||
|
- send_gdb "\n"
|
||||||
|
- exp_continue
|
||||||
|
- }
|
||||||
|
- -notransfer -re "<return>" {
|
||||||
|
- # Otherwise gdb_test_multiple considers this an
|
||||||
|
- # error.
|
||||||
|
- exp_continue
|
||||||
|
- }
|
||||||
|
+ gdb_test_pagination "" "pagination handled, breakpoint hit" {
|
||||||
|
+ send_gdb "\n"
|
||||||
|
+ exp_continue
|
||||||
|
+ } {
|
||||||
|
-re "after sleep\[^\r\n\]+\r\n$" {
|
||||||
|
- gdb_assert $saw_pagination_prompt $test
|
||||||
|
+ gdb_assert { $saw_pagination_prompt == 3 } $test
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -75,7 +65,7 @@ proc test_bg_execution_pagination_return {} {
|
||||||
|
|
||||||
|
proc test_bg_execution_pagination_cancel { how } {
|
||||||
|
global binfile
|
||||||
|
- global gdb_prompt pagination_prompt
|
||||||
|
+ global gdb_prompt
|
||||||
|
|
||||||
|
with_test_prefix "cancel with $how" {
|
||||||
|
clean_restart $binfile
|
||||||
|
@@ -92,14 +82,8 @@ proc test_bg_execution_pagination_cancel { how } {
|
||||||
|
gdb_test "continue&" "Continuing\."
|
||||||
|
|
||||||
|
set test "continue& paginates"
|
||||||
|
- gdb_test_multiple "" $test {
|
||||||
|
- -re "$pagination_prompt$" {
|
||||||
|
- pass $test
|
||||||
|
- }
|
||||||
|
- -notransfer -re "<return>" {
|
||||||
|
- # Otherwise gdb_test_multiple considers this an error.
|
||||||
|
- exp_continue
|
||||||
|
- }
|
||||||
|
+ gdb_test_pagination "" $test {
|
||||||
|
+ pass $test
|
||||||
|
}
|
||||||
|
|
||||||
|
set test "cancel pagination"
|
||||||
|
diff --git a/gdb/testsuite/gdb.base/paginate-execution-startup.exp b/gdb/testsuite/gdb.base/paginate-execution-startup.exp
|
||||||
|
index dc713ec..4dc2376 100644
|
||||||
|
--- a/gdb/testsuite/gdb.base/paginate-execution-startup.exp
|
||||||
|
+++ b/gdb/testsuite/gdb.base/paginate-execution-startup.exp
|
||||||
|
@@ -76,7 +76,6 @@ proc probe_can_run_cmdline {} {
|
||||||
|
proc test_fg_execution_pagination_return {} {
|
||||||
|
global file_arg
|
||||||
|
global saved_gdbflags GDBFLAGS
|
||||||
|
- global gdb_prompt pagination_prompt
|
||||||
|
|
||||||
|
set GDBFLAGS $saved_gdbflags
|
||||||
|
append GDBFLAGS " -ex \"set height 2\""
|
||||||
|
@@ -92,10 +91,9 @@ proc test_fg_execution_pagination_return {} {
|
||||||
|
fail $test
|
||||||
|
return $res
|
||||||
|
}
|
||||||
|
- gdb_test_multiple "" $test {
|
||||||
|
- -re "$pagination_prompt$" {
|
||||||
|
- pass $test
|
||||||
|
- }
|
||||||
|
+ gdb_test_pagination "" $test {
|
||||||
|
+ pass $test
|
||||||
|
+ } {
|
||||||
|
-re "$gdb_prompt $" {
|
||||||
|
fail $test
|
||||||
|
}
|
||||||
|
@@ -103,20 +101,13 @@ proc test_fg_execution_pagination_return {} {
|
||||||
|
|
||||||
|
send_gdb "\n"
|
||||||
|
|
||||||
|
- set saw_pagination_prompt 0
|
||||||
|
set test "send \\n to GDB"
|
||||||
|
- gdb_test_multiple "" $test {
|
||||||
|
- -re "$pagination_prompt$" {
|
||||||
|
- set saw_pagination_prompt 1
|
||||||
|
- send_gdb "\n"
|
||||||
|
- exp_continue
|
||||||
|
- }
|
||||||
|
- -notransfer -re "<return>" {
|
||||||
|
- # Otherwise gdb_test_multiple considers this an error.
|
||||||
|
- exp_continue
|
||||||
|
- }
|
||||||
|
+ gdb_test_pagination "" $test {
|
||||||
|
+ send_gdb "\n"
|
||||||
|
+ exp_continue
|
||||||
|
+ } {
|
||||||
|
-re "$gdb_prompt $" {
|
||||||
|
- gdb_assert $saw_pagination_prompt $test
|
||||||
|
+ gdb_assert { $saw_pagination_prompt == 3 } $test
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -133,7 +124,7 @@ proc test_fg_execution_pagination_return {} {
|
||||||
|
proc test_fg_execution_pagination_cancel { how } {
|
||||||
|
global file_arg
|
||||||
|
global saved_gdbflags GDBFLAGS
|
||||||
|
- global gdb_prompt pagination_prompt
|
||||||
|
+ global gdb_prompt
|
||||||
|
|
||||||
|
set GDBFLAGS $saved_gdbflags
|
||||||
|
|
||||||
|
@@ -150,14 +141,8 @@ proc test_fg_execution_pagination_cancel { how } {
|
||||||
|
fail $test
|
||||||
|
return $res
|
||||||
|
}
|
||||||
|
- gdb_test_multiple "" $test {
|
||||||
|
- -re "$pagination_prompt$" {
|
||||||
|
- pass $test
|
||||||
|
- }
|
||||||
|
- -notransfer -re "<return>" {
|
||||||
|
- # Otherwise gdb_test_multiple considers this an error.
|
||||||
|
- exp_continue
|
||||||
|
- }
|
||||||
|
+ gdb_test_pagination "" $test {
|
||||||
|
+ pass $test
|
||||||
|
}
|
||||||
|
|
||||||
|
set test "cancel pagination"
|
||||||
|
diff --git a/gdb/testsuite/gdb.base/paginate-inferior-exit.exp b/gdb/testsuite/gdb.base/paginate-inferior-exit.exp
|
||||||
|
index 0e37be9..d43a245 100644
|
||||||
|
--- a/gdb/testsuite/gdb.base/paginate-inferior-exit.exp
|
||||||
|
+++ b/gdb/testsuite/gdb.base/paginate-inferior-exit.exp
|
||||||
|
@@ -26,7 +26,7 @@ if {[build_executable "failed to prepare" $testfile $srcfile debug] == -1} {
|
||||||
|
#
|
||||||
|
proc test_paginate_inferior_exited {} {
|
||||||
|
global binfile
|
||||||
|
- global gdb_prompt pagination_prompt
|
||||||
|
+ global gdb_prompt
|
||||||
|
global inferior_exited_re
|
||||||
|
|
||||||
|
with_test_prefix "paginate" {
|
||||||
|
@@ -45,23 +45,18 @@ proc test_paginate_inferior_exited {} {
|
||||||
|
# Wait for the "Starting program" line, indicating the program
|
||||||
|
# is running.
|
||||||
|
set saw_starting 0
|
||||||
|
- gdb_test_multiple "continue" $test {
|
||||||
|
- -re "$pagination_prompt" {
|
||||||
|
- if {$saw_starting} {
|
||||||
|
- pass $test
|
||||||
|
- } else {
|
||||||
|
- send_gdb "\n"
|
||||||
|
- exp_continue
|
||||||
|
- }
|
||||||
|
+ gdb_test_pagination "continue" $test {
|
||||||
|
+ if {$saw_starting} {
|
||||||
|
+ pass $test
|
||||||
|
+ } else {
|
||||||
|
+ send_gdb "\n"
|
||||||
|
+ exp_continue
|
||||||
|
}
|
||||||
|
+ } {
|
||||||
|
-re "Continuing" {
|
||||||
|
set saw_starting 1
|
||||||
|
exp_continue
|
||||||
|
}
|
||||||
|
- -notransfer -re "<return>" {
|
||||||
|
- # Otherwise gdb_test_multiple considers this an error.
|
||||||
|
- exp_continue
|
||||||
|
- }
|
||||||
|
}
|
||||||
|
|
||||||
|
# We're now stopped in a pagination output while handling a
|
||||||
|
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
|
||||||
|
index 7a00efb..d953a50 100644
|
||||||
|
--- a/gdb/testsuite/lib/gdb.exp
|
||||||
|
+++ b/gdb/testsuite/lib/gdb.exp
|
||||||
|
@@ -70,9 +70,6 @@ if ![info exists gdb_prompt] then {
|
||||||
|
set gdb_prompt "\[(\]gdb\[)\]"
|
||||||
|
}
|
||||||
|
|
||||||
|
-# A regexp that matches the pagination prompt.
|
||||||
|
-set pagination_prompt "---Type <return> to continue, or q <return> to quit---"
|
||||||
|
-
|
||||||
|
# The variable fullname_syntax_POSIX is a regexp which matches a POSIX
|
||||||
|
# absolute path ie. /foo/
|
||||||
|
set fullname_syntax_POSIX {/[^\n]*/}
|
||||||
|
@@ -4846,5 +4843,46 @@ proc capture_command_output { command prefix } {
|
||||||
|
return $output_string
|
||||||
|
}
|
||||||
|
|
||||||
|
+# Prevent gdb_test_multiple considering an error -re "<return>" match.
|
||||||
|
+# For unknown reason -notransfer -re "<return>" { exp_continue } does not
|
||||||
|
+# prevent it.
|
||||||
|
+
|
||||||
|
+proc gdb_test_pagination { command test { code_prompt3 {} } { code_append {} } } {
|
||||||
|
+ global pagination_prompt1 pagination_prompt2 pagination_prompt3
|
||||||
|
+ global gdb_prompt
|
||||||
|
+
|
||||||
|
+ # A regexp that matches the pagination prompt.
|
||||||
|
+ set pagination_prompt1 "---Type <return"
|
||||||
|
+ set pagination_prompt2 "> to continue, or q <return"
|
||||||
|
+ set pagination_prompt3 "> to quit---"
|
||||||
|
+
|
||||||
|
+ append code_append {
|
||||||
|
+ -re "${pagination_prompt1}" {
|
||||||
|
+ if { $saw_pagination_prompt != 0 && $saw_pagination_prompt != 3 } {
|
||||||
|
+ fail "$test (1)"
|
||||||
|
+ }
|
||||||
|
+ set saw_pagination_prompt 1
|
||||||
|
+ exp_continue
|
||||||
|
+ }
|
||||||
|
+ -re "${pagination_prompt2}" {
|
||||||
|
+ if { $saw_pagination_prompt != 1 } {
|
||||||
|
+ fail "$test (2)"
|
||||||
|
+ }
|
||||||
|
+ set saw_pagination_prompt 2
|
||||||
|
+ exp_continue
|
||||||
|
+ }
|
||||||
|
+ -re "${pagination_prompt3}$" {
|
||||||
|
+ if { $saw_pagination_prompt != 2 } {
|
||||||
|
+ fail "$test (3)"
|
||||||
|
+ }
|
||||||
|
+ set saw_pagination_prompt 3
|
||||||
|
+ eval $code_prompt3
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ set saw_pagination_prompt 0
|
||||||
|
+ gdb_test_multiple $command $test $code_append
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
# Always load compatibility stuff.
|
||||||
|
load_lib future.exp
|
||||||
|
|
||||||
|
--17pEHd4RhPHOinZp--
|
||||||
|
|
@ -65,375 +65,3 @@ index 0e0202d..d849b4c 100644
|
|||||||
# gdbserver does not have this issue.
|
# gdbserver does not have this issue.
|
||||||
if ![is_remote target] {
|
if ![is_remote target] {
|
||||||
setup_kfail "*-*-*" gdb/15934
|
setup_kfail "*-*-*" gdb/15934
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
commit 768fbcfda81ff37027eb7a02c043ff669f7701fa
|
|
||||||
Author: Pedro Alves <palves@redhat.com>
|
|
||||||
Date: Fri Jul 11 11:11:20 2014 +0100
|
|
||||||
|
|
||||||
GDBserver crashes when killing a multi-thread process
|
|
||||||
|
|
||||||
Here's an example, with the new test:
|
|
||||||
|
|
||||||
gdbserver :9999 gdb.threads/kill
|
|
||||||
gdb gdb.threads/kill
|
|
||||||
(gdb) b 52
|
|
||||||
Breakpoint 1 at 0x4007f4: file kill.c, line 52.
|
|
||||||
Continuing.
|
|
||||||
|
|
||||||
Breakpoint 1, main () at kill.c:52
|
|
||||||
52 return 0; /* set break here */
|
|
||||||
(gdb) k
|
|
||||||
Kill the program being debugged? (y or n) y
|
|
||||||
|
|
||||||
gdbserver :9999 gdb.threads/kill
|
|
||||||
Process gdb.base/watch_thread_num created; pid = 9719
|
|
||||||
Listening on port 1234
|
|
||||||
Remote debugging from host 127.0.0.1
|
|
||||||
Killing all inferiors
|
|
||||||
Segmentation fault (core dumped)
|
|
||||||
|
|
||||||
Backtrace:
|
|
||||||
|
|
||||||
(gdb) bt
|
|
||||||
#0 0x00000000004068a0 in find_inferior (list=0x66b060 <all_threads>, func=0x427637 <kill_one_lwp_callback>, arg=0x7fffffffd3fc) at src/gdb/gdbserver/inferiors.c:199
|
|
||||||
#1 0x00000000004277b6 in linux_kill (pid=15708) at src/gdb/gdbserver/linux-low.c:966
|
|
||||||
#2 0x000000000041354d in kill_inferior (pid=15708) at src/gdb/gdbserver/target.c:163
|
|
||||||
#3 0x00000000004107e9 in kill_inferior_callback (entry=0x6704f0) at src/gdb/gdbserver/server.c:2934
|
|
||||||
#4 0x0000000000406522 in for_each_inferior (list=0x66b050 <all_processes>, action=0x4107a6 <kill_inferior_callback>) at src/gdb/gdbserver/inferiors.c:57
|
|
||||||
#5 0x0000000000412377 in process_serial_event () at src/gdb/gdbserver/server.c:3767
|
|
||||||
#6 0x000000000041267c in handle_serial_event (err=0, client_data=0x0) at src/gdb/gdbserver/server.c:3880
|
|
||||||
#7 0x00000000004189ff in handle_file_event (event_file_desc=4) at src/gdb/gdbserver/event-loop.c:434
|
|
||||||
#8 0x00000000004181c6 in process_event () at src/gdb/gdbserver/event-loop.c:189
|
|
||||||
#9 0x0000000000418f45 in start_event_loop () at src/gdb/gdbserver/event-loop.c:552
|
|
||||||
#10 0x0000000000411272 in main (argc=3, argv=0x7fffffffd8d8) at src/gdb/gdbserver/server.c:3283
|
|
||||||
|
|
||||||
The problem is that linux_wait_for_event deletes lwps that have exited
|
|
||||||
(even those not passed in as lwps of interest), while the lwp/thread
|
|
||||||
list is being walked on with find_inferior. find_inferior can handle
|
|
||||||
the current iterated inferior being deleted, but not others.
|
|
||||||
|
|
||||||
When killing lwps, we don't really care about any of the pending
|
|
||||||
status handling of linux_wait_for_event. We can just waitpid the lwps
|
|
||||||
directly, which is also what GDB does (see
|
|
||||||
linux-nat.c:kill_wait_callback). This way the lwps are not deleted
|
|
||||||
while we're walking the list. They'll be deleted by linux_mourn
|
|
||||||
afterwards.
|
|
||||||
|
|
||||||
This crash triggers several times when running the testsuite against
|
|
||||||
GDBserver with the native-gdbserver board (target remote), but as GDB
|
|
||||||
can't distinguish between GDBserver crashing and "kill" being
|
|
||||||
sucessful, as in both cases the connection is closed (the 'k' packet
|
|
||||||
doesn't require a reply), and the inferior is gone, that results in no
|
|
||||||
FAIL.
|
|
||||||
|
|
||||||
The patch adds a generic test that catches the issue with
|
|
||||||
extended-remote mode (and works fine with native testing too). Here's
|
|
||||||
how it fails with the native-extended-gdbserver board without the fix:
|
|
||||||
|
|
||||||
(gdb) info threads
|
|
||||||
Id Target Id Frame
|
|
||||||
6 Thread 15367.15374 0x000000373bcbc98d in nanosleep () at ../sysdeps/unix/syscall-template.S:81
|
|
||||||
5 Thread 15367.15373 0x000000373bcbc98d in nanosleep () at ../sysdeps/unix/syscall-template.S:81
|
|
||||||
4 Thread 15367.15372 0x000000373bcbc98d in nanosleep () at ../sysdeps/unix/syscall-template.S:81
|
|
||||||
3 Thread 15367.15371 0x000000373bcbc98d in nanosleep () at ../sysdeps/unix/syscall-template.S:81
|
|
||||||
2 Thread 15367.15370 0x000000373bcbc98d in nanosleep () at ../sysdeps/unix/syscall-template.S:81
|
|
||||||
* 1 Thread 15367.15367 main () at .../gdb.threads/kill.c:52
|
|
||||||
(gdb) kill
|
|
||||||
Kill the program being debugged? (y or n) y
|
|
||||||
Remote connection closed
|
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^
|
|
||||||
(gdb) FAIL: gdb.threads/kill.exp: kill
|
|
||||||
|
|
||||||
Extended remote should remain connected after the kill.
|
|
||||||
|
|
||||||
gdb/gdbserver/
|
|
||||||
2014-07-11 Pedro Alves <palves@redhat.com>
|
|
||||||
|
|
||||||
* linux-low.c (kill_wait_lwp): New function, based on
|
|
||||||
kill_one_lwp_callback, but use my_waitpid directly.
|
|
||||||
(kill_one_lwp_callback, linux_kill): Use it.
|
|
||||||
|
|
||||||
gdb/testsuite/
|
|
||||||
2014-07-11 Pedro Alves <palves@redhat.com>
|
|
||||||
|
|
||||||
* gdb.threads/kill.c: New file.
|
|
||||||
* gdb.threads/kill.exp: New file.
|
|
||||||
|
|
||||||
### a/gdb/gdbserver/ChangeLog
|
|
||||||
### b/gdb/gdbserver/ChangeLog
|
|
||||||
## -1,3 +1,9 @@
|
|
||||||
+2014-07-11 Pedro Alves <palves@redhat.com>
|
|
||||||
+
|
|
||||||
+ * linux-low.c (kill_wait_lwp): New function, based on
|
|
||||||
+ kill_one_lwp_callback, but use my_waitpid directly.
|
|
||||||
+ (kill_one_lwp_callback, linux_kill): Use it.
|
|
||||||
+
|
|
||||||
2014-06-23 Pedro Alves <palves@redhat.com>
|
|
||||||
|
|
||||||
* linux-x86-low.c (x86_linux_prepare_to_resume): Clear DR_CONTROL
|
|
||||||
--- a/gdb/gdbserver/linux-low.c
|
|
||||||
+++ b/gdb/gdbserver/linux-low.c
|
|
||||||
@@ -909,6 +909,46 @@ linux_kill_one_lwp (struct lwp_info *lwp)
|
|
||||||
errno ? strerror (errno) : "OK");
|
|
||||||
}
|
|
||||||
|
|
||||||
+/* Kill LWP and wait for it to die. */
|
|
||||||
+
|
|
||||||
+static void
|
|
||||||
+kill_wait_lwp (struct lwp_info *lwp)
|
|
||||||
+{
|
|
||||||
+ struct thread_info *thr = get_lwp_thread (lwp);
|
|
||||||
+ int pid = ptid_get_pid (ptid_of (thr));
|
|
||||||
+ int lwpid = ptid_get_lwp (ptid_of (thr));
|
|
||||||
+ int wstat;
|
|
||||||
+ int res;
|
|
||||||
+
|
|
||||||
+ if (debug_threads)
|
|
||||||
+ debug_printf ("kwl: killing lwp %d, for pid: %d\n", lwpid, pid);
|
|
||||||
+
|
|
||||||
+ do
|
|
||||||
+ {
|
|
||||||
+ linux_kill_one_lwp (lwp);
|
|
||||||
+
|
|
||||||
+ /* Make sure it died. Notes:
|
|
||||||
+
|
|
||||||
+ - The loop is most likely unnecessary.
|
|
||||||
+
|
|
||||||
+ - We don't use linux_wait_for_event as that could delete lwps
|
|
||||||
+ while we're iterating over them. We're not interested in
|
|
||||||
+ any pending status at this point, only in making sure all
|
|
||||||
+ wait status on the kernel side are collected until the
|
|
||||||
+ process is reaped.
|
|
||||||
+
|
|
||||||
+ - We don't use __WALL here as the __WALL emulation relies on
|
|
||||||
+ SIGCHLD, and killing a stopped process doesn't generate
|
|
||||||
+ one, nor an exit status.
|
|
||||||
+ */
|
|
||||||
+ res = my_waitpid (lwpid, &wstat, 0);
|
|
||||||
+ if (res == -1 && errno == ECHILD)
|
|
||||||
+ res = my_waitpid (lwpid, &wstat, __WCLONE);
|
|
||||||
+ } while (res > 0 && WIFSTOPPED (wstat));
|
|
||||||
+
|
|
||||||
+ gdb_assert (res > 0);
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
/* Callback for `find_inferior'. Kills an lwp of a given process,
|
|
||||||
except the leader. */
|
|
||||||
|
|
||||||
@@ -917,7 +957,6 @@ kill_one_lwp_callback (struct inferior_list_entry *entry, void *args)
|
|
||||||
{
|
|
||||||
struct thread_info *thread = (struct thread_info *) entry;
|
|
||||||
struct lwp_info *lwp = get_thread_lwp (thread);
|
|
||||||
- int wstat;
|
|
||||||
int pid = * (int *) args;
|
|
||||||
|
|
||||||
if (ptid_get_pid (entry->id) != pid)
|
|
||||||
@@ -936,14 +975,7 @@ kill_one_lwp_callback (struct inferior_list_entry *entry, void *args)
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
- do
|
|
||||||
- {
|
|
||||||
- linux_kill_one_lwp (lwp);
|
|
||||||
-
|
|
||||||
- /* Make sure it died. The loop is most likely unnecessary. */
|
|
||||||
- pid = linux_wait_for_event (thread->entry.id, &wstat, __WALL);
|
|
||||||
- } while (pid > 0 && WIFSTOPPED (wstat));
|
|
||||||
-
|
|
||||||
+ kill_wait_lwp (lwp);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
@@ -952,8 +984,6 @@ linux_kill (int pid)
|
|
||||||
{
|
|
||||||
struct process_info *process;
|
|
||||||
struct lwp_info *lwp;
|
|
||||||
- int wstat;
|
|
||||||
- int lwpid;
|
|
||||||
|
|
||||||
process = find_process_pid (pid);
|
|
||||||
if (process == NULL)
|
|
||||||
@@ -976,21 +1006,7 @@ linux_kill (int pid)
|
|
||||||
pid);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
- {
|
|
||||||
- struct thread_info *thr = get_lwp_thread (lwp);
|
|
||||||
-
|
|
||||||
- if (debug_threads)
|
|
||||||
- debug_printf ("lk_1: killing lwp %ld, for pid: %d\n",
|
|
||||||
- lwpid_of (thr), pid);
|
|
||||||
-
|
|
||||||
- do
|
|
||||||
- {
|
|
||||||
- linux_kill_one_lwp (lwp);
|
|
||||||
-
|
|
||||||
- /* Make sure it died. The loop is most likely unnecessary. */
|
|
||||||
- lwpid = linux_wait_for_event (thr->entry.id, &wstat, __WALL);
|
|
||||||
- } while (lwpid > 0 && WIFSTOPPED (wstat));
|
|
||||||
- }
|
|
||||||
+ kill_wait_lwp (lwp);
|
|
||||||
|
|
||||||
the_target->mourn (process);
|
|
||||||
|
|
||||||
### a/gdb/testsuite/ChangeLog
|
|
||||||
### b/gdb/testsuite/ChangeLog
|
|
||||||
## -1,3 +1,8 @@
|
|
||||||
+2014-07-11 Pedro Alves <palves@redhat.com>
|
|
||||||
+
|
|
||||||
+ * gdb.threads/kill.c: New file.
|
|
||||||
+ * gdb.threads/kill.exp: New file.
|
|
||||||
+
|
|
||||||
2014-07-09 Pedro Alves <palves@redhat.com>
|
|
||||||
|
|
||||||
* gdb.base/attach-wait-input.exp: New file.
|
|
||||||
--- /dev/null
|
|
||||||
+++ b/gdb/testsuite/gdb.threads/kill.c
|
|
||||||
@@ -0,0 +1,64 @@
|
|
||||||
+/* This testcase is part of GDB, the GNU debugger.
|
|
||||||
+
|
|
||||||
+ Copyright 2014 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/>. */
|
|
||||||
+
|
|
||||||
+#ifdef USE_THREADS
|
|
||||||
+
|
|
||||||
+#include <unistd.h>
|
|
||||||
+#include <pthread.h>
|
|
||||||
+
|
|
||||||
+#define NUM 5
|
|
||||||
+
|
|
||||||
+pthread_barrier_t barrier;
|
|
||||||
+
|
|
||||||
+void *
|
|
||||||
+thread_function (void *arg)
|
|
||||||
+{
|
|
||||||
+ volatile unsigned int counter = 1;
|
|
||||||
+
|
|
||||||
+ pthread_barrier_wait (&barrier);
|
|
||||||
+
|
|
||||||
+ while (counter > 0)
|
|
||||||
+ {
|
|
||||||
+ counter++;
|
|
||||||
+ usleep (1);
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ pthread_exit (NULL);
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+#endif /* USE_THREADS */
|
|
||||||
+
|
|
||||||
+void
|
|
||||||
+setup (void)
|
|
||||||
+{
|
|
||||||
+#ifdef USE_THREADS
|
|
||||||
+ pthread_t threads[NUM];
|
|
||||||
+ int i;
|
|
||||||
+
|
|
||||||
+ pthread_barrier_init (&barrier, NULL, NUM + 1);
|
|
||||||
+ for (i = 0; i < NUM; i++)
|
|
||||||
+ pthread_create (&threads[i], NULL, thread_function, NULL);
|
|
||||||
+ pthread_barrier_wait (&barrier);
|
|
||||||
+#endif /* USE_THREADS */
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+int
|
|
||||||
+main (void)
|
|
||||||
+{
|
|
||||||
+ setup ();
|
|
||||||
+ return 0; /* set break here */
|
|
||||||
+}
|
|
||||||
--- /dev/null
|
|
||||||
+++ b/gdb/testsuite/gdb.threads/kill.exp
|
|
||||||
@@ -0,0 +1,77 @@
|
|
||||||
+# This testcase is part of GDB, the GNU debugger.
|
|
||||||
+
|
|
||||||
+# Copyright 2014 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/>. */
|
|
||||||
+
|
|
||||||
+standard_testfile
|
|
||||||
+
|
|
||||||
+# Run the test proper. THREADED indicates whether to build a threaded
|
|
||||||
+# program and spawn several threads before trying to kill the program.
|
|
||||||
+
|
|
||||||
+proc test {threaded} {
|
|
||||||
+ global testfile srcfile
|
|
||||||
+
|
|
||||||
+ with_test_prefix [expr ($threaded)?"threaded":"non-threaded"] {
|
|
||||||
+
|
|
||||||
+ set options {debug}
|
|
||||||
+ if {$threaded} {
|
|
||||||
+ lappend options "pthreads"
|
|
||||||
+ lappend options "additional_flags=-DUSE_THREADS"
|
|
||||||
+ set prog ${testfile}_threads
|
|
||||||
+ } else {
|
|
||||||
+ set prog ${testfile}_nothreads
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ if {[prepare_for_testing "failed to prepare" $prog $srcfile $options] == -1} {
|
|
||||||
+ return -1
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ if { ![runto main] } then {
|
|
||||||
+ fail "run to main"
|
|
||||||
+ return
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ set linenum [gdb_get_line_number "set break here"]
|
|
||||||
+ gdb_breakpoint "$srcfile:$linenum"
|
|
||||||
+ gdb_continue_to_breakpoint "break here" ".*break here.*"
|
|
||||||
+
|
|
||||||
+ if {$threaded} {
|
|
||||||
+ gdb_test "info threads" "6.*5.*4.*3.*2.*1.*" "all threads started"
|
|
||||||
+ }
|
|
||||||
+
|
|
||||||
+ # This kills and ensures no output other than the prompt comes out,
|
|
||||||
+ # like:
|
|
||||||
+ #
|
|
||||||
+ # (gdb) kill
|
|
||||||
+ # Kill the program being debugged? (y or n) y
|
|
||||||
+ # (gdb)
|
|
||||||
+ #
|
|
||||||
+ # If we instead saw more output, like e.g., with an extended-remote
|
|
||||||
+ # connection:
|
|
||||||
+ #
|
|
||||||
+ # (gdb) kill
|
|
||||||
+ # Kill the program being debugged? (y or n) y
|
|
||||||
+ # Remote connection closed
|
|
||||||
+ # (gdb)
|
|
||||||
+ #
|
|
||||||
+ # the above would mean that the remote end crashed.
|
|
||||||
+
|
|
||||||
+ gdb_test "kill" "^y" "kill program" "Kill the program being debugged\\? \\(y or n\\) $" "y"
|
|
||||||
+ }
|
|
||||||
+}
|
|
||||||
+
|
|
||||||
+foreach threaded {true false} {
|
|
||||||
+ test $threaded
|
|
||||||
+}
|
|
||||||
|
@ -3,19 +3,18 @@ https://sourceware.org/ml/gdb-patches/2014-06/msg00108.html
|
|||||||
https://github.com/intel-gdb/vla/tree/vla-fortran
|
https://github.com/intel-gdb/vla/tree/vla-fortran
|
||||||
|
|
||||||
GIT snapshot:
|
GIT snapshot:
|
||||||
commit c622a047d23bcbc4dc68398fc70b531cebd8f5ee
|
commit 511bff520372ffc10fa2ff569c176bdf1e6e475d
|
||||||
|
|
||||||
|
|
||||||
diff --git a/gdb/NEWS b/gdb/NEWS
|
diff --git a/gdb/NEWS b/gdb/NEWS
|
||||||
index d9a19ae..1f22fea 100644
|
index d9a19ae..e6885d2 100644
|
||||||
### a/gdb/NEWS
|
### a/gdb/NEWS
|
||||||
### b/gdb/NEWS
|
### b/gdb/NEWS
|
||||||
@@ -3,6 +3,10 @@
|
@@ -3,6 +3,9 @@
|
||||||
|
|
||||||
*** Changes since GDB 7.8
|
*** Changes since GDB 7.8
|
||||||
|
|
||||||
+* Fortran dynamic array support: GDB has now support for
|
+* Fortran dynamic array support: It allows the user to evaluate
|
||||||
+ dynamic arrays in Fortran. It allows the user to evaluate
|
|
||||||
+ dynamic arrays like an ordinary static array.
|
+ dynamic arrays like an ordinary static array.
|
||||||
+
|
+
|
||||||
*** Changes in GDB 7.8
|
*** Changes in GDB 7.8
|
||||||
@ -78,7 +77,7 @@ index 39dadf3..8cebbe8 100644
|
|||||||
|
|
||||||
/* The location of a value. */
|
/* The location of a value. */
|
||||||
diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c
|
diff --git a/gdb/dwarf2loc.c b/gdb/dwarf2loc.c
|
||||||
index fcab9b9..4aac278 100644
|
index fcab9b9..a624dac 100644
|
||||||
--- a/gdb/dwarf2loc.c
|
--- a/gdb/dwarf2loc.c
|
||||||
+++ b/gdb/dwarf2loc.c
|
+++ b/gdb/dwarf2loc.c
|
||||||
@@ -306,6 +306,7 @@ struct dwarf_expr_baton
|
@@ -306,6 +306,7 @@ struct dwarf_expr_baton
|
||||||
@ -138,7 +137,19 @@ index fcab9b9..4aac278 100644
|
|||||||
|
|
||||||
ctx = new_dwarf_expr_context ();
|
ctx = new_dwarf_expr_context ();
|
||||||
old_chain = make_cleanup_free_dwarf_expr_context (ctx);
|
old_chain = make_cleanup_free_dwarf_expr_context (ctx);
|
||||||
@@ -2436,6 +2456,7 @@ dwarf2_evaluate_loc_desc (struct type *type, struct frame_info *frame,
|
@@ -2326,6 +2346,11 @@ dwarf2_evaluate_loc_desc_full (struct type *type, struct frame_info *frame,
|
||||||
|
int in_stack_memory = dwarf_expr_fetch_in_stack_memory (ctx, 0);
|
||||||
|
|
||||||
|
do_cleanups (value_chain);
|
||||||
|
+
|
||||||
|
+ /* Select right frame to correctly evaluate VLA's during a backtrace. */
|
||||||
|
+ if (is_dynamic_type (type))
|
||||||
|
+ select_frame (frame);
|
||||||
|
+
|
||||||
|
retval = value_at_lazy (type, address + byte_offset);
|
||||||
|
if (in_stack_memory)
|
||||||
|
set_value_stack (retval, 1);
|
||||||
|
@@ -2436,6 +2461,7 @@ dwarf2_evaluate_loc_desc (struct type *type, struct frame_info *frame,
|
||||||
|
|
||||||
static int
|
static int
|
||||||
dwarf2_locexpr_baton_eval (const struct dwarf2_locexpr_baton *dlbaton,
|
dwarf2_locexpr_baton_eval (const struct dwarf2_locexpr_baton *dlbaton,
|
||||||
@ -146,7 +157,7 @@ index fcab9b9..4aac278 100644
|
|||||||
CORE_ADDR *valp)
|
CORE_ADDR *valp)
|
||||||
{
|
{
|
||||||
struct dwarf_expr_context *ctx;
|
struct dwarf_expr_context *ctx;
|
||||||
@@ -2451,6 +2472,7 @@ dwarf2_locexpr_baton_eval (const struct dwarf2_locexpr_baton *dlbaton,
|
@@ -2451,6 +2477,7 @@ dwarf2_locexpr_baton_eval (const struct dwarf2_locexpr_baton *dlbaton,
|
||||||
|
|
||||||
baton.frame = get_selected_frame (NULL);
|
baton.frame = get_selected_frame (NULL);
|
||||||
baton.per_cu = dlbaton->per_cu;
|
baton.per_cu = dlbaton->per_cu;
|
||||||
@ -154,7 +165,7 @@ index fcab9b9..4aac278 100644
|
|||||||
|
|
||||||
objfile = dwarf2_per_cu_objfile (dlbaton->per_cu);
|
objfile = dwarf2_per_cu_objfile (dlbaton->per_cu);
|
||||||
|
|
||||||
@@ -2491,7 +2513,8 @@ dwarf2_locexpr_baton_eval (const struct dwarf2_locexpr_baton *dlbaton,
|
@@ -2491,7 +2518,8 @@ dwarf2_locexpr_baton_eval (const struct dwarf2_locexpr_baton *dlbaton,
|
||||||
/* See dwarf2loc.h. */
|
/* See dwarf2loc.h. */
|
||||||
|
|
||||||
int
|
int
|
||||||
@ -164,7 +175,7 @@ index fcab9b9..4aac278 100644
|
|||||||
{
|
{
|
||||||
if (prop == NULL)
|
if (prop == NULL)
|
||||||
return 0;
|
return 0;
|
||||||
@@ -2502,7 +2525,7 @@ dwarf2_evaluate_property (const struct dynamic_prop *prop, CORE_ADDR *value)
|
@@ -2502,7 +2530,7 @@ dwarf2_evaluate_property (const struct dynamic_prop *prop, CORE_ADDR *value)
|
||||||
{
|
{
|
||||||
const struct dwarf2_property_baton *baton = prop->data.baton;
|
const struct dwarf2_property_baton *baton = prop->data.baton;
|
||||||
|
|
||||||
@ -173,31 +184,7 @@ index fcab9b9..4aac278 100644
|
|||||||
{
|
{
|
||||||
if (baton->referenced_type)
|
if (baton->referenced_type)
|
||||||
{
|
{
|
||||||
@@ -2510,6 +2533,11 @@ dwarf2_evaluate_property (const struct dynamic_prop *prop, CORE_ADDR *value)
|
@@ -2546,6 +2574,20 @@ dwarf2_evaluate_property (const struct dynamic_prop *prop, CORE_ADDR *value)
|
||||||
|
|
||||||
*value = value_as_address (val);
|
|
||||||
}
|
|
||||||
+ if (baton->post_values.data && baton->post_values.size > 0)
|
|
||||||
+ {
|
|
||||||
+ CORE_ADDR new_addr = *value;
|
|
||||||
+ dwarf2_locexpr_baton_eval (&baton->post_values, new_addr, value);
|
|
||||||
+ }
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -2532,6 +2560,11 @@ dwarf2_evaluate_property (const struct dynamic_prop *prop, CORE_ADDR *value)
|
|
||||||
if (!value_optimized_out (val))
|
|
||||||
{
|
|
||||||
*value = value_as_address (val);
|
|
||||||
+ if (baton->post_values.data && baton->post_values.size > 0)
|
|
||||||
+ {
|
|
||||||
+ CORE_ADDR new_addr = *value;
|
|
||||||
+ dwarf2_locexpr_baton_eval (&baton->post_values, new_addr, value);
|
|
||||||
+ }
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -2546,6 +2579,20 @@ dwarf2_evaluate_property (const struct dynamic_prop *prop, CORE_ADDR *value)
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -218,7 +205,7 @@ index fcab9b9..4aac278 100644
|
|||||||
|
|
||||||
/* Helper functions and baton for dwarf2_loc_desc_needs_frame. */
|
/* Helper functions and baton for dwarf2_loc_desc_needs_frame. */
|
||||||
|
|
||||||
@@ -2653,6 +2700,15 @@ needs_get_addr_index (void *baton, unsigned int index)
|
@@ -2653,6 +2695,15 @@ needs_get_addr_index (void *baton, unsigned int index)
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -234,7 +221,7 @@ index fcab9b9..4aac278 100644
|
|||||||
/* Virtual method table for dwarf2_loc_desc_needs_frame below. */
|
/* Virtual method table for dwarf2_loc_desc_needs_frame below. */
|
||||||
|
|
||||||
static const struct dwarf_expr_context_funcs needs_frame_ctx_funcs =
|
static const struct dwarf_expr_context_funcs needs_frame_ctx_funcs =
|
||||||
@@ -2667,7 +2723,8 @@ static const struct dwarf_expr_context_funcs needs_frame_ctx_funcs =
|
@@ -2667,7 +2718,8 @@ static const struct dwarf_expr_context_funcs needs_frame_ctx_funcs =
|
||||||
needs_frame_dwarf_call,
|
needs_frame_dwarf_call,
|
||||||
NULL, /* get_base_type */
|
NULL, /* get_base_type */
|
||||||
needs_dwarf_reg_entry_value,
|
needs_dwarf_reg_entry_value,
|
||||||
@ -244,7 +231,7 @@ index fcab9b9..4aac278 100644
|
|||||||
};
|
};
|
||||||
|
|
||||||
/* Return non-zero iff the location expression at DATA (length SIZE)
|
/* Return non-zero iff the location expression at DATA (length SIZE)
|
||||||
@@ -3316,6 +3373,10 @@ dwarf2_compile_expr_to_ax (struct agent_expr *expr, struct axs_value *loc,
|
@@ -3316,6 +3368,10 @@ dwarf2_compile_expr_to_ax (struct agent_expr *expr, struct axs_value *loc,
|
||||||
unimplemented (op);
|
unimplemented (op);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -256,7 +243,7 @@ index fcab9b9..4aac278 100644
|
|||||||
offset = extract_signed_integer (op_ptr, 2, byte_order);
|
offset = extract_signed_integer (op_ptr, 2, byte_order);
|
||||||
op_ptr += 2;
|
op_ptr += 2;
|
||||||
diff --git a/gdb/dwarf2loc.h b/gdb/dwarf2loc.h
|
diff --git a/gdb/dwarf2loc.h b/gdb/dwarf2loc.h
|
||||||
index 8ad5fa9..cf648eb 100644
|
index 8ad5fa9..fb65c5c 100644
|
||||||
--- a/gdb/dwarf2loc.h
|
--- a/gdb/dwarf2loc.h
|
||||||
+++ b/gdb/dwarf2loc.h
|
+++ b/gdb/dwarf2loc.h
|
||||||
@@ -96,11 +96,18 @@ struct value *dwarf2_evaluate_loc_desc (struct type *type,
|
@@ -96,11 +96,18 @@ struct value *dwarf2_evaluate_loc_desc (struct type *type,
|
||||||
@ -278,21 +265,11 @@ index 8ad5fa9..cf648eb 100644
|
|||||||
/* The symbol location baton types used by the DWARF-2 reader (i.e.
|
/* The symbol location baton types used by the DWARF-2 reader (i.e.
|
||||||
SYMBOL_LOCATION_BATON for a LOC_COMPUTED symbol). "struct
|
SYMBOL_LOCATION_BATON for a LOC_COMPUTED symbol). "struct
|
||||||
dwarf2_locexpr_baton" is for a symbol with a single location
|
dwarf2_locexpr_baton" is for a symbol with a single location
|
||||||
@@ -161,6 +168,9 @@ struct dwarf2_property_baton
|
|
||||||
/* Location list to be evaluated in the context of REFERENCED_TYPE. */
|
|
||||||
struct dwarf2_loclist_baton loclist;
|
|
||||||
};
|
|
||||||
+
|
|
||||||
+ /* Attributes, which will be pushed after evaluating locexpr or loclist. */
|
|
||||||
+ struct dwarf2_locexpr_baton post_values;
|
|
||||||
};
|
|
||||||
|
|
||||||
extern const struct symbol_computed_ops dwarf2_locexpr_funcs;
|
|
||||||
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
|
diff --git a/gdb/dwarf2read.c b/gdb/dwarf2read.c
|
||||||
index 276d2f1..f5b35d7 100644
|
index 276d2f1..fbf13ce 100644
|
||||||
--- a/gdb/dwarf2read.c
|
--- a/gdb/dwarf2read.c
|
||||||
+++ b/gdb/dwarf2read.c
|
+++ b/gdb/dwarf2read.c
|
||||||
@@ -1847,6 +1847,15 @@ static void free_dwo_file_cleanup (void *);
|
@@ -1847,6 +1847,12 @@ static void free_dwo_file_cleanup (void *);
|
||||||
static void process_cu_includes (void);
|
static void process_cu_includes (void);
|
||||||
|
|
||||||
static void check_producer (struct dwarf2_cu *cu);
|
static void check_producer (struct dwarf2_cu *cu);
|
||||||
@ -301,14 +278,11 @@ index 276d2f1..f5b35d7 100644
|
|||||||
+attr_to_dynamic_prop (const struct attribute *attr, struct die_info *die,
|
+attr_to_dynamic_prop (const struct attribute *attr, struct die_info *die,
|
||||||
+ struct dwarf2_cu *cu, struct dynamic_prop *prop,
|
+ struct dwarf2_cu *cu, struct dynamic_prop *prop,
|
||||||
+ const gdb_byte *additional_data, int additional_data_size);
|
+ const gdb_byte *additional_data, int additional_data_size);
|
||||||
+
|
|
||||||
+static void add_post_values_to_baton (struct dwarf2_property_baton *baton,
|
|
||||||
+ const gdb_byte *data, int size, struct dwarf2_cu *cu);
|
|
||||||
+
|
+
|
||||||
|
|
||||||
/* Various complaints about symbol reading that don't abort the process. */
|
/* Various complaints about symbol reading that don't abort the process. */
|
||||||
|
|
||||||
@@ -14201,29 +14210,90 @@ read_tag_string_type (struct die_info *die, struct dwarf2_cu *cu)
|
@@ -14201,29 +14207,92 @@ read_tag_string_type (struct die_info *die, struct dwarf2_cu *cu)
|
||||||
struct gdbarch *gdbarch = get_objfile_arch (objfile);
|
struct gdbarch *gdbarch = get_objfile_arch (objfile);
|
||||||
struct type *type, *range_type, *index_type, *char_type;
|
struct type *type, *range_type, *index_type, *char_type;
|
||||||
struct attribute *attr;
|
struct attribute *attr;
|
||||||
@ -348,7 +322,6 @@ index 276d2f1..f5b35d7 100644
|
|||||||
+ data attribute, to reflect DWARF specialities to get address
|
+ data attribute, to reflect DWARF specialities to get address
|
||||||
+ sizes. */
|
+ sizes. */
|
||||||
+ const gdb_byte append_ops[] = {
|
+ const gdb_byte append_ops[] = {
|
||||||
+ DW_OP_push_object_address,
|
|
||||||
+ /* DW_OP_deref_size: size of an address on the target machine
|
+ /* DW_OP_deref_size: size of an address on the target machine
|
||||||
+ (bytes), where the size will be specified by the next
|
+ (bytes), where the size will be specified by the next
|
||||||
+ operand. */
|
+ operand. */
|
||||||
@ -368,7 +341,10 @@ index 276d2f1..f5b35d7 100644
|
|||||||
+ is the address size of the target machine. */
|
+ is the address size of the target machine. */
|
||||||
+ else
|
+ else
|
||||||
+ {
|
+ {
|
||||||
+ if (!attr_to_dynamic_prop (attr, die, cu, &high, NULL, 0))
|
+ const gdb_byte append_ops[] = { DW_OP_deref };
|
||||||
|
+
|
||||||
|
+ if (!attr_to_dynamic_prop (attr, die, cu, &high, append_ops,
|
||||||
|
+ ARRAY_SIZE (append_ops)))
|
||||||
+ complaint (&symfile_complaints,
|
+ complaint (&symfile_complaints,
|
||||||
+ _("Could not parse DW_AT_string_length"));
|
+ _("Could not parse DW_AT_string_length"));
|
||||||
+ }
|
+ }
|
||||||
@ -406,31 +382,10 @@ index 276d2f1..f5b35d7 100644
|
|||||||
char_type = language_string_char_type (cu->language_defn, gdbarch);
|
char_type = language_string_char_type (cu->language_defn, gdbarch);
|
||||||
type = create_string_type (NULL, char_type, range_type);
|
type = create_string_type (NULL, char_type, range_type);
|
||||||
|
|
||||||
@@ -14540,13 +14610,36 @@ read_base_type (struct die_info *die, struct dwarf2_cu *cu)
|
@@ -14540,13 +14609,15 @@ read_base_type (struct die_info *die, struct dwarf2_cu *cu)
|
||||||
return set_die_type (die, type, cu);
|
return set_die_type (die, type, cu);
|
||||||
}
|
}
|
||||||
|
|
||||||
+/* Add post processing op-codes to a dwarf2_property_baton. */
|
|
||||||
+
|
|
||||||
+static void add_post_values_to_baton (struct dwarf2_property_baton *baton,
|
|
||||||
+ const gdb_byte *data, int size, struct dwarf2_cu *cu)
|
|
||||||
+{
|
|
||||||
+ if (data != NULL && size > 0)
|
|
||||||
+ {
|
|
||||||
+ struct obstack *obstack = &cu->objfile->objfile_obstack;
|
|
||||||
+ gdb_byte *post_data;
|
|
||||||
+
|
|
||||||
+ post_data = obstack_alloc (obstack, size);
|
|
||||||
+ memcpy(post_data, data, size);
|
|
||||||
+ baton->post_values.data = post_data;
|
|
||||||
+ baton->post_values.size = size;
|
|
||||||
+ baton->post_values.per_cu = cu->per_cu;
|
|
||||||
+ } else {
|
|
||||||
+ baton->post_values.data = NULL;
|
|
||||||
+ baton->post_values.size = 0;
|
|
||||||
+ baton->post_values.per_cu = NULL;
|
|
||||||
+ }
|
|
||||||
+}
|
|
||||||
+
|
+
|
||||||
/* Parse dwarf attribute if it's a block, reference or constant and put the
|
/* Parse dwarf attribute if it's a block, reference or constant and put the
|
||||||
resulting value of the attribute into struct bound_prop.
|
resulting value of the attribute into struct bound_prop.
|
||||||
@ -444,37 +399,66 @@ index 276d2f1..f5b35d7 100644
|
|||||||
{
|
{
|
||||||
struct dwarf2_property_baton *baton;
|
struct dwarf2_property_baton *baton;
|
||||||
struct obstack *obstack = &cu->objfile->objfile_obstack;
|
struct obstack *obstack = &cu->objfile->objfile_obstack;
|
||||||
@@ -14559,8 +14652,10 @@ attr_to_dynamic_prop (const struct attribute *attr, struct die_info *die,
|
@@ -14559,8 +14630,25 @@ attr_to_dynamic_prop (const struct attribute *attr, struct die_info *die,
|
||||||
baton = obstack_alloc (obstack, sizeof (*baton));
|
baton = obstack_alloc (obstack, sizeof (*baton));
|
||||||
baton->referenced_type = NULL;
|
baton->referenced_type = NULL;
|
||||||
baton->locexpr.per_cu = cu->per_cu;
|
baton->locexpr.per_cu = cu->per_cu;
|
||||||
- baton->locexpr.size = DW_BLOCK (attr)->size;
|
- baton->locexpr.size = DW_BLOCK (attr)->size;
|
||||||
baton->locexpr.data = DW_BLOCK (attr)->data;
|
- baton->locexpr.data = DW_BLOCK (attr)->data;
|
||||||
|
+
|
||||||
|
+ if (additional_data != NULL && additional_data_size > 0)
|
||||||
|
+ {
|
||||||
|
+ gdb_byte *data;
|
||||||
|
+
|
||||||
|
+ data = obstack_alloc (&cu->objfile->objfile_obstack,
|
||||||
|
+ DW_BLOCK (attr)->size + additional_data_size);
|
||||||
|
+ memcpy (data, DW_BLOCK (attr)->data, DW_BLOCK (attr)->size);
|
||||||
|
+ memcpy (data + DW_BLOCK (attr)->size,
|
||||||
|
+ additional_data, additional_data_size);
|
||||||
|
+
|
||||||
|
+ baton->locexpr.data = data;
|
||||||
|
+ baton->locexpr.size = DW_BLOCK (attr)->size + additional_data_size;
|
||||||
|
+ }
|
||||||
|
+ else
|
||||||
|
+ {
|
||||||
|
+ baton->locexpr.data = DW_BLOCK (attr)->data;
|
||||||
+ baton->locexpr.size = DW_BLOCK (attr)->size;
|
+ baton->locexpr.size = DW_BLOCK (attr)->size;
|
||||||
+ add_post_values_to_baton (baton, additional_data,
|
+ }
|
||||||
+ additional_data_size, cu);
|
|
||||||
prop->data.baton = baton;
|
prop->data.baton = baton;
|
||||||
prop->kind = PROP_LOCEXPR;
|
prop->kind = PROP_LOCEXPR;
|
||||||
gdb_assert (prop->data.baton != NULL);
|
gdb_assert (prop->data.baton != NULL);
|
||||||
@@ -14581,6 +14676,8 @@ attr_to_dynamic_prop (const struct attribute *attr, struct die_info *die,
|
@@ -14590,8 +14678,28 @@ attr_to_dynamic_prop (const struct attribute *attr, struct die_info *die,
|
||||||
baton = obstack_alloc (obstack, sizeof (*baton));
|
baton = obstack_alloc (obstack, sizeof (*baton));
|
||||||
baton->referenced_type = die_type (target_die, target_cu);
|
baton->referenced_type = die_type (target_die, target_cu);
|
||||||
fill_in_loclist_baton (cu, &baton->loclist, target_attr);
|
|
||||||
+ add_post_values_to_baton (baton, additional_data,
|
|
||||||
+ additional_data_size, cu);
|
|
||||||
prop->data.baton = baton;
|
|
||||||
prop->kind = PROP_LOCLIST;
|
|
||||||
gdb_assert (prop->data.baton != NULL);
|
|
||||||
@@ -14592,6 +14689,8 @@ attr_to_dynamic_prop (const struct attribute *attr, struct die_info *die,
|
|
||||||
baton->locexpr.per_cu = cu->per_cu;
|
baton->locexpr.per_cu = cu->per_cu;
|
||||||
baton->locexpr.size = DW_BLOCK (target_attr)->size;
|
- baton->locexpr.size = DW_BLOCK (target_attr)->size;
|
||||||
baton->locexpr.data = DW_BLOCK (target_attr)->data;
|
- baton->locexpr.data = DW_BLOCK (target_attr)->data;
|
||||||
+ add_post_values_to_baton (baton, additional_data,
|
+
|
||||||
+ additional_data_size, cu);
|
+ if (additional_data != NULL && additional_data_size > 0)
|
||||||
|
+ {
|
||||||
|
+ gdb_byte *data;
|
||||||
|
+
|
||||||
|
+ data = obstack_alloc (&cu->objfile->objfile_obstack,
|
||||||
|
+ DW_BLOCK (target_attr)->size + additional_data_size);
|
||||||
|
+ memcpy (data, DW_BLOCK (target_attr)->data,
|
||||||
|
+ DW_BLOCK (target_attr)->size);
|
||||||
|
+ memcpy (data + DW_BLOCK (target_attr)->size,
|
||||||
|
+ additional_data, additional_data_size);
|
||||||
|
+
|
||||||
|
+ baton->locexpr.data = data;
|
||||||
|
+ baton->locexpr.size = (DW_BLOCK (target_attr)->size
|
||||||
|
+ + additional_data_size);
|
||||||
|
+ }
|
||||||
|
+ else
|
||||||
|
+ {
|
||||||
|
+ baton->locexpr.data = DW_BLOCK (target_attr)->data;
|
||||||
|
+ baton->locexpr.size = DW_BLOCK (target_attr)->size;
|
||||||
|
+ }
|
||||||
|
+
|
||||||
prop->data.baton = baton;
|
prop->data.baton = baton;
|
||||||
prop->kind = PROP_LOCEXPR;
|
prop->kind = PROP_LOCEXPR;
|
||||||
gdb_assert (prop->data.baton != NULL);
|
gdb_assert (prop->data.baton != NULL);
|
||||||
@@ -14626,7 +14725,7 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu)
|
@@ -14626,7 +14734,7 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu)
|
||||||
struct type *base_type, *orig_base_type;
|
struct type *base_type, *orig_base_type;
|
||||||
struct type *range_type;
|
struct type *range_type;
|
||||||
struct attribute *attr;
|
struct attribute *attr;
|
||||||
@ -483,7 +467,7 @@ index 276d2f1..f5b35d7 100644
|
|||||||
int low_default_is_valid;
|
int low_default_is_valid;
|
||||||
int high_bound_is_count = 0;
|
int high_bound_is_count = 0;
|
||||||
const char *name;
|
const char *name;
|
||||||
@@ -14646,7 +14745,9 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu)
|
@@ -14646,7 +14754,9 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu)
|
||||||
|
|
||||||
low.kind = PROP_CONST;
|
low.kind = PROP_CONST;
|
||||||
high.kind = PROP_CONST;
|
high.kind = PROP_CONST;
|
||||||
@ -493,7 +477,7 @@ index 276d2f1..f5b35d7 100644
|
|||||||
|
|
||||||
/* Set LOW_DEFAULT_IS_VALID if current language and DWARF version allow
|
/* Set LOW_DEFAULT_IS_VALID if current language and DWARF version allow
|
||||||
omitting DW_AT_lower_bound. */
|
omitting DW_AT_lower_bound. */
|
||||||
@@ -14679,19 +14780,26 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu)
|
@@ -14679,19 +14789,26 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -523,7 +507,7 @@ index 276d2f1..f5b35d7 100644
|
|||||||
{
|
{
|
||||||
/* If bounds are constant do the final calculation here. */
|
/* If bounds are constant do the final calculation here. */
|
||||||
if (low.kind == PROP_CONST && high.kind == PROP_CONST)
|
if (low.kind == PROP_CONST && high.kind == PROP_CONST)
|
||||||
@@ -14755,7 +14863,7 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu)
|
@@ -14755,7 +14872,7 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu)
|
||||||
&& !TYPE_UNSIGNED (base_type) && (high.data.const_val & negative_mask))
|
&& !TYPE_UNSIGNED (base_type) && (high.data.const_val & negative_mask))
|
||||||
high.data.const_val |= negative_mask;
|
high.data.const_val |= negative_mask;
|
||||||
|
|
||||||
@ -532,7 +516,7 @@ index 276d2f1..f5b35d7 100644
|
|||||||
|
|
||||||
if (high_bound_is_count)
|
if (high_bound_is_count)
|
||||||
TYPE_RANGE_DATA (range_type)->flag_upper_bound_is_count = 1;
|
TYPE_RANGE_DATA (range_type)->flag_upper_bound_is_count = 1;
|
||||||
@@ -21673,6 +21781,8 @@ set_die_type (struct die_info *die, struct type *type, struct dwarf2_cu *cu)
|
@@ -21673,6 +21790,8 @@ set_die_type (struct die_info *die, struct type *type, struct dwarf2_cu *cu)
|
||||||
{
|
{
|
||||||
struct dwarf2_per_cu_offset_and_type **slot, ofs;
|
struct dwarf2_per_cu_offset_and_type **slot, ofs;
|
||||||
struct objfile *objfile = cu->objfile;
|
struct objfile *objfile = cu->objfile;
|
||||||
@ -541,7 +525,7 @@ index 276d2f1..f5b35d7 100644
|
|||||||
|
|
||||||
/* For Ada types, make sure that the gnat-specific data is always
|
/* For Ada types, make sure that the gnat-specific data is always
|
||||||
initialized (if not already set). There are a few types where
|
initialized (if not already set). There are a few types where
|
||||||
@@ -21687,6 +21797,43 @@ set_die_type (struct die_info *die, struct type *type, struct dwarf2_cu *cu)
|
@@ -21687,6 +21806,43 @@ set_die_type (struct die_info *die, struct type *type, struct dwarf2_cu *cu)
|
||||||
&& !HAVE_GNAT_AUX_INFO (type))
|
&& !HAVE_GNAT_AUX_INFO (type))
|
||||||
INIT_GNAT_SPECIFIC (type);
|
INIT_GNAT_SPECIFIC (type);
|
||||||
|
|
||||||
@ -864,7 +848,7 @@ index 408c8cc..38f32e0 100644
|
|||||||
fputs_filtered (", ", stream);
|
fputs_filtered (", ", stream);
|
||||||
}
|
}
|
||||||
diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
|
diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
|
||||||
index d0c002f..3f52d61 100644
|
index e99a2f3..53cae2c 100644
|
||||||
--- a/gdb/gdbtypes.c
|
--- a/gdb/gdbtypes.c
|
||||||
+++ b/gdb/gdbtypes.c
|
+++ b/gdb/gdbtypes.c
|
||||||
@@ -805,7 +805,8 @@ allocate_stub_method (struct type *type)
|
@@ -805,7 +805,8 @@ allocate_stub_method (struct type *type)
|
||||||
@ -934,9 +918,9 @@ index d0c002f..3f52d61 100644
|
|||||||
else if (bit_stride > 0)
|
else if (bit_stride > 0)
|
||||||
TYPE_LENGTH (result_type) =
|
TYPE_LENGTH (result_type) =
|
||||||
(bit_stride * (high_bound - low_bound + 1) + 7) / 8;
|
(bit_stride * (high_bound - low_bound + 1) + 7) / 8;
|
||||||
@@ -1616,11 +1628,30 @@ stub_noname_complaint (void)
|
@@ -1616,12 +1628,31 @@ stub_noname_complaint (void)
|
||||||
int
|
static int
|
||||||
is_dynamic_type (struct type *type)
|
is_dynamic_type_internal (struct type *type, int top_level)
|
||||||
{
|
{
|
||||||
+ int index;
|
+ int index;
|
||||||
+
|
+
|
||||||
@ -945,7 +929,8 @@ index d0c002f..3f52d61 100644
|
|||||||
+
|
+
|
||||||
type = check_typedef (type);
|
type = check_typedef (type);
|
||||||
|
|
||||||
if (TYPE_CODE (type) == TYPE_CODE_REF)
|
/* We only want to recognize references at the outermost level. */
|
||||||
|
if (top_level && TYPE_CODE (type) == TYPE_CODE_REF)
|
||||||
type = check_typedef (TYPE_TARGET_TYPE (type));
|
type = check_typedef (TYPE_TARGET_TYPE (type));
|
||||||
|
|
||||||
+ if (TYPE_ASSOCIATED_PROP (type))
|
+ if (TYPE_ASSOCIATED_PROP (type))
|
||||||
@ -965,7 +950,7 @@ index d0c002f..3f52d61 100644
|
|||||||
switch (TYPE_CODE (type))
|
switch (TYPE_CODE (type))
|
||||||
{
|
{
|
||||||
case TYPE_CODE_RANGE:
|
case TYPE_CODE_RANGE:
|
||||||
@@ -1630,11 +1661,19 @@ is_dynamic_type (struct type *type)
|
@@ -1631,11 +1662,19 @@ is_dynamic_type_internal (struct type *type, int top_level)
|
||||||
{
|
{
|
||||||
gdb_assert (TYPE_NFIELDS (type) == 1);
|
gdb_assert (TYPE_NFIELDS (type) == 1);
|
||||||
|
|
||||||
@ -975,21 +960,21 @@ index d0c002f..3f52d61 100644
|
|||||||
+ - the bounds are dynamic,
|
+ - the bounds are dynamic,
|
||||||
+ - the elements it contains have a dynamic contents
|
+ - the elements it contains have a dynamic contents
|
||||||
+ - a data_locaton attribute was found. */
|
+ - a data_locaton attribute was found. */
|
||||||
if (is_dynamic_type (TYPE_INDEX_TYPE (type)))
|
if (is_dynamic_type_internal (TYPE_INDEX_TYPE (type), 0))
|
||||||
return 1;
|
return 1;
|
||||||
- return is_dynamic_type (TYPE_TARGET_TYPE (type));
|
- return is_dynamic_type_internal (TYPE_TARGET_TYPE (type), 0);
|
||||||
+ else if (TYPE_DATA_LOCATION (type) != NULL
|
+ else if (TYPE_DATA_LOCATION (type) != NULL
|
||||||
+ && (TYPE_DATA_LOCATION_KIND (type) == PROP_LOCEXPR
|
+ && (TYPE_DATA_LOCATION_KIND (type) == PROP_LOCEXPR
|
||||||
+ || TYPE_DATA_LOCATION_KIND (type) == PROP_LOCLIST))
|
+ || TYPE_DATA_LOCATION_KIND (type) == PROP_LOCLIST))
|
||||||
+ return 1;
|
+ return 1;
|
||||||
+ else
|
+ else
|
||||||
+ return is_dynamic_type (TYPE_TARGET_TYPE (type));
|
+ return is_dynamic_type_internal (TYPE_TARGET_TYPE (type), 0);
|
||||||
+ break;
|
+ break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case TYPE_CODE_STRUCT:
|
case TYPE_CODE_STRUCT:
|
||||||
@@ -1647,28 +1686,40 @@ is_dynamic_type (struct type *type)
|
@@ -1648,6 +1687,17 @@ is_dynamic_type_internal (struct type *type, int top_level)
|
||||||
&& is_dynamic_type (TYPE_FIELD_TYPE (type, i)))
|
&& is_dynamic_type_internal (TYPE_FIELD_TYPE (type, i), 0))
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
+ case TYPE_CODE_PTR:
|
+ case TYPE_CODE_PTR:
|
||||||
@ -1006,8 +991,9 @@ index d0c002f..3f52d61 100644
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
@@ -1666,22 +1716,23 @@ static struct type *resolve_dynamic_type_internal (struct type *type,
|
||||||
}
|
CORE_ADDR addr,
|
||||||
|
int top_level);
|
||||||
|
|
||||||
-/* Given a dynamic range type (dyn_range_type), return a static version
|
-/* Given a dynamic range type (dyn_range_type), return a static version
|
||||||
- of that type. */
|
- of that type. */
|
||||||
@ -1034,7 +1020,7 @@ index d0c002f..3f52d61 100644
|
|||||||
{
|
{
|
||||||
low_bound.kind = PROP_CONST;
|
low_bound.kind = PROP_CONST;
|
||||||
low_bound.data.const_val = value;
|
low_bound.data.const_val = value;
|
||||||
@@ -1680,7 +1731,7 @@ resolve_dynamic_range (struct type *dyn_range_type)
|
@@ -1693,7 +1744,7 @@ resolve_dynamic_range (struct type *dyn_range_type)
|
||||||
}
|
}
|
||||||
|
|
||||||
prop = &TYPE_RANGE_DATA (dyn_range_type)->high;
|
prop = &TYPE_RANGE_DATA (dyn_range_type)->high;
|
||||||
@ -1043,7 +1029,7 @@ index d0c002f..3f52d61 100644
|
|||||||
{
|
{
|
||||||
high_bound.kind = PROP_CONST;
|
high_bound.kind = PROP_CONST;
|
||||||
high_bound.data.const_val = value;
|
high_bound.data.const_val = value;
|
||||||
@@ -1694,10 +1745,17 @@ resolve_dynamic_range (struct type *dyn_range_type)
|
@@ -1707,10 +1758,17 @@ resolve_dynamic_range (struct type *dyn_range_type)
|
||||||
high_bound.kind = PROP_UNDEFINED;
|
high_bound.kind = PROP_UNDEFINED;
|
||||||
high_bound.data.const_val = 0;
|
high_bound.data.const_val = 0;
|
||||||
}
|
}
|
||||||
@ -1064,7 +1050,7 @@ index d0c002f..3f52d61 100644
|
|||||||
TYPE_RANGE_DATA (static_range_type)->flag_bound_evaluated = 1;
|
TYPE_RANGE_DATA (static_range_type)->flag_bound_evaluated = 1;
|
||||||
return static_range_type;
|
return static_range_type;
|
||||||
}
|
}
|
||||||
@@ -1707,29 +1765,52 @@ resolve_dynamic_range (struct type *dyn_range_type)
|
@@ -1720,29 +1778,52 @@ resolve_dynamic_range (struct type *dyn_range_type)
|
||||||
of the associated array. */
|
of the associated array. */
|
||||||
|
|
||||||
static struct type *
|
static struct type *
|
||||||
@ -1125,24 +1111,16 @@ index d0c002f..3f52d61 100644
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Resolve dynamic bounds of members of the union TYPE to static
|
/* Resolve dynamic bounds of members of the union TYPE to static
|
||||||
@@ -1823,6 +1904,7 @@ resolve_dynamic_struct (struct type *type, CORE_ADDR addr)
|
@@ -1846,6 +1927,8 @@ resolve_dynamic_type_internal (struct type *type, CORE_ADDR addr,
|
||||||
return resolved_type;
|
|
||||||
}
|
|
||||||
|
|
||||||
+
|
|
||||||
/* See gdbtypes.h */
|
|
||||||
|
|
||||||
struct type *
|
|
||||||
@@ -1830,6 +1912,8 @@ resolve_dynamic_type (struct type *type, CORE_ADDR addr)
|
|
||||||
{
|
{
|
||||||
struct type *real_type = check_typedef (type);
|
struct type *real_type = check_typedef (type);
|
||||||
struct type *resolved_type = type;
|
struct type *resolved_type = type;
|
||||||
+ const struct dynamic_prop *prop;
|
+ const struct dynamic_prop *prop;
|
||||||
+ CORE_ADDR value;
|
+ CORE_ADDR value;
|
||||||
|
|
||||||
if (!is_dynamic_type (real_type))
|
if (!is_dynamic_type_internal (real_type, top_level))
|
||||||
return type;
|
return type;
|
||||||
@@ -1853,11 +1937,12 @@ resolve_dynamic_type (struct type *type, CORE_ADDR addr)
|
@@ -1871,11 +1954,12 @@ resolve_dynamic_type_internal (struct type *type, CORE_ADDR addr,
|
||||||
}
|
}
|
||||||
|
|
||||||
case TYPE_CODE_ARRAY:
|
case TYPE_CODE_ARRAY:
|
||||||
@ -1157,7 +1135,7 @@ index d0c002f..3f52d61 100644
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case TYPE_CODE_UNION:
|
case TYPE_CODE_UNION:
|
||||||
@@ -1869,6 +1954,25 @@ resolve_dynamic_type (struct type *type, CORE_ADDR addr)
|
@@ -1887,6 +1971,25 @@ resolve_dynamic_type_internal (struct type *type, CORE_ADDR addr,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1183,7 +1161,7 @@ index d0c002f..3f52d61 100644
|
|||||||
return resolved_type;
|
return resolved_type;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -4078,6 +4182,27 @@ copy_type_recursive (struct objfile *objfile,
|
@@ -4104,6 +4207,27 @@ copy_type_recursive (struct objfile *objfile,
|
||||||
*TYPE_RANGE_DATA (new_type) = *TYPE_RANGE_DATA (type);
|
*TYPE_RANGE_DATA (new_type) = *TYPE_RANGE_DATA (type);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1211,7 +1189,7 @@ index d0c002f..3f52d61 100644
|
|||||||
/* Copy pointers to other types. */
|
/* Copy pointers to other types. */
|
||||||
if (TYPE_TARGET_TYPE (type))
|
if (TYPE_TARGET_TYPE (type))
|
||||||
TYPE_TARGET_TYPE (new_type) =
|
TYPE_TARGET_TYPE (new_type) =
|
||||||
@@ -4124,6 +4249,44 @@ copy_type (const struct type *type)
|
@@ -4150,6 +4274,44 @@ copy_type (const struct type *type)
|
||||||
memcpy (TYPE_MAIN_TYPE (new_type), TYPE_MAIN_TYPE (type),
|
memcpy (TYPE_MAIN_TYPE (new_type), TYPE_MAIN_TYPE (type),
|
||||||
sizeof (struct main_type));
|
sizeof (struct main_type));
|
||||||
|
|
||||||
@ -1257,10 +1235,10 @@ index d0c002f..3f52d61 100644
|
|||||||
}
|
}
|
||||||
|
|
||||||
diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h
|
diff --git a/gdb/gdbtypes.h b/gdb/gdbtypes.h
|
||||||
index bb6352d..5818f79 100644
|
index 5008ef4..436edf8 100644
|
||||||
--- a/gdb/gdbtypes.h
|
--- a/gdb/gdbtypes.h
|
||||||
+++ b/gdb/gdbtypes.h
|
+++ b/gdb/gdbtypes.h
|
||||||
@@ -670,6 +670,10 @@ struct main_type
|
@@ -669,6 +669,10 @@ struct main_type
|
||||||
|
|
||||||
struct dynamic_prop high;
|
struct dynamic_prop high;
|
||||||
|
|
||||||
@ -1271,7 +1249,7 @@ index bb6352d..5818f79 100644
|
|||||||
/* True if HIGH range bound contains the number of elements in the
|
/* True if HIGH range bound contains the number of elements in the
|
||||||
subrange. This affects how the final hight bound is computed. */
|
subrange. This affects how the final hight bound is computed. */
|
||||||
|
|
||||||
@@ -725,6 +729,23 @@ struct main_type
|
@@ -724,6 +728,23 @@ struct main_type
|
||||||
|
|
||||||
struct func_type *func_stuff;
|
struct func_type *func_stuff;
|
||||||
} type_specific;
|
} type_specific;
|
||||||
@ -1295,7 +1273,7 @@ index bb6352d..5818f79 100644
|
|||||||
};
|
};
|
||||||
|
|
||||||
/* * A ``struct type'' describes a particular instance of a type, with
|
/* * A ``struct type'' describes a particular instance of a type, with
|
||||||
@@ -1203,6 +1224,39 @@ extern void allocate_gnat_aux_type (struct type *);
|
@@ -1202,6 +1223,39 @@ extern void allocate_gnat_aux_type (struct type *);
|
||||||
TYPE_RANGE_DATA(range_type)->high.kind
|
TYPE_RANGE_DATA(range_type)->high.kind
|
||||||
#define TYPE_LOW_BOUND_KIND(range_type) \
|
#define TYPE_LOW_BOUND_KIND(range_type) \
|
||||||
TYPE_RANGE_DATA(range_type)->low.kind
|
TYPE_RANGE_DATA(range_type)->low.kind
|
||||||
@ -1335,7 +1313,7 @@ index bb6352d..5818f79 100644
|
|||||||
|
|
||||||
/* Moto-specific stuff for FORTRAN arrays. */
|
/* Moto-specific stuff for FORTRAN arrays. */
|
||||||
|
|
||||||
@@ -1210,6 +1264,9 @@ extern void allocate_gnat_aux_type (struct type *);
|
@@ -1209,6 +1263,9 @@ extern void allocate_gnat_aux_type (struct type *);
|
||||||
TYPE_HIGH_BOUND_UNDEFINED(TYPE_INDEX_TYPE(arraytype))
|
TYPE_HIGH_BOUND_UNDEFINED(TYPE_INDEX_TYPE(arraytype))
|
||||||
#define TYPE_ARRAY_LOWER_BOUND_IS_UNDEFINED(arraytype) \
|
#define TYPE_ARRAY_LOWER_BOUND_IS_UNDEFINED(arraytype) \
|
||||||
TYPE_LOW_BOUND_UNDEFINED(TYPE_INDEX_TYPE(arraytype))
|
TYPE_LOW_BOUND_UNDEFINED(TYPE_INDEX_TYPE(arraytype))
|
||||||
@ -1345,7 +1323,7 @@ index bb6352d..5818f79 100644
|
|||||||
|
|
||||||
#define TYPE_ARRAY_UPPER_BOUND_VALUE(arraytype) \
|
#define TYPE_ARRAY_UPPER_BOUND_VALUE(arraytype) \
|
||||||
(TYPE_HIGH_BOUND(TYPE_INDEX_TYPE((arraytype))))
|
(TYPE_HIGH_BOUND(TYPE_INDEX_TYPE((arraytype))))
|
||||||
@@ -1678,6 +1735,7 @@ extern struct type *create_array_type_with_stride
|
@@ -1677,6 +1734,7 @@ extern struct type *create_array_type_with_stride
|
||||||
|
|
||||||
extern struct type *create_range_type (struct type *, struct type *,
|
extern struct type *create_range_type (struct type *, struct type *,
|
||||||
const struct dynamic_prop *,
|
const struct dynamic_prop *,
|
||||||
@ -2030,10 +2008,10 @@ index 0000000..6053c17
|
|||||||
+gdb_test "print sizeof(pvla)" " = 4000" "print sizeof associated pvla"
|
+gdb_test "print sizeof(pvla)" " = 4000" "print sizeof associated pvla"
|
||||||
diff --git a/gdb/testsuite/gdb.fortran/vla-stride.exp b/gdb/testsuite/gdb.fortran/vla-stride.exp
|
diff --git a/gdb/testsuite/gdb.fortran/vla-stride.exp b/gdb/testsuite/gdb.fortran/vla-stride.exp
|
||||||
new file mode 100644
|
new file mode 100644
|
||||||
index 0000000..e791115
|
index 0000000..35f585d
|
||||||
--- /dev/null
|
--- /dev/null
|
||||||
+++ b/gdb/testsuite/gdb.fortran/vla-stride.exp
|
+++ b/gdb/testsuite/gdb.fortran/vla-stride.exp
|
||||||
@@ -0,0 +1,51 @@
|
@@ -0,0 +1,44 @@
|
||||||
+# Copyright 2014 Free Software Foundation, Inc.
|
+# Copyright 2014 Free Software Foundation, Inc.
|
||||||
+
|
+
|
||||||
+# This program is free software; you can redistribute it and/or modify
|
+# This program is free software; you can redistribute it and/or modify
|
||||||
@ -2061,13 +2039,6 @@ index 0000000..e791115
|
|||||||
+ continue
|
+ continue
|
||||||
+}
|
+}
|
||||||
+
|
+
|
||||||
+gdb_breakpoint [gdb_get_line_number "reverse-elements"]
|
|
||||||
+gdb_continue_to_breakpoint "reverse-elements"
|
|
||||||
+gdb_test "print pvla" " = \\\(10, 9, 8, 7, 6, 5, 4, 3, 2, 1\\\)" \
|
|
||||||
+ "print reverse-elements"
|
|
||||||
+gdb_test "print pvla(1)" " = 10" "print first reverse-element"
|
|
||||||
+gdb_test "print pvla(10)" " = 1" "print last reverse-element"
|
|
||||||
+
|
|
||||||
+gdb_breakpoint [gdb_get_line_number "re-reverse-elements"]
|
+gdb_breakpoint [gdb_get_line_number "re-reverse-elements"]
|
||||||
+gdb_continue_to_breakpoint "re-reverse-elements"
|
+gdb_continue_to_breakpoint "re-reverse-elements"
|
||||||
+gdb_test "print pvla" " = \\\(1, 2, 3, 4, 5, 6, 7, 8, 9, 10\\\)" \
|
+gdb_test "print pvla" " = \\\(1, 2, 3, 4, 5, 6, 7, 8, 9, 10\\\)" \
|
||||||
@ -2087,7 +2058,7 @@ index 0000000..e791115
|
|||||||
+gdb_test "print pvla(1)" " = 5" "print one single-element"
|
+gdb_test "print pvla(1)" " = 5" "print one single-element"
|
||||||
diff --git a/gdb/testsuite/gdb.fortran/vla-stride.f90 b/gdb/testsuite/gdb.fortran/vla-stride.f90
|
diff --git a/gdb/testsuite/gdb.fortran/vla-stride.f90 b/gdb/testsuite/gdb.fortran/vla-stride.f90
|
||||||
new file mode 100644
|
new file mode 100644
|
||||||
index 0000000..1f8cc55
|
index 0000000..6aa4f2b
|
||||||
--- /dev/null
|
--- /dev/null
|
||||||
+++ b/gdb/testsuite/gdb.fortran/vla-stride.f90
|
+++ b/gdb/testsuite/gdb.fortran/vla-stride.f90
|
||||||
@@ -0,0 +1,30 @@
|
@@ -0,0 +1,30 @@
|
||||||
@ -2115,7 +2086,7 @@ index 0000000..1f8cc55
|
|||||||
+ vla = (/ (I, I = 1,10) /)
|
+ vla = (/ (I, I = 1,10) /)
|
||||||
+
|
+
|
||||||
+ pvla => vla(10:1:-1)
|
+ pvla => vla(10:1:-1)
|
||||||
+ pvla => pvla(10:1:-1) ! reverse-elements
|
+ pvla => pvla(10:1:-1)
|
||||||
+ pvla => vla(1:10:2) ! re-reverse-elements
|
+ pvla => vla(1:10:2) ! re-reverse-elements
|
||||||
+ pvla => vla(5:4:-2) ! odd-elements
|
+ pvla => vla(5:4:-2) ! odd-elements
|
||||||
+
|
+
|
||||||
@ -3157,7 +3128,7 @@ index 6698247..7a415cf 100644
|
|||||||
+
|
+
|
||||||
#endif
|
#endif
|
||||||
diff --git a/gdb/value.c b/gdb/value.c
|
diff --git a/gdb/value.c b/gdb/value.c
|
||||||
index 557056f..4e91a43 100644
|
index 29abe5f..5efea89 100644
|
||||||
--- a/gdb/value.c
|
--- a/gdb/value.c
|
||||||
+++ b/gdb/value.c
|
+++ b/gdb/value.c
|
||||||
@@ -43,6 +43,7 @@
|
@@ -43,6 +43,7 @@
|
||||||
@ -3168,7 +3139,7 @@ index 557056f..4e91a43 100644
|
|||||||
|
|
||||||
/* Prototypes for exported functions. */
|
/* Prototypes for exported functions. */
|
||||||
|
|
||||||
@@ -1646,6 +1647,25 @@ set_value_component_location (struct value *component,
|
@@ -1627,6 +1628,25 @@ set_value_component_location (struct value *component,
|
||||||
if (funcs->copy_closure)
|
if (funcs->copy_closure)
|
||||||
component->location.computed.closure = funcs->copy_closure (whole);
|
component->location.computed.closure = funcs->copy_closure (whole);
|
||||||
}
|
}
|
||||||
@ -3194,7 +3165,7 @@ index 557056f..4e91a43 100644
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -2950,13 +2970,22 @@ value_primitive_field (struct value *arg1, int offset,
|
@@ -2931,13 +2951,22 @@ value_primitive_field (struct value *arg1, int offset,
|
||||||
v = allocate_value_lazy (type);
|
v = allocate_value_lazy (type);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -3223,7 +3194,7 @@ index 557056f..4e91a43 100644
|
|||||||
}
|
}
|
||||||
set_value_component_location (v, arg1);
|
set_value_component_location (v, arg1);
|
||||||
VALUE_REGNUM (v) = VALUE_REGNUM (arg1);
|
VALUE_REGNUM (v) = VALUE_REGNUM (arg1);
|
||||||
@@ -3539,7 +3568,8 @@ readjust_indirect_value_type (struct value *value, struct type *enc_type,
|
@@ -3520,7 +3549,8 @@ readjust_indirect_value_type (struct value *value, struct type *enc_type,
|
||||||
struct value *original_value)
|
struct value *original_value)
|
||||||
{
|
{
|
||||||
/* Re-adjust type. */
|
/* Re-adjust type. */
|
||||||
@ -3233,7 +3204,7 @@ index 557056f..4e91a43 100644
|
|||||||
|
|
||||||
/* Add embedding info. */
|
/* Add embedding info. */
|
||||||
set_value_enclosing_type (value, enc_type);
|
set_value_enclosing_type (value, enc_type);
|
||||||
@@ -3556,6 +3586,12 @@ coerce_ref (struct value *arg)
|
@@ -3537,6 +3567,12 @@ coerce_ref (struct value *arg)
|
||||||
struct value *retval;
|
struct value *retval;
|
||||||
struct type *enc_type;
|
struct type *enc_type;
|
||||||
|
|
||||||
@ -3246,7 +3217,7 @@ index 557056f..4e91a43 100644
|
|||||||
retval = coerce_ref_if_computed (arg);
|
retval = coerce_ref_if_computed (arg);
|
||||||
if (retval)
|
if (retval)
|
||||||
return retval;
|
return retval;
|
||||||
@@ -3699,8 +3735,14 @@ value_fetch_lazy (struct value *val)
|
@@ -3680,8 +3716,14 @@ value_fetch_lazy (struct value *val)
|
||||||
}
|
}
|
||||||
else if (VALUE_LVAL (val) == lval_memory)
|
else if (VALUE_LVAL (val) == lval_memory)
|
||||||
{
|
{
|
||||||
|
24
gdb.spec
24
gdb.spec
@ -18,14 +18,14 @@ Summary: A GNU source-level debugger for C, C++, Fortran, Go and other languages
|
|||||||
Name: %{?scl_prefix}gdb
|
Name: %{?scl_prefix}gdb
|
||||||
|
|
||||||
# Freeze it when GDB gets branched
|
# Freeze it when GDB gets branched
|
||||||
%global snapsrc 20140711
|
%global snapsrc 20140721
|
||||||
# See timestamp of source gnulib installed into gdb/gnulib/ .
|
# See timestamp of source gnulib installed into gdb/gnulib/ .
|
||||||
%global snapgnulib 20121213
|
%global snapgnulib 20121213
|
||||||
Version: 7.7.90.%{snapsrc}
|
Version: 7.7.91.%{snapsrc}
|
||||||
|
|
||||||
# The release always contains a leading reserved number, start it at 1.
|
# The release always contains a leading reserved number, start it at 1.
|
||||||
# `upstream' is not a part of `name' to stay fully rpm dependencies compatible for the testing.
|
# `upstream' is not a part of `name' to stay fully rpm dependencies compatible for the testing.
|
||||||
Release: 11%{?dist}
|
Release: 12%{?dist}
|
||||||
|
|
||||||
License: GPLv3+ and GPLv3+ with exceptions and GPLv2+ and GPLv2+ with exceptions and GPL+ and LGPLv2+ and BSD and Public Domain and GFDL
|
License: GPLv3+ and GPLv3+ with exceptions and GPLv2+ and GPLv2+ with exceptions and GPL+ and LGPLv2+ and BSD and Public Domain and GFDL
|
||||||
Group: Development/Debuggers
|
Group: Development/Debuggers
|
||||||
@ -516,12 +516,17 @@ Patch914: gdb-readline-6.3.5.patch
|
|||||||
Patch918: gdb-btrobust.patch
|
Patch918: gdb-btrobust.patch
|
||||||
|
|
||||||
# Fix crash on optimized-out entry data values (BZ 1111910).
|
# Fix crash on optimized-out entry data values (BZ 1111910).
|
||||||
Patch919: gdb-entrydataoptimizedout.patch
|
Patch922: gdb-entryval-crash-1of3.patch
|
||||||
|
Patch923: gdb-entryval-crash-2of3.patch
|
||||||
|
Patch919: gdb-entryval-crash-3of3.patch
|
||||||
|
|
||||||
# Python completion w/overriden completer (Sergio Durigan Junior, BZ 1075199).
|
# Python completion w/overriden completer (Sergio Durigan Junior, BZ 1075199).
|
||||||
Patch920: gdb-python-completer-1of2.patch
|
Patch920: gdb-python-completer-1of2.patch
|
||||||
Patch921: gdb-python-completer-2of2.patch
|
Patch921: gdb-python-completer-2of2.patch
|
||||||
|
|
||||||
|
# [testsuite] Fix paginate-*.exp race for "read1".
|
||||||
|
Patch924: gdb-testsuite-pagination-read1.patch
|
||||||
|
|
||||||
%if 0%{!?rhel:1} || 0%{?rhel} > 6
|
%if 0%{!?rhel:1} || 0%{?rhel} > 6
|
||||||
# RL_STATE_FEDORA_GDB would not be found for:
|
# RL_STATE_FEDORA_GDB would not be found for:
|
||||||
# Patch642: gdb-readline62-ask-more-rh.patch
|
# Patch642: gdb-readline62-ask-more-rh.patch
|
||||||
@ -798,9 +803,12 @@ find -name "*.info*"|xargs rm -f
|
|||||||
%patch887 -p1
|
%patch887 -p1
|
||||||
%patch914 -p1
|
%patch914 -p1
|
||||||
%patch918 -p1
|
%patch918 -p1
|
||||||
%patch919 -p1
|
|
||||||
%patch920 -p1
|
%patch920 -p1
|
||||||
%patch921 -p1
|
%patch921 -p1
|
||||||
|
%patch922 -p1
|
||||||
|
%patch923 -p1
|
||||||
|
%patch919 -p1
|
||||||
|
%patch924 -p1
|
||||||
|
|
||||||
%patch848 -p1
|
%patch848 -p1
|
||||||
%if 0%{!?el6:1}
|
%if 0%{!?el6:1}
|
||||||
@ -1291,6 +1299,12 @@ then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Tue Jul 22 2014 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.7.91.20140721-12.fc21
|
||||||
|
- Rebase to FSF GDB 7.7.91.20140721 (pre-7.8 snapshot).
|
||||||
|
- Rebase the Intel VLA patchset.
|
||||||
|
- New fix of the optimized-out entry data values crash (BZ 1111910).
|
||||||
|
- [testsuite] Fix paginate-*.exp race for "read1".
|
||||||
|
|
||||||
* Fri Jul 11 2014 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.7.90.20140711-11.fc21
|
* Fri Jul 11 2014 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.7.90.20140711-11.fc21
|
||||||
- Fix regression#2 of the optimized-out entry data values fix (of BZ 1111910).
|
- Fix regression#2 of the optimized-out entry data values fix (of BZ 1111910).
|
||||||
- Rebase to FSF GDB 7.7.90.20140711 (pre-7.8 snapshot).
|
- Rebase to FSF GDB 7.7.90.20140711 (pre-7.8 snapshot).
|
||||||
|
2
sources
2
sources
@ -1,2 +1,2 @@
|
|||||||
4981307aa9619bbec5b73261e4e41c8d gdb-libstdc++-v3-python-r155978.tar.bz2
|
4981307aa9619bbec5b73261e4e41c8d gdb-libstdc++-v3-python-r155978.tar.bz2
|
||||||
6912a3a243a66a5fa04dc38aad3e8e80 gdb-7.7.90.20140711.tar.bz2
|
e482a840e0bf8e928268c72cb2241646 gdb-7.7.91.20140721.tar.bz2
|
||||||
|
Loading…
Reference in New Issue
Block a user