logo       

Sponsor
FREE Network Mapping Tool for Microsoft® Office Visio® Professional 2007
Don't map your network by hand - let LANsurveyor Exx press for Microsoft Visio Professional 2007 automatically create network diagrams for you!

[rfc] Only compare against dummy frame's top when explicitly set: msg#00680

gdb.patches

Subject: [rfc] Only compare against dummy frame's top when explicitly set

Hello,

To follow up an earlier thread, the attached revised patch modifies generic_find_dummy_frame() so that it only tests TOP when it was set.
However, this time it uses the value of TOP instead of find_dummy_frame_p(). I think this is more robust since, as with the ia64, it allows an architecture to explicitly set TOS (rather than rely on hand_function_call() to set it).

I'm intending to commit this in a few days (~monday). I should note that there is evidence that the change, while arguably correct, will break something. cf, the fixes I recently made to the rs6000 because the change flushes out bugs in that target that the incorrect test was hiding.

Thoughts before the commit?

Andrew
2002-09-25 Andrew Cagney <ac131313@xxxxxxxxxx>

* blockframe.c (generic_find_dummy_frame): Rewrite. Only test
against TOP when TOP was explictly set.
(generic_push_dummy_frame): Set TOP to zero.

Index: blockframe.c
===================================================================
RCS file: /cvs/src/src/gdb/blockframe.c,v
retrieving revision 1.40
diff -u -r1.40 blockframe.c
--- blockframe.c 17 Sep 2002 20:42:01 -0000 1.40
+++ blockframe.c 26 Sep 2002 16:19:30 -0000
@@ -1151,8 +1151,8 @@

/* Function: find_dummy_frame(pc, fp, sp)

- Search the stack of dummy frames for one matching the given PC, FP
- and SP. Unlike PC_IN_CALL_DUMMY, this function doesn't need to
+ Search the stack of dummy frames for one matching the given PC and
+ FP/SP. Unlike PC_IN_CALL_DUMMY, this function doesn't need to
adjust for DECR_PC_AFTER_BREAK. This is because it is only legal
to call this function after the PC has been adjusted. */

@@ -1163,12 +1163,37 @@

for (dummyframe = dummy_frame_stack; dummyframe != NULL;
dummyframe = dummyframe->next)
- if ((pc >= dummyframe->call_lo && pc < dummyframe->call_hi)
- && (fp == dummyframe->fp
- || fp == dummyframe->sp
- || fp == dummyframe->top))
- /* The frame in question lies between the saved fp and sp, inclusive */
+ {
+ /* Does the PC fall within the dummy frame's breakpoint
+ instruction. If not, discard this one. */
+ if (!(pc >= dummyframe->call_lo && pc < dummyframe->call_hi))
+ continue;
+ /* Does the FP match? */
+ if (dummyframe->top != 0)
+ {
+ /* If the target architecture explicitly saved the
+ top-of-stack before the inferior function call, assume
+ that that same architecture will always pass in an FP
+ (frame base) value that eactly matches that saved TOS.
+ Don't check the saved SP and SP as they can lead to false
+ hits. */
+ if (fp != dummyframe->top)
+ continue;
+ }
+ else
+ {
+ /* An older target that hasn't explicitly or implicitly
+ saved the dummy frame's top-of-stack. Try matching the
+ FP against the saved SP and FP. NOTE: If you're trying
+ to fix a problem with GDB not correctly finding a dummy
+ frame, check the comments that go with FRAME_ALIGN() and
+ SAVE_DUMMY_FRAME_TOS(). */
+ if (fp != dummyframe->fp && fp != dummyframe->sp)
+ continue;
+ }
+ /* The FP matches this dummy frame. */
return dummyframe->regcache;
+ }

return 0;
}
@@ -1265,7 +1290,7 @@

dummy_frame->pc = read_pc ();
dummy_frame->sp = read_sp ();
- dummy_frame->top = dummy_frame->sp;
+ dummy_frame->top = 0;
dummy_frame->fp = fp;
regcache_cpy (dummy_frame->regcache, current_regcache);
dummy_frame->next = dummy_frame_stack;
<Prev in Thread] Current Thread [Next in Thread>
Sponsor
FREE Network Mapping Tool for Microsoft® OfficeVisio Professional 2007
Don't map your network by hand - let LANsurveyor Express for Microsoft Visio Professional 2007
automatically create network diagrams for you!
Google Custom Search

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe

Navigation

Home | sitemap | advertise | OSDir is an inevitable website. super tiny logo