Debugging?

Christian Stieber <[email protected]>
Newsgroups gmane.comp.lib.gnustep.user
Message-ID <20060318174757.GA3012@Gatekeeper>
Hi,

well, I recently found gnustep, and decided to give it a try. On a
Linux box, I got the current version of gcc (4.1; since I suspected
that trying to use my old 2.95 installation wouldn't do much good); I
also installed the gnustep base libraries, and restarted my current
project using objective-c/gnustep.

Eventually I figured out how to compile and link with the gnustep
libraries (still getting bugged warnings, but I'm ignoring these for
now) --- it seemed easier to do it that way, rather than trying
to analyse the gnustep make stuff to see how to incorporate these
into my own project.

But then I decided to take the next step --- getting a clean compile,
so I could actually try to debug the stuff I already have before
continuing.

I got the current gdb (6.3) and ran it --- but currently I'm stuck
here: for some reason, gdb singlesteps not only through my code, but
also through the runtime system. So it looks like this:

------------------------------ Cut ------------------------------

(gdb) break main
Breakpoint 1 at 0x804a860: file MyProject/Main.m, line 17.
(gdb) run test
Starting program: /tmp/MyProject test
[Thread debugging using libthread_db enabled]
[New Thread 1024 (runnable)]
[Switching to Thread 1024 (runnable)]

Breakpoint 1, main (argc=0, argv=0x8049111) at MyProject/Main.m:17
17      {
(gdb) n
0x08049914 in __i686.get_pc_thunk.bx ()
(gdb) n
Single stepping until exit from function __i686.get_pc_thunk.bx,
which has no line number information.
main (argc=2, argv=0xbffff3d4) at MyProject/Main.m:20
20        MyProject_GlobalMutex=[[NSLock alloc] init];
(gdb) n
22        for (i=1; i<argc; i++)
(gdb) n
26            Userparam=[[NSString alloc] initWithCString:argv[i]];
(gdb) n
27            if (![MyProject_Provider MyProject_Provider_Start:Userparam])
(gdb) print-object Userparam
2006-03-18 18:26:30.605 MyProject[3042] autorelease called without pool for object (80b77f8) of class NSObject in thread <NSThread: 805f2e0>
test
(gdb) s
objc_get_class (name=0x8050cd0 "MyProject_Provider") at /home/stieber/Data/Software/GCC/gcc-4.1.0/libobjc/class.c:252
252       CLASS_TABLE_HASH (length, hash, class_name);
Current language:  auto; currently c
(gdb) s
491     {
(gdb) s
252       CLASS_TABLE_HASH (length, hash, class_name);
(gdb) s
254       node = class_table_array[hash];
(gdb) s
256       if (node != NULL)
(gdb) s
260               if (node->length == length)

------------------------------ Cut ------------------------------

It seems I'm missing some settings (why isn't that the default?) to tell
gdb to not step into the runtime system --- I don't want to singlestep
through "class.c" whenever I call a method in my program, as this
clutters the debugging session with tons of irrelevant/useless stuff...

The __i686.get_pc_thunk.bx at the beginning is pretty much the same
crap, but I could live with that.

The obvious step I took was to remove the gcc sourcedir (don't need
that anyway), but it still steps through class.c --- it just doesn't
give sourcecode anymore (big surprise :-))

So, what are the "recommended" commands/options/whatever to setup
a usable objective-c debugging session?

Thanks for any assistance,
  Christian
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.