Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Re: Ubuntu gdb cores Xcode
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Ubuntu gdb cores Xcode



On Tue, Oct 21, 2008 at 12:49 AM, Terry Lambert <email@hidden> wrote:
> On Oct 20, 2008, at 10:21 PM, Dee Ayy <email@hidden> wrote:
>> 1) How do I restore proper /cores/ usage?
>
> Make sure the directory ownership and permissions are set correctly so that
> the core file can be written. Also remember to unlimit the core file size
> again. The easiest way to do this would be to call setrlimit() first thing
> in your main(), so you don't need to remember to do it in the shell.

I tried Disk Utility to Repair Disk Permissions, but it did not report
on nor repair /cores.
I guessed permissions and ownership as:
drwxrwxr-t     root      admin
and it seems to be working, because my cores are dumped there and I
can debug using my typical gdb session.
Are these the correct settings?

>> I then put all my sources in an Xcode project and thought I could use
>> its debugging tools:
>> 3) How do I debug this app in Xcode with the non-typical invocation
>> like so "cat my_pipe | ./my_app"?
>>
>> I was thinking of Attach Process ID, but my_app may abnormally
>> terminate before I find the process
>
> Typically, you would debug the shell that you are about to try to run tge
> program from, and set "follow fork" and debug into my_app that way.

Please explain this "follow fork" technique.  Am I to add code to
my_app or just use the Xcode menus to set this up?  I am on Tiger
10.4.11 and Xcode 2.5.

> Also FWIW: Given that you are getting a bus error, that's almost a guarantee
> that you are doing a null pointer derefernce in your code, since we map an
> inaccessible page into page zero.

I had not finished development of my_app on Ubuntu, and I was porting
to the Mac to continue.
I have been able to use Xcode to successfully build the sources on the
Mac; copy the same sources to Ubuntu; use a slightly different compile
command on Ubuntu; debug and run successfully on Ubuntu (and root out
what was a double free null pointer problem).
Now that my_app is running fine on Ubuntu, I'm trying again to run on
the Mac, but I actually get a Segmentation fault with the same
successfully built sources on the Mac.

Presently it is at
while(fgets(stream, StreamSize, stdin) != NULL){
and I am concerned about the compile command used on the different
OS's.  I didn't touch Xcode's (I simply hit the Build button), but
Ubuntu build command is as posted above
cc -g main.c other_files.c -pthread -o my_app -lm

Xcode man pages seems to imply that it is fine with "stdin" in my
while loop line, but it does mention
Standard C Library (libc, -lc)
so do I need to tell it "-lc" like how I have told it "-lm" on Ubuntu?
 If so, how?

Thanks for the help so far.
Please advise.
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Unix-porting mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden



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

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.