• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Bus Error
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bus Error


  • Subject: Re: Bus Error
  • From: Federico <email@hidden>
  • Date: Thu, 16 Jun 2005 09:55:22 +0200

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:

This email sent to email@hidden

  • Follow-Ups:
    • Re: Bus Error
      • From: Cameron Hayne <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>)

  • Prev by Date: Re: How to choose the compiler in a new project
  • Next by Date: CopyCStringToPascal
  • Previous by thread: Re: Bus Error
  • Next by thread: Re: Bus Error
  • Index(es):
    • Date
    • Thread