On 10/ 5/10 11:04 AM, Jürgen Keil wrote:
I can reproduce the problem on my system running bash so I don't think
it is related the the shell:

(gdb) b main
Breakpoint 1 at 0x8050ccc: file g.c, line 4.
(gdb) r
Starting program: /home/gvasick/a.out

Breakpoint 1, main (argc=260904, argv=0xfef90018) at g.c:4

Which compiler, compiler version, gdb version did you use?
What compilation flags?
What does the test program look like?

Using Opensolaris b134, gcc 3.4.3, gdb 6.8, a simple
"hello, world" type test program, and compilation options
"-g -O" it works for me.

For me, the "b main" command sets a breakpoint
at offset 12 relative to the symbol "main", after
main's function prologue.

And that makes all the difference. It's never going to work properly unless at least the first two instructions of the function prologue get executed in order to set the frame pointer in %ebp.

If the debugger automatically modifies your breakpoint request, you don't have to worry about this. If it literally sets the breakpoint where you tell it, you have to be aware of this little trick.

        Scott

--
Scott Rotondo
Senior Principal Engineer, Solaris Core OS Engineering
President, Trusted Computing Group
Phone: +1 408 276 6987 (Internal x66987)
_______________________________________________
opensolaris-discuss mailing list
[email protected]

Reply via email to