Skip to contentSkip to conversation

uml and gdb debugging questions

uml-devel Miao Qingjun 3 participants 4 messages Jul 12, 2006 – Jul 14, 2006 User-mode Linux (UML)

lore
Share & tools
lore
#0 lore raw

Hi,

I have several problems about uml-2.6.17 and gdb debugging.

I start "gdb uml", "b sys_init_module", then "run", but gdb is not break at sys_init_module() when I insmod LKM? Why? How can I do it?

When I type control-c in gdb, the virtual console xterm is also closed, I just want to enter gdb command line to single step kernel code, how can I do it?

thanks!

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642

_______________________________________________
User-mode-linux-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

#1 lore raw
Quoted 7 lines · Miao Qingjun

Hi,

I have several problems about uml-2.6.17 and gdb debugging.

I start "gdb uml", "b sys_init_module", then "run", but gdb is not break at sys_init_module() when I insmod LKM? Why? How can I do it?

Sometimes breakpoints don't work in GDB :-(. An hack was posted: it was based on recompiling after adding code calling pause() if a variable was set and setting the variable only from the debugger; however some special care was needed to avoid gcc recognizing nobody set the variable and optimizing the check out.

Quoted 1 line

When I type control-c in gdb, the virtual console xterm is also closed,

This doesn't happen here for what I remember, I used both Ctrl-C and kill -INT <main pid> to get back the control in the console.

Quoted 2 lines

I just want to enter gdb command line to single step kernel code, how can I do it?

Signature · 17 lines
Inform me of my mistakes, so I can keep imitating Homer Simpson's "Doh!".
Paolo Giarrusso, aka Blaisorblade
http://www.user-mode-linux.org/~blaisorblade
Chiacchiera con i tuoi amici in tempo reale! 
 http://it.yahoo.com/mail_it/foot/*http://it.messenger.yahoo.com 



-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
User-mode-linux-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel
#2 lore raw
In reply to Miao Qingjun
Quoted 3 lines · Miao Qingjun

I start "gdb uml", "b sys_init_module", then "run", but gdb is not break at sys_init_module() when I insmod LKM? Why? How can I do it?

Some versions of gdb don't work well on UML. One thing that often works is to attach to UML when it's booted, just before doing whatever you want to debug.

Jeff

Quoted 2 lines

When I type control-c in gdb, the virtual console xterm is also closed,

How are you running UML? You normally can't ^C to get back to gdb because the UML console has put the terminal in raw mode, so it can see ^C, ^Z, etc and pass them along to the UML foreground process.

What I normally do is kill -INT <pid>, where pid is the lowest UML pid.

Jeff

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
User-mode-linux-devel mailing list [email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

#3 lore raw
Quoted 14 lines · Jeff Dike
Quoted 3 lines · Miao Qingjun

I start "gdb uml", "b sys_init_module", then "run", but gdb is not break at sys_init_module() when I insmod LKM? Why? How can I do it?

Some versions of gdb don't work well on UML. One thing that often works is to attach to UML when it's booted, just before doing whatever you want to debug.

Jeff

Quoted 2 lines

When I type control-c in gdb, the virtual console xterm is also closed,

Quoted 6 lines

How are you running UML? You normally can't ^C to get back to gdb because the UML console has put the terminal in raw mode, so it can see ^C, ^Z, etc and pass them along to the UML foreground process.

What I normally do is kill -INT <pid>, where pid is the lowest UML pid.

I forgot one note - I either attach gdb to UML after boot or boot it with con0 redirected away from fd:0,fd:1.
And I often find that setting a breakpoint after UML has fully booted works better than setting it before boot. A lot better.

Signature · 17 lines
Inform me of my mistakes, so I can keep imitating Homer Simpson's "Doh!".
Paolo Giarrusso, aka Blaisorblade
http://www.user-mode-linux.org/~blaisorblade
Chiacchiera con i tuoi amici in tempo reale! 
 http://it.yahoo.com/mail_it/foot/*http://it.messenger.yahoo.com 



-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
User-mode-linux-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel