473,403 Members | 2,366 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,403 software developers and data experts.

getting %ebp from within a function call

I'm constructing a garbage collector. I have a way of scanning the
stack precisely, but I need to be able to trace back through the stack
via %ebp. I kind of don't want to have to alter the compiler and add
the overhead by adding a pushl %ebp before each void *gc_alloc(/*void
*ebp,*/ size_t), so I was wondering if anyone out there had any not-
too-devilishly-voodoo-y solution to getting the current function's
base pointer. Maybe it's in the C standard, but I can't find it.

I can alter the compiler, to be sure, but I wanted to know if there
was some easier/lazier/more cost-efficient way of doing things.
-Gabe

Mar 2 '07 #1
2 2633
On Mar 2, 2:07 pm, "Gabe McArthur" <madeona...@gmail.comwrote:
I'm constructing a garbage collector. I have a way of scanning the
stack precisely, but I need to be able to trace back through the stack
via %ebp. I kind of don't want to have to alter the compiler and add
the overhead by adding a pushl %ebp before each void *gc_alloc(/*void
*ebp,*/ size_t), so I was wondering if anyone out there had any not-
too-devilishly-voodoo-y solution to getting the current function's
base pointer. Maybe it's in the C standard, but I can't find it.

I can alter the compiler, to be sure, but I wanted to know if there
was some easier/lazier/more cost-efficient way of doing things.
-Gabe
I guess you are using the GCC compiler because of the AT&T Gas syntax
you are using.
Try the gcc compiler newsgroup and ask about inline assembly.

Mar 2 '07 #2
Gabe McArthur wrote:
I'm constructing a garbage collector. I have a way of scanning the
stack precisely, but I need to be able to trace back through the stack
via %ebp. I kind of don't want to have to alter the compiler and add
the overhead by adding a pushl %ebp before each void *gc_alloc(/*void
*ebp,*/ size_t), so I was wondering if anyone out there had any not-
too-devilishly-voodoo-y solution to getting the current function's
base pointer. Maybe it's in the C standard, but I can't find it.
No, the C standard has no requirement for a stack, and certainly not
for a base pointer.

You'll probably need to use atleast inline assembler instructions.

A quick post to the gcc mailing-list ought to clear up your problem.

Mar 2 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: hellrazor | last post by:
Hi there, First of all, I'm very much a C++ amateur (i.e., a newb). I'm having to program a win32 system service for my employer, and I'm almost done with the task, but I need help with...
6
by: Martin | last post by:
I'd like to be able to get the name of an object instance from within a call to a method of that same object. Is this at all possible? The example below works by passing in the name of the object...
2
by: James Marshall | last post by:
Does anyone know.... In JavaScript, is there any way to get a reference to a string variable (not an object), like Perl's "\" operator? I want to be able to compare two such references and know...
2
by: laredotornado | last post by:
Hello, I am looking for a cross-browser way (Firefox 1+, IE 5.5+) to have my Javascript function execute from the BODY's "onload" method, but if there is already an onload method defined, I would...
7
by: Nathan Sokalski | last post by:
I would like to be able to get the ContentType of a file programmatically (for example, I want *.txt files to return "text/plain"). I could not find a way to do this using VB.NET's classes, but I...
3
by: tshad | last post by:
I have a page that I am getting a username and password as a random number (2 letters, one number and 4 more letters) I have 2 functions I call: *************************************************...
0
by: banderson777 | last post by:
Hello, I'm a bit new at in-depth IE programming, and am having a bit of trouble with a couple of IE browser extensions (getting them to talk to each other). The first one is a C++ Browser Helper...
2
by: rocketfire97 | last post by:
I'm trying to call a COM object using C# but having no luck getting values back for passed in ref objects. I've tried the same call using VB.NET and can get data back. How would I implement the...
4
by: Harlequin | last post by:
I have a question concerning the need to trigger events within a "child" subform which is itself enbedded within a master "parent" form and which is accessible via a tab in the parent form. Becuase...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.