Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problems with gdb not catching breakpoints in shared .dynlib



On Nov 3, 2004, at 10:04 PM, Greg Earle wrote:

(Not sure if this is the best/right place to ask ... but I'm trying
to port an app written for Linux, so ... )

It's a perfectly fine place to ask this as far as I'm concerned.

(I had to remove the "-O2" from CFLAGS to prevent a crash.)

I couldn't reproduce that crash. Are you just running it as './sshblaster2 sship.txt'?


When I run the program, it dies in a module in the library:

I couldn't reproduce this crash, either, even with a sship.txt file of 'localhost root:22'.


The program didn't exit normally, and gdb didn't stop at the breakpoint!
It crashed!

That's because it's forking. When a program forks, gdb continues to debug the parent process, but it doesn't debug the child. You can work around this in a number of ways. Here are a few options (there are others, too):


1) Remove the fork. I think this case will work without forking.
2) In the child, add something like
static int foo = 0;
while (foo == 0) { }
Run the app, then attach to the child with gdb, type 'p foo = 1', and continue to be debugging the child.


Hope this helps a little,
Eric

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Unix-porting mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/unix-porting/email@hidden

This email sent to email@hidden
References: 
 >Problems with gdb not catching breakpoints in shared .dynlib (From: Greg Earle <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.