tags:

views:

438

answers:

1

Hello guys,

Strangest thing happening to me right now: GDB seems to launch after the app does.

Output in xcode terminal window looks like this:

[Session started at 2010-02-15 18:57:31 +0100.]
2010-02-15 18:57:35.822 CPPlayer[2890:207] CPLanguageManager.m:26 Initializing LanguageManager
2010-02-15 18:57:35.825 CPPlayer[2890:207] CPLanguageManager.m:51 Done initializing LanguageManager
2010-02-15 18:57:35.833 CPPlayer[2890:207] CPTicketProcessor.m:84 Loading tickets
2010-02-15 18:57:35.835 CPPlayer[2890:207] CPTicket.m:66 Initiating with path: /Users/nick/Library/Application Support/iPhone Simulator/User/Applications/F6F161E5-7765-4EC8-9F53-BABD664A6805/Documents/tickets/trip-language-arabic-ticket.plist

[Session started at 2010-02-15 18:57:35 +0100.]
GNU gdb 6.3.50-20050815 (Apple version gdb-967) (Tue Jul 14 02:11:58 UTC 2009)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-apple-darwin".sharedlibrary apply-load-rules all
Attaching to process 2890.
kill
quit

The Debugger has exited with status 0.(gdb)

As you can see, Xcode thinks the session start twice, but this is, and I'm 100% sure, the result of hitting "Build and Run" once, and that never failed me thus far.

What (am I)/(is Xcode) doing wrong?

PS. I noticed there's a setting "Start executable after GDB launches" in the Debugging tab of the "Executable Info"-screen, but that is checked (changed nothing there by the way, this behavior suddenly started).

PPS. Killed iPhone Simulator before killing App from xcode, normally gave me a "Terminating in repsonse to Switchboard.." now it said this (Full session output):

[Session started at 2010-02-15 19:17:54 +0100.]
2010-02-15 19:17:59.180 CPPlayer[2963:207] CPLanguageManager.m:26 Initializing LanguageManager
2010-02-15 19:17:59.182 CPPlayer[2963:207] CPLanguageManager.m:51 Done initializing LanguageManager
2010-02-15 19:17:59.184 CPPlayer[2963:207] CPTicketProcessor.m:84 Loading tickets
2010-02-15 19:17:59.189 CPPlayer[2963:207] CPTicket.m:66 Initiating with path: /Users/nick/Library/Application Support/iPhone Simulator/User/Applications/54C79C7B-5D77-4734-A1AF-E11FD92D4EF9/Documents/tickets/trip-language-arabic-ticket.plist

[Session started at 2010-02-15 19:17:59 +0100.]
GNU gdb 6.3.50-20050815 (Apple version gdb-967) (Tue Jul 14 02:11:58 UTC 2009)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-apple-darwin".sharedlibrary apply-load-rules all
Attaching to process 2963.
kill
error while killing target (killing anyway): warning: error on line 1987 of "/SourceCache/gdb/gdb-967/src/gdb/macosx/macosx-nat-inferior.c" in function "macosx_kill_inferior_safe": (os/kern) failure (0x5x)
quit

The Debugger has exited with status 0.(gdb) 
+1  A: 

This is the way that debugging works for iPhone apps, both on the device and simulator. Note the two parts:

2010-02-15 18:57:35.822 CPPlayer[2890:207] CPLanguageManager.m:26 Initializing LanguageManager

The "2980" is the process ID (pid) of the running app.

Attaching to process 2890.

That's gdb attaching to the already-launched app.

cdespinosa
The point was that Xcode quite clearly states that the app will not launch before GDB attached to the process. I don't get why that does not happen here. Normally the app loads, halts before the first line of my written code is executed, GDB attaches, then the app continues. Here, the app launches and GDB attaches after the app has executed some code.
Nick
Months later now. It seems to happen really rarely, but it appears to be the case that sometimes, gdb doesn't attach before a single line is executed. I was sure that it would be. I do not know how I can make sure gdb is not launched before a single line is executed. Still, this answer is a valid for my question. Thanks.
Nick