Fix finish command for PNaCl.
Since PNaCl hides base address, frame stack addresss may contain
base address or not depending on whether it comes from register
or stack frame.
BUG= https://code.google.com/p/nativeclient/issues/detail?id=3600
TEST= none
R=eaeltsin@google.com
Review URL: https://codereview.chromium.org/22399003
diff --git a/gdb/frame.c b/gdb/frame.c
index b769873..4866d73 100644
--- a/gdb/frame.c
+++ b/gdb/frame.c
@@ -448,6 +448,7 @@
frame_id_eq (struct frame_id l, struct frame_id r)
{
int eq;
+ const uint32_t max_addr = (uint32_t) -1;
if (!l.stack_addr_p && l.special_addr_p
&& !r.stack_addr_p && r.special_addr_p)
@@ -461,7 +462,12 @@
/* Like a NaN, if either ID is invalid, the result is false.
Note that a frame ID is invalid iff it is the null frame ID. */
eq = 0;
- else if (l.stack_addr != r.stack_addr)
+ /* Hack for PNaCl support. Due to base address hiding
+ stack_addr may differ by base address. This creates false
+ positives for normal 64-bit mode, so we need to find a better way. */
+ else if ((l.stack_addr != r.stack_addr && l.stack_addr > max_addr
+ && r.stack_addr > max_addr)
+ || (uint32_t)l.stack_addr != (uint32_t)r.stack_addr)
/* If .stack addresses are different, the frames are different. */
eq = 0;
else if (l.code_addr_p && r.code_addr_p && l.code_addr != r.code_addr)