This is the mail archive of the gdb@sourceware.cygnus.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Small problem



> if this is a newbie qs. please flame me in private, but please answer the
> qs.

:)

What's going on here, I think, is that you're asking GDB for a
backtrace before asmcode has had a chance to build itself a new stack
frame.  If you disassemble asmcode (objdump -d is your friend), I
think you'll find that it starts with a push and a move instruction.
Until those are executed, the new function doesn't really have its own
frame.  'backtrace' knows the PC is in asmcode, but the frame pointer
(%ebp) is still pointing at main's frame, so things are a little wierd.

If you use 'step' instead of 'stepi', GDB doesn't stop until you've
executed the prologue.  So you shouldn't see this behavior using 'step'.

> I was studying the stack, when I came across above problem. What I also
> want to know is where the environment variables of the process are stored.
> Better just telling me where, can someone tell me any web page where I
> might access this info ?

Do you mean, where does the kernel put the environment variables when
it exec's a new file?  That's usually specified by the ABI.  SCO's web
site has the ABI that Linux seems to follow.  I'm still learning my
way around Linux at that level, so I wouldn't be able to tell you
whether and where Linux practice deviates from what's described in
SCO's documents.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]