• 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: Compile acts differently when run from terminal and in debugger???
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Compile acts differently when run from terminal and in debugger???


  • Subject: Re: Compile acts differently when run from terminal and in debugger???
  • From: "Theodore H. Smith" <email@hidden>
  • Date: Fri, 9 Feb 2007 22:28:34 +0000


On 9 Feb 2007, at 19:13, Chris Espinosa wrote:


On Feb 8, 2007, at 5:30 PM, Theodore H. Smith wrote:

I'm compiling some small shell tool.

It doesn't use any library functions except fopen (and fread and fclose), and malloc and free.

However, I'm seeing some really odd thing. The tool runs differently when run from the terminal and when debugged inside Xcode!

What's worse, it's causing a bug that only shows up in the terminal.

It's the same file. I'm not talking about release vs debug build, but the debug build actually run from the terminal. So I do this:

rexaf-t3% /Users/theodore/Programming/ElfData/Source/build/debug/ ewasd

When you do this, your working directory is your home directory. When you run or debug in Xcode, the default working directory is the Build directory (/Users/theodore/Programming/ElfData/Source/ build/debug/). Your code is probably written to assume some resources relative to the current working directory. Don't.


Chris

No that's not it.

It reads one file only, and writes none. If it can't read the file, the app exits very early, it outputs about 3 lines of text before quitting.

If it can find the input file, it outputs hundreds of lines.

I can tell the difference.

The current directory has no effect on my code other than does it get the input file or not. And it's always getting the same input file.

It's like something is different causing some data structures to be written into RAM differently. Or maybe the malloc is differently linked and I'm getting some special version of malloc which is zeroing memory but only within Xcode or something like that.

Basically it's the abstract data structures that are being different, it's not IO or library stuff that's different. My app is heavily abstract data oriented, barely does any IO. (Well barely any input anyhow, lots of output. This is because it's a testing app, so it thoroughly tests the app with about 100 variations per input).


_______________________________________________ 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: Compile acts differently when run from terminal and in debugger???
      • From: Chris Espinosa <email@hidden>
References: 
 >Compile acts differently when run from terminal and in debugger??? (From: "Theodore H. Smith" <email@hidden>)
 >Re: Compile acts differently when run from terminal and in debugger??? (From: Chris Espinosa <email@hidden>)

  • Prev by Date: Re: Strange behavior in XCode, not exhibited in Dev-C++
  • Next by Date: Re: Compile acts differently when run from terminal and in debugger???
  • Previous by thread: Re: Compile acts differently when run from terminal and in debugger???
  • Next by thread: Re: Compile acts differently when run from terminal and in debugger???
  • Index(es):
    • Date
    • Thread