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: Bus Error



Here is a scratch of my code:
=====
mip2sat.c:

#include "m2s_parse.h"  
#include "m2s_convert.h"
#include "m2s_solve.h"  

#include <stdio.h>
#include <stdlib.h>
#include <string.h>

int
main(int argc, 
     char *argv[])
{     
  /* declarations */

  /* extern declarations */

#if DEBUG > 100
  debug("argc = %d\n", argc);
  debug("argv[0] = %s\n", argv[0]);   // CONTROL STOPS HERE!!!
#endif

  /*...*/

  return 0;
}
=====
All included files include m2s.h, which contains global variables and
some utility.

The debugger console shows:
argc = 8348
Program received signal:  "EXC_BAD_ACCESS".

The strange thing is that if I create a new project managing only CL
parameters, it runs without any problem!!
And the result is the same if I compile and run it in the terminal emulator.

I thought the problem could be the "extern" declarations. The linker
gives me warnings on them, cause I set the -m option.


2005/6/16, Cameron Kerr <email@hidden>:
> On Jun 16, 2005, at 4:28 AM, Federico wrote:
> 
> >  6 printf
> >  7 main
> 
> If you click on the "main" function in the stack trace, you can
> inspect what arguments are being passed to printf.
> 
> I'm guessing (you perhaps should show us relevant parts of your code
> (keep it short)) that you have either some problem with stdio, or you
> have some other problem (such as heap corruption) that printf
> encounters when it runs.
> 
> BTW, you will find it useful to put ALL debugging statements to
> stderr, using fprintf. stdout is buffered, and not output immediately.
> 
> If you want to launch your program from Xcode with command-line
> parameters, you will need to use Project > New Custom Executable
> 
> --
> Cameron Kerr
> Telecommunications Teaching Fellow & SysAdmin
> email@hidden
> 
>
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/xcode-users/email@hidden

This email sent to email@hidden

References: 
 >Bus Error (From: Federico <email@hidden>)
 >Re: Bus Error (From: Markus Hitter <email@hidden>)
 >Re: Bus Error (From: Federico <email@hidden>)
 >Re: Bus Error (From: Federico <email@hidden>)
 >Re: Bus Error (From: Cameron Kerr <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.