Last Comment Bug 331436 - __builtin_frame_address(0) doesn't work anymore
: __builtin_frame_address(0) doesn't work anymore
Status: RESOLVED FIXED
[patch]
: fixed1.8.1
Product: Core
Classification: Components
Component: XPCOM (show other bugs)
: Trunk
: x86 Linux
-- normal (vote)
: ---
Assigned To: David Baron :dbaron: ⌚️UTC-8
:
: Nathan Froyd [:froydnj]
Mentors:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2006-03-23 00:11 PST by David Baron :dbaron: ⌚️UTC-8
Modified: 2006-04-05 16:17 PDT (History)
2 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
patch (12.73 KB, patch)
2006-03-23 13:58 PST, David Baron :dbaron: ⌚️UTC-8
brendan: review+
brendan: approval‑branch‑1.8.1+
Details | Diff | Splinter Review

Description User image David Baron :dbaron: ⌚️UTC-8 2006-03-23 00:11:30 PST
So, between the compilers on Fedora Core 4 and Fedora Core 5, __builtin_frame_address(0), which we started using extensively for our debugging tools in the patches to bug 323853, stopped working.  Instead of pointing to the saved frame pointer on the stack, it points to the last of the saved registers on the stack, which varies by function.

So I can work around it by throwing bp += 3 in DumpStackToFile and ++bp in jprof's equivalent, but that doesn't seem satisfactory.

I could use inline assembler as in attachment 210815 [details] [diff] [review].

I'd also like to understand why this changed so I can know how to ifdef any fixes, if necessary.
Comment 1 User image David Baron :dbaron: ⌚️UTC-8 2006-03-23 00:39:01 PST
Note that I'm compiling with -fno-omit-frame-pointer.  There may have been some changes that require that for this stuff to work (i.e., stop using a register for the frame pointer by default); perhaps they're even related.
Comment 2 User image David Baron :dbaron: ⌚️UTC-8 2006-03-23 13:58:44 PST
Created attachment 216054 [details] [diff] [review]
patch

I also threw in some changes to prefer void* over u_long for pointers.
Comment 3 User image David Baron :dbaron: ⌚️UTC-8 2006-03-23 13:59:51 PST
Er, sorry, uint32.  (Which actually means it *is* important for x86_64, although some of these don't yet completely work there.)
Comment 4 User image Brendan Eich [:brendan] 2006-03-23 15:00:10 PST
Comment on attachment 216054 [details] [diff] [review]
patch

Very quick r=me, more rs=me actually (jury duty break ending).

/be
Comment 5 User image David Baron :dbaron: ⌚️UTC-8 2006-03-23 15:26:04 PST
Checked in to trunk.
Comment 6 User image David Baron :dbaron: ⌚️UTC-8 2006-04-04 10:20:13 PDT
(And I fixed the C++ comments to be C comments after landing on the trunk; need to do that on the branch too.)
Comment 7 User image David Baron :dbaron: ⌚️UTC-8 2006-04-05 16:17:22 PDT
Checked in to MOZILLA_1_8_BRANCH.

Note You need to log in before you can comment on or make changes to this bug.