[Prev][Next][Index][Thread]

GDB



Hello everyone,

I am attempting to debug a small kernel that I am working on over a
serial line.  I have compiled the ground hog day kit as follows:

neal@school:~/oskit-20000202/build$ ../configure --enable-debug  

It builds correctly and my kernels boot.

I am compiling my kernel as follows (from my GNUmakeruls file):

>>
kernel: $(OBJDIR)/lib/multiboot.o kernel.o $(DEPENDLIBS) parser.o bin.o hash_table.o lex.o program.o symbol_table.o yyerror.o
        $(OSKIT_QUIET_MAKE_INFORM) "Linking extended example $@"
        $(OSKIT_QUIET_MAKE_HIDE)$(LD) -Ttext 100000 $(LDFLAGS) $(OSKIT_LDFLAGS) \
                -o $@ $(filter-out %.a,$^)              \
                -loskit_clientos -loskit_fsnamespace \
                -loskit_freebsd_dev \
                -loskit_linux_dev -loskit_dev \
                -loskit_diskpart \
                -loskit_kern -loskit_lmm -loskit_memfs \
                -loskit_linux_fs \
                $(CLIB) $(OBJDIR)/lib/crtn.o
<<

note that my OSKIT_CFLAGS includes -g.

>>
neal@school:~/kernel$ make
gcc -c -o kernel.o -DOSKIT -g -MD -DHAVE_CONFIG_H  -DOSKIT_X86 -DOSKIT_X86_PC -DDEBUG -I. -I../oskit-20000202/examples/x86 -I../oskit-20000202/examples/x86/extended -I../oskit-20000202/examples/x86/more -I../oskit-20000202/examples/x86/shared -I.  -I- -I../oskit-20000202/freebsd/libc/include -I../oskit-20000202/freebsd/3.x/src/include -I../oskit-20000202/freebsd/3.x/src/sys -I../oskit-20000202/freebsd/3.x/src/lib/libc/i386 -I../oskit-20000202/build/freebsd/libc/objinclude -I../oskit-20000202/examples/x86/shared -I../oskit-20000202/build -I../oskit-20000202 -nostdinc -Wall -fno-strict-aliasing -O -g  kernel.c
ld -Ttext 100000  -static -L../oskit-20000202/build/lib \
        -o kernel ../oskit-20000202/build/lib/multiboot.o kernel.o parser.o bin.o hash_table.o lex.o program.o symbol_table.o yyerror.o         \
        -loskit_clientos -loskit_fsnamespace \
        -loskit_freebsd_dev \
        -loskit_linux_dev -loskit_dev \
        -loskit_diskpart \
        -loskit_kern -loskit_lmm -loskit_memfs \
        -loskit_linux_fs \
        -loskit_freebsd_c -loskit_com -loskit_freebsd_c ../oskit-20000202/build/lib/crtn.o
<<

In the kernel, I have the following code after all of the initialization:

>>
  /* Start debugging */
  printf("Starting debugging\n");
  gdb_pc_com_init(1, 0);
  printf("Installed debugging support\n");
  printf("Installing break point\n");
  gdb_breakpoint();
  printf("Got past breakpoint\n");
<<


Upon booting the kernel, I get to the point where it outputs:

>>
Starting debugging
Installed debugging support
Installing break point
<<

The kernel has now stopped.  When I attach to the process from gdb:

>>
neal@school:~/kernel$ gdb kernel
GNU gdb 19990928
Copyright 1998 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 "i686-pc-linux-gnu"...
(gdb) target remote /dev/ttyS0
Remote debugging using /dev/ttyS0
0x0 in ?? ()
(gdb) p main
$1 = {int (int, char **)} 0x1000c4 <main>
(gdb) c
Continuing.
<<

I can continue the execution the the kernel, as shown. The kernel will
print out ``Got past breakpoint'' and start the shell,  However, I can
neither access symbols or use control-C to stop the execution of the
kernel.

Any ideas would be greatly appreciated.

Thank you in advance,
-Neal

-- 
----------------------------------------------------------------------------
Neal Walfield                                            nwalfiel@cs.uml.edu
UMass Lowell - Fox 1512                                  Phone: 978-934-5347
                                                           Fax: 603-415-3645
Love is the triumph of imagination over intelligence.
                -- H. L. Mencken