# Problem with qemu-kvm + gdb; No symbol name in gdb

## sandrain

I'm trying to trace Linux kernel using qemu-kvm and gdb.

I compiled the testing kernel with CONFIG_DEBUG_INFO=y. (linux-2.6.27-gentoo-r8 )

First up, I executed qemu-kvm like following:

```

qemu-kvm -net nic,macaddr=52:54:00:12:34:56,model=e1000 -net tap,ifname=tap0,script=no,downscript=no -m 256M -hda /home/sandrain/vm/gentoo/gentoo.vdi -snapshot -s -kernel arch/i386/boot/bzImage -append root=/dev/sda3

```

After the guest box booted successfully, I executed gdb like following:

```

me@localhost ~/vm/gentoo/kernel/linux-2.6.27-gentoo-r8 $ gdb vmlinux

warning: Can not parse XML syscalls information; XML support was disabled at compile time.

GNU gdb (Gentoo 7.0 p2) 7.0

Copyright (C) 2009 Free Software Foundation, Inc.

License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>

This is free software: you are free to change and redistribute it.

There is NO WARRANTY, to the extent permitted by law.  Type "show copying"

and "show warranty" for details.

This GDB was configured as "i686-pc-linux-gnu".

For bug reporting instructions, please see:

<http://bugs.gentoo.org/>...

Reading symbols from /home/sandrain/vm/gentoo/kernel/linux-2.6.27-gentoo-r8/vmlinux...done.

(gdb) target remote localhost:1234

Remote debugging using localhost:1234

0xc02084bf in ?? ()

(gdb) bt

#0  0xc02084bf in ?? ()

#1  0xc077bfc8 in ?? ()

#2  0xc02029f3 in ?? ()

#3  0x00000004 in ?? ()

#4  0x00020800 in ?? ()

#5  0xc0769000 in ?? ()

#6  0xc077bfd0 in ?? ()

#7  0xc0593e52 in ?? ()

#8  0xc077bfe0 in ?? ()

#9  0xc07827b2 in ?? ()

#10 0xc07b0094 in ?? ()

#11 0x00000000 in ?? ()

(gdb) next

Cannot find bounds of current function

(gdb) b sys_read

Breakpoint 1 at 0xc107d43b: file fs/read_write.c, line 338.

(gdb) continue

Continuing.

```

No function names are displayed in gdb. I like to follow the kernel source line by line, of course in C.

And breakpoint doesn't work, either.

Is there any problem with the connection between guest and host gdb? 

I think that there should be some connection between them, since the title of the qemu (guest) window changed to QEMU[Stopped]  when I executed the target remote... command in gdb. Guest box had been frozen until I gave continue command in gdb.

On the guest, gentoo is installed and everything (including network) works well.

I cannot figure out what causes the problem.

My host box:

```

2.6.31-gentoo-r6 #5 SMP PREEMPT, i686 AMD Athlon(tm) II X2 245 Processor AuthenticAMD GNU/Linux

```

,and guest box:

```

2.6.27-gentoo-r8 #5 SMP, i686 QEMU Virtual CPU version 0.12.3 AuthenticAMD GNU/Linux

```

Thanks.  :Very Happy: 

----------

## shajiyusuf

You can work around this problem by installing the more recent version of qemu - 0.12.50. You may have to compile it from source. Before compiling make sure that you have libsdl1.2-dev (the sdl development library)(Dont know if 1.2 is the latest version). You can install this using your package manager. 

After installing libsdl just do

    ./configure 

    make 

    make install 

on your qemu source. 

If you dont install libsdl you'll have to access your display over a vnc client.

Let me know if this works.

Cheers

Shaji Yusuf

----------

