Skip to contentSkip to conversation

How to debug Linux kernel on qemu with kgdb?

Qemu-devel Neo Jia 2 participants 12 messages Apr 25, 2007

lore
Share & tools
lore

Neo Jia

author
#0 lore raw

hi,

I am trying to use debug kgdb patched linux kernel on my qemu. Both the native and target platform are IA32. I am wondering if there is anyone can show me the procedure?

Thanks,
Neo

Signature · 2 lines
I would remember that if researchers were not ambitious
probably today we haven't the technology we are using!
author
#2 lore raw
Quoted 10 lines · Jan Kiszka
Quoted 5 lines · Neo Jia

hi,

I am trying to use debug kgdb patched linux kernel on my qemu. Both the native and target platform are IA32. I am wondering if there is anyone can show me the procedure?

Yep, see https://mail.gna.org/public/xenomai-core/2006-09/msg00202.html

(BTW, I think that kgdb bug is still unfixed - I never got a feedback.)

I can connect gdb through /dev/pts/XX. My qemu is lanuched by

qemu -nographic -hda linux.img -kernel ./2.6.15.5-kgdb/vmlinuz-2.6.15.5-kgdb -serial pty -append "kgdbwait console=ttyS0 root=/dev/hda sb=0x220,5,1,5 ide2=noprobe ide3=noprobe ide4=noprobe ide5=noprobe"

Do you know where can I get the console output?

I would like to work out kgdb + qemu to debug linux kernel.

Thanks,
Neo

Quoted 5 lines

Jan

Signature · 2 lines
I would remember that if researchers were not ambitious
probably today we haven't the technology we are using!
author
#3 lore raw
Quoted 19 lines · Neo Jia
Quoted 10 lines · Jan Kiszka
Quoted 5 lines · Neo Jia

hi,

I am trying to use debug kgdb patched linux kernel on my qemu. Both the native and target platform are IA32. I am wondering if there is anyone can show me the procedure?

Yep, see https://mail.gna.org/public/xenomai-core/2006-09/msg00202.html

(BTW, I think that kgdb bug is still unfixed - I never got a feedback.)

I can connect gdb through /dev/pts/XX. My qemu is lanuched by

qemu -nographic -hda linux.img -kernel ./2.6.15.5-kgdb/vmlinuz-2.6.15.5-kgdb -serial pty -append "kgdbwait console=ttyS0 root=/dev/hda sb=0x220,5,1,5 ide2=noprobe ide3=noprobe ide4=noprobe ide5=noprobe"

Quoted 7 lines

Do you know where can I get the console output?

I would like to work out kgdb + qemu to debug linux kernel.

Thanks,
Neo

BTW, the error message I got is "Program terminated with signal 0, Signal 0."

Thanks,
Neo

Quoted 11 lines
Quoted 5 lines

Jan

--
I would remember that if researchers were not ambitious probably today we haven't the technology we are using!

Signature · 2 lines
I would remember that if researchers were not ambitious
probably today we haven't the technology we are using!
#4 lore raw
In reply to Neo Jia
Quoted 12 lines · Neo Jia
Quoted 10 lines · Jan Kiszka
Quoted 5 lines · Neo Jia

hi,

I am trying to use debug kgdb patched linux kernel on my qemu. Both the native and target platform are IA32. I am wondering if there is anyone can show me the procedure?

Yep, see https://mail.gna.org/public/xenomai-core/2006-09/msg00202.html

(BTW, I think that kgdb bug is still unfixed - I never got a feedback.)

Quoted 9 lines

I can connect gdb through /dev/pts/XX. My qemu is lanuched by

qemu -nographic -hda linux.img -kernel ./2.6.15.5-kgdb/vmlinuz-2.6.15.5-kgdb -serial pty -append "kgdbwait console=ttyS0 root=/dev/hda sb=0x220,5,1,5 ide2=noprobe ide3=noprobe ide4=noprobe ide5=noprobe"

Do you know where can I get the console output?

Use "... -serial stdio -serial pty ..." and attached kgdb to the second serial port (I think to recall that is default anyway). The first one is then used for the kernel console.

Quoted 1 line

I would like to work out kgdb + qemu to debug linux kernel.

??? So you really want to debug the kernel when kgdb is applied, ie. actually debug kgdb? If you only intend to debug the kernel itself, qemu -s + gdb is enough.

Jan

author
#5 lore raw
Quoted 27 lines · Jan Kiszka
Quoted 12 lines · Neo Jia
Quoted 10 lines · Jan Kiszka
Quoted 5 lines · Neo Jia

hi,

I am trying to use debug kgdb patched linux kernel on my qemu. Both the native and target platform are IA32. I am wondering if there is anyone can show me the procedure?

Yep, see https://mail.gna.org/public/xenomai-core/2006-09/msg00202.html

(BTW, I think that kgdb bug is still unfixed - I never got a feedback.)

Quoted 9 lines

I can connect gdb through /dev/pts/XX. My qemu is lanuched by

qemu -nographic -hda linux.img -kernel ./2.6.15.5-kgdb/vmlinuz-2.6.15.5-kgdb -serial pty -append "kgdbwait console=ttyS0 root=/dev/hda sb=0x220,5,1,5 ide2=noprobe ide3=noprobe ide4=noprobe ide5=noprobe"

Do you know where can I get the console output?

Use "... -serial stdio -serial pty ..." and attached kgdb to the second serial port (I think to recall that is default anyway). The first one is then used for the kernel console.

Quoted 5 lines
Quoted 1 line

I would like to work out kgdb + qemu to debug linux kernel.

??? So you really want to debug the kernel when kgdb is applied, ie. actually debug kgdb? If you only intend to debug the kernel itself, qemu -s + gdb is enough.

Jan,

I just would like to debug kernel itself. I have tried qemu -s + gdb but it keeps
getting "apic_timer_interrupt" when I am using "n" command.

The following is the output:

Quoted 1 line

gdb vmlinux

GNU gdb 6.5.50.20060621-cvs
Copyright (C) 2006 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"...Using host libthread_db library "/lib/tls/libthread_db.so.1".

(gdb) target remote localhost:1234
Remote debugging using localhost:1234
0x0000fff0 in ?? ()
warning: shared library handler failed to enable breakpoint (gdb) c
Continuing.

Program received signal SIGINT, Interrupt.
default_idle () at include/asm/bitops.h:252
252 return ((1UL << (nr & 31)) & (addr[nr >> 5])) != 0;
(gdb) b sys_ex
sys_execve sys_exit sys_exit_group
(gdb) b sys_execve
Breakpoint 1 at 0xc0101ac1: file arch/i386/kernel/process.c, line 791. (gdb) c
Continuing.

Breakpoint 1, sys_execve (regs=

     {ebx = 135197704, ecx = 135197864, edx = 135244936, esi =

135197704, edi = 135197704, ebp = -1079176984, eax = 11, xds = 123, xes = 123, orig_eax = 11, eip = -1208835017, xcs = 115, eflags = 582, esp = -1079177012, xss = 123})
at arch/i386/kernel/process.c:791
791 filename = getname((char __user *) regs.ebx);
(gdb) n
0xc0103666 in apic_timer_interrupt () at include/asm/current.h:9
9 {
(gdb) quit

Thanks,
Neo

Quoted 5 lines

Jan

Signature · 2 lines
I would remember that if researchers were not ambitious
probably today we haven't the technology we are using!
#6 lore raw
Quoted 75 lines · Neo Jia
Quoted 29 lines · Jan Kiszka
Quoted 9 lines · Neo Jia
Quoted 8 lines · Jan Kiszka
Quoted 5 lines · Neo Jia

hi,

I am trying to use debug kgdb patched linux kernel on my qemu. Both the native and target platform are IA32. I am wondering if there is anyone can show me the procedure?

Yep, see

https://mail.gna.org/public/xenomai-core/2006-09/msg00202.html

Quoted 2 lines
Quoted 2 lines

(BTW, I think that kgdb bug is still unfixed - I never got a

feedback.)

Quoted 10 lines

I can connect gdb through /dev/pts/XX. My qemu is lanuched by

qemu -nographic -hda linux.img -kernel ./2.6.15.5-kgdb/vmlinuz-2.6.15.5-kgdb -serial pty -append "kgdbwait console=ttyS0 root=/dev/hda sb=0x220,5,1,5 ide2=noprobe ide3=noprobe ide4=noprobe ide5=noprobe"

Do you know where can I get the console output?

Use "... -serial stdio -serial pty ..." and attached kgdb to the second serial port (I think to recall that is default anyway). The first one is then used for the kernel console.

Quoted 5 lines
Quoted 1 line

I would like to work out kgdb + qemu to debug linux kernel.

??? So you really want to debug the kernel when kgdb is applied, ie. actually debug kgdb? If you only intend to debug the kernel itself, qemu -s + gdb is enough.

Jan,

I just would like to debug kernel itself. I have tried qemu -s + gdb but it keeps
getting "apic_timer_interrupt" when I am using "n" command.

The following is the output:

Quoted 1 line

gdb vmlinux

GNU gdb 6.5.50.20060621-cvs
Copyright (C) 2006 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"...Using host libthread_db library "/lib/tls/libthread_db.so.1".

(gdb) target remote localhost:1234
Remote debugging using localhost:1234
0x0000fff0 in ?? ()
warning: shared library handler failed to enable breakpoint (gdb) c
Continuing.

Program received signal SIGINT, Interrupt.
default_idle () at include/asm/bitops.h:252
252 return ((1UL << (nr & 31)) & (addr[nr >> 5])) != 0;
(gdb) b sys_ex
sys_execve sys_exit sys_exit_group
(gdb) b sys_execve
Breakpoint 1 at 0xc0101ac1: file arch/i386/kernel/process.c, line 791. (gdb) c
Continuing.

Breakpoint 1, sys_execve (regs=

     {ebx = 135197704, ecx = 135197864, edx = 135244936, esi =
Quoted 8 lines

135197704, edi = 135197704, ebp = -1079176984, eax = 11, xds = 123, xes = 123, orig_eax = 11, eip = -1208835017, xcs = 115, eflags = 582, esp = -1079177012, xss = 123})
at arch/i386/kernel/process.c:791
791 filename = getname((char __user *) regs.ebx);
(gdb) n
0xc0103666 in apic_timer_interrupt () at include/asm/current.h:9
9 {

That's normal. You stopped the kernel in sys_execve with interrupts enabled. When continuing, qemu replays any pending interrupts, here the timer. Thus your next instruction is not in sys_execve, but in the interrupt handler. You can try finish then and hope that you will return to the next line in sys_execve, or you put another breakpoint at the next interesting spot and just issue continue.

Jan

PS: Using kgdb from inside qemu should work (at least it once did for me), but it is really sloooow.

author
#7 lore raw
Quoted 92 lines · Jan Kiszka
Quoted 75 lines · Neo Jia
Quoted 29 lines · Jan Kiszka
Quoted 9 lines · Neo Jia
Quoted 8 lines · Jan Kiszka
Quoted 5 lines · Neo Jia

hi,

I am trying to use debug kgdb patched linux kernel on my qemu. Both the native and target platform are IA32. I am wondering if there is anyone can show me the procedure?

Yep, see

https://mail.gna.org/public/xenomai-core/2006-09/msg00202.html

Quoted 2 lines
Quoted 2 lines

(BTW, I think that kgdb bug is still unfixed - I never got a

feedback.)

Quoted 10 lines

I can connect gdb through /dev/pts/XX. My qemu is lanuched by

qemu -nographic -hda linux.img -kernel ./2.6.15.5-kgdb/vmlinuz-2.6.15.5-kgdb -serial pty -append "kgdbwait console=ttyS0 root=/dev/hda sb=0x220,5,1,5 ide2=noprobe ide3=noprobe ide4=noprobe ide5=noprobe"

Do you know where can I get the console output?

Use "... -serial stdio -serial pty ..." and attached kgdb to the second serial port (I think to recall that is default anyway). The first one is then used for the kernel console.

Quoted 5 lines
Quoted 1 line

I would like to work out kgdb + qemu to debug linux kernel.

??? So you really want to debug the kernel when kgdb is applied, ie. actually debug kgdb? If you only intend to debug the kernel itself, qemu -s + gdb is enough.

Jan,

I just would like to debug kernel itself. I have tried qemu -s + gdb but it keeps
getting "apic_timer_interrupt" when I am using "n" command.

The following is the output:

Quoted 1 line

gdb vmlinux

GNU gdb 6.5.50.20060621-cvs
Copyright (C) 2006 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"...Using host libthread_db library "/lib/tls/libthread_db.so.1".

(gdb) target remote localhost:1234
Remote debugging using localhost:1234
0x0000fff0 in ?? ()
warning: shared library handler failed to enable breakpoint (gdb) c
Continuing.

Program received signal SIGINT, Interrupt.
default_idle () at include/asm/bitops.h:252
252 return ((1UL << (nr & 31)) & (addr[nr >> 5])) != 0;
(gdb) b sys_ex
sys_execve sys_exit sys_exit_group
(gdb) b sys_execve
Breakpoint 1 at 0xc0101ac1: file arch/i386/kernel/process.c, line 791. (gdb) c
Continuing.

Breakpoint 1, sys_execve (regs=

     {ebx = 135197704, ecx = 135197864, edx = 135244936, esi =
Quoted 8 lines

135197704, edi = 135197704, ebp = -1079176984, eax = 11, xds = 123, xes = 123, orig_eax = 11, eip = -1208835017, xcs = 115, eflags = 582, esp = -1079177012, xss = 123})
at arch/i386/kernel/process.c:791
791 filename = getname((char __user *) regs.ebx);
(gdb) n
0xc0103666 in apic_timer_interrupt () at include/asm/current.h:9
9 {

That's normal. You stopped the kernel in sys_execve with interrupts enabled. When continuing, qemu replays any pending interrupts, here the timer. Thus your next instruction is not in sys_execve, but in the interrupt handler. You can try finish then and hope that you will return to the next line in sys_execve, or you put another breakpoint at the next interesting spot and just issue continue.

Quoted 6 lines

Jan

PS: Using kgdb from inside qemu should work (at least it once did for me), but it is really sloooow.

Could you show me the procedure you did? I just want to use this to learn kernel code.

Thanks,
Neo

Quoted 2 lines
Signature · 2 lines
I would remember that if researchers were not ambitious
probably today we haven't the technology we are using!
#8 lore raw
Quoted 103 lines · Neo Jia
Quoted 102 lines · Jan Kiszka
Quoted 7 lines · Neo Jia
Quoted 6 lines · Jan Kiszka
Quoted 5 lines · Neo Jia
Quoted 4 lines · Jan Kiszka
Quoted 3 lines · Neo Jia

hi,

I am trying to use debug kgdb patched linux kernel on my qemu.

Both

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

the native and target platform are IA32. I am wondering if

there is

Quoted 15 lines
Quoted 15 lines
Quoted 3 lines
Quoted 3 lines
Quoted 1 line

anyone can show me the procedure?

Yep, see

https://mail.gna.org/public/xenomai-core/2006-09/msg00202.html

Quoted 2 lines
Quoted 2 lines

(BTW, I think that kgdb bug is still unfixed - I never got a

feedback.)

Quoted 8 lines

I can connect gdb through /dev/pts/XX. My qemu is lanuched by

qemu -nographic -hda linux.img -kernel ./2.6.15.5-kgdb/vmlinuz-2.6.15.5-kgdb -serial pty -append "kgdbwait console=ttyS0 root=/dev/hda sb=0x220,5,1,5 ide2=noprobe ide3=noprobe ide4=noprobe ide5=noprobe"

Quoted 4 lines
Quoted 4 lines
Quoted 2 lines

Do you know where can I get the console output?

Use "... -serial stdio -serial pty ..." and attached kgdb to the

second

Quoted 1 line
Quoted 1 line

serial port (I think to recall that is default anyway). The first

one is

Quoted 6 lines
Quoted 6 lines

then used for the kernel console.

Quoted 1 line

I would like to work out kgdb + qemu to debug linux kernel.

??? So you really want to debug the kernel when kgdb is applied, ie. actually debug kgdb? If you only intend to debug the kernel itself,

qemu

Quoted 8 lines
Quoted 1 line

-s + gdb is enough.

Jan,

I just would like to debug kernel itself. I have tried qemu -s + gdb but it keeps
getting "apic_timer_interrupt" when I am using "n" command.

Quoted 6 lines

The following is the output:

Quoted 1 line

gdb vmlinux

GNU gdb 6.5.50.20060621-cvs
Copyright (C) 2006 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and

you

Quoted 5 lines

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.

Quoted 22 lines

This GDB was configured as "i686-pc-linux-gnu"...Using host libthread_db library "/lib/tls/libthread_db.so.1".

(gdb) target remote localhost:1234
Remote debugging using localhost:1234
0x0000fff0 in ?? ()
warning: shared library handler failed to enable breakpoint (gdb) c
Continuing.

Program received signal SIGINT, Interrupt.
default_idle () at include/asm/bitops.h:252
252 return ((1UL << (nr & 31)) & (addr[nr >> 5])) != 0;
(gdb) b sys_ex
sys_execve sys_exit sys_exit_group
(gdb) b sys_execve
Breakpoint 1 at 0xc0101ac1: file arch/i386/kernel/process.c, line 791. (gdb) c
Continuing.

Breakpoint 1, sys_execve (regs=

     {ebx = 135197704, ecx = 135197864, edx = 135244936, esi =
Quoted 8 lines

135197704, edi = 135197704, ebp = -1079176984, eax = 11, xds = 123, xes = 123, orig_eax = 11, eip = -1208835017, xcs = 115, eflags = 582, esp = -1079177012, xss = 123})
at arch/i386/kernel/process.c:791
791 filename = getname((char __user *) regs.ebx);
(gdb) n
0xc0103666 in apic_timer_interrupt () at include/asm/current.h:9
9 {

That's normal. You stopped the kernel in sys_execve with interrupts enabled. When continuing, qemu replays any pending interrupts, here the timer. Thus your next instruction is not in sys_execve, but in the interrupt handler. You can try finish then and hope that you will return to the next line in sys_execve, or you put another breakpoint at the next interesting spot and just issue continue.

Jan

Quoted 6 lines
Quoted 3 lines

PS: Using kgdb from inside qemu should work (at least it once did for me), but it is really sloooow.

Could you show me the procedure you did? I just want to use this to learn kernel code.

Did you redirect kgdb to ttyS1?

Jan

author
#9 lore raw
Quoted 104 lines · Jan Kiszka
Quoted 103 lines · Neo Jia
Quoted 102 lines · Jan Kiszka
Quoted 7 lines · Neo Jia
Quoted 6 lines · Jan Kiszka
Quoted 5 lines · Neo Jia
Quoted 4 lines · Jan Kiszka
Quoted 3 lines · Neo Jia

hi,

I am trying to use debug kgdb patched linux kernel on my qemu.

Both

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

the native and target platform are IA32. I am wondering if

there is

Quoted 15 lines
Quoted 15 lines
Quoted 3 lines
Quoted 3 lines
Quoted 1 line

anyone can show me the procedure?

Yep, see

https://mail.gna.org/public/xenomai-core/2006-09/msg00202.html

Quoted 2 lines
Quoted 2 lines

(BTW, I think that kgdb bug is still unfixed - I never got a

feedback.)

Quoted 8 lines

I can connect gdb through /dev/pts/XX. My qemu is lanuched by

qemu -nographic -hda linux.img -kernel ./2.6.15.5-kgdb/vmlinuz-2.6.15.5-kgdb -serial pty -append "kgdbwait console=ttyS0 root=/dev/hda sb=0x220,5,1,5 ide2=noprobe ide3=noprobe ide4=noprobe ide5=noprobe"

Quoted 4 lines
Quoted 4 lines
Quoted 2 lines

Do you know where can I get the console output?

Use "... -serial stdio -serial pty ..." and attached kgdb to the

second

Quoted 1 line
Quoted 1 line

serial port (I think to recall that is default anyway). The first

one is

Quoted 6 lines
Quoted 6 lines

then used for the kernel console.

Quoted 1 line

I would like to work out kgdb + qemu to debug linux kernel.

??? So you really want to debug the kernel when kgdb is applied, ie. actually debug kgdb? If you only intend to debug the kernel itself,

qemu

Quoted 8 lines
Quoted 1 line

-s + gdb is enough.

Jan,

I just would like to debug kernel itself. I have tried qemu -s + gdb but it keeps
getting "apic_timer_interrupt" when I am using "n" command.

Quoted 6 lines

The following is the output:

Quoted 1 line

gdb vmlinux

GNU gdb 6.5.50.20060621-cvs
Copyright (C) 2006 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and

you

Quoted 5 lines

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.

Quoted 22 lines

This GDB was configured as "i686-pc-linux-gnu"...Using host libthread_db library "/lib/tls/libthread_db.so.1".

(gdb) target remote localhost:1234
Remote debugging using localhost:1234
0x0000fff0 in ?? ()
warning: shared library handler failed to enable breakpoint (gdb) c
Continuing.

Program received signal SIGINT, Interrupt.
default_idle () at include/asm/bitops.h:252
252 return ((1UL << (nr & 31)) & (addr[nr >> 5])) != 0;
(gdb) b sys_ex
sys_execve sys_exit sys_exit_group
(gdb) b sys_execve
Breakpoint 1 at 0xc0101ac1: file arch/i386/kernel/process.c, line 791. (gdb) c
Continuing.

Breakpoint 1, sys_execve (regs=

     {ebx = 135197704, ecx = 135197864, edx = 135244936, esi =
Quoted 8 lines

135197704, edi = 135197704, ebp = -1079176984, eax = 11, xds = 123, xes = 123, orig_eax = 11, eip = -1208835017, xcs = 115, eflags = 582, esp = -1079177012, xss = 123})
at arch/i386/kernel/process.c:791
791 filename = getname((char __user *) regs.ebx);
(gdb) n
0xc0103666 in apic_timer_interrupt () at include/asm/current.h:9
9 {

That's normal. You stopped the kernel in sys_execve with interrupts enabled. When continuing, qemu replays any pending interrupts, here the timer. Thus your next instruction is not in sys_execve, but in the interrupt handler. You can try finish then and hope that you will return to the next line in sys_execve, or you put another breakpoint at the next interesting spot and just issue continue.

Jan

Quoted 8 lines
Quoted 6 lines
Quoted 3 lines

PS: Using kgdb from inside qemu should work (at least it once did for me), but it is really sloooow.

Could you show me the procedure you did? I just want to use this to learn kernel code.

Did you redirect kgdb to ttyS1?

Yes, I just redirect kgdb to ttyS1 but still nothing. But if I compiled with "CONFIG_KGDB_CONSOLE=y", it will show on the gdb console.

Is a bug or wrong configuration?

Thanks,
Neo

Quoted 5 lines

Jan

Signature · 2 lines
I would remember that if researchers were not ambitious
probably today we haven't the technology we are using!
author
#10 lore raw
In reply to Jan Kiszka
Quoted 20 lines · Jan Kiszka
Quoted 19 lines · Neo Jia
Quoted 10 lines · Jan Kiszka
Quoted 5 lines · Neo Jia

hi,

I am trying to use debug kgdb patched linux kernel on my qemu. Both the native and target platform are IA32. I am wondering if there is anyone can show me the procedure?

Yep, see https://mail.gna.org/public/xenomai-core/2006-09/msg00202.html

(BTW, I think that kgdb bug is still unfixed - I never got a feedback.)

I can connect gdb through /dev/pts/XX. My qemu is lanuched by

qemu -nographic -hda linux.img -kernel ./2.6.15.5-kgdb/vmlinuz-2.6.15.5-kgdb -serial pty -append "kgdbwait console=ttyS0 root=/dev/hda sb=0x220,5,1,5 ide2=noprobe ide3=noprobe ide4=noprobe ide5=noprobe"

Quoted 6 lines
Quoted 2 lines

Do you know where can I get the console output?

Use "... -serial stdio -serial pty ..." and attached kgdb to the second serial port (I think to recall that is default anyway). The first one is then used for the kernel console.

I also tried this but it seems that kgdb cannot connect to /dev/pts/XX with "-serial stdio".
I did anything wrong?

Thanks,
Neo

Quoted 11 lines
Quoted 2 lines

I would like to work out kgdb + qemu to debug linux kernel.

??? So you really want to debug the kernel when kgdb is applied, ie. actually debug kgdb? If you only intend to debug the kernel itself, qemu -s + gdb is enough.

Jan

Signature · 2 lines
I would remember that if researchers were not ambitious
probably today we haven't the technology we are using!
#11 lore raw
In reply to Jan Kiszka
Quoted 10 lines · Jan Kiszka
Quoted 5 lines · Neo Jia

hi,

I am trying to use debug kgdb patched linux kernel on my qemu. Both the native and target platform are IA32. I am wondering if there is anyone can show me the procedure?

Yep, see https://mail.gna.org/public/xenomai-core/2006-09/msg00202.html

(BTW, I think that kgdb bug is still unfixed - I never got a feedback.)

At the risk of becoming off-topic, but here is the actually related post on kgdb-bugreport:

http://sourceforge.net/mailarchive/message.php?msg_id=45201805.3090603%40web.de

Jan