LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices

Reply
 
Search this Thread
Old 04-28-2009, 09:54 AM   #1
droneprime
LQ Newbie
 
Registered: Aug 2008
Location: /dev/null
Distribution: Gentoo at home. Everything at work.
Posts: 24

Rep: Reputation: 15
2.6.27 - Trying to debug modules with KGDB


I am trying to use KGDB over serial in a 2.6.27.7-9 kernel for debugging a module. KGDB comes built-in with this kernel.
I want to debug a module. I have built the module with ‘-g3’ and ‘-O0’ options in the Makefile.
The kernel on the target machine was built on the development machine, with the source for the module in [kernel-source]/drivers/scsi/[module]/
I moved the vmlinuz, initrd, System.map and /lib/modules/[kernel-name] over to the target machine.
The target kernel boots, waits for GDB on the host side, and responds to ‘continue’ on the host side.
I am able to SysRq+g on the target to interrupt after the module of interest has been loaded. That returns control to GDB on the host.
At that point I am able to ‘add-symbol-file [path] [.text address]’ and the symbols load successfully.
I can then set a desired breakpoint using the symbols that I am interested in.
Then I hit continue on the development machine, and that lets the target continue booting.
Once the target completes booting, I run a test program that will trip that breakpoint by using that module.
It is at this point that the target locks up, as though the breakpoint has been tripped. However, the development machine does not return the GDB prompt to me. It just stays locked up with no prompt.

Do you have any idea what the problem is?

Thanks in advance.

P.S.
I Think I am using GDBMOD 2.4 from Amit Kale's site. I built the GDBMOD source and did a make install and that placed a 'gdb' in '/usr/local/bin'. I don't think that was there before, seeing as I made sure to install gdb at the time SUSE was installed.

'set solib-search-path [driver ko path]' does nothing (info sharedlibraries).

Last edited by droneprime; 04-28-2009 at 11:19 AM.
 
Old 04-29-2009, 10:59 AM   #2
droneprime
LQ Newbie
 
Registered: Aug 2008
Location: /dev/null
Distribution: Gentoo at home. Everything at work.
Posts: 24

Original Poster
Rep: Reputation: 15
Breakthrough

For anyone that might care:
I solved my problem. SUSE was resetting the tty baud rate when Gnome started running.

Code:
stty -F /dev/ttyS0 [desired speed]
That fixes the whole thing.
Happy Hacking!
 
Old 06-25-2009, 04:44 AM   #3
curious_linux
LQ Newbie
 
Registered: Jun 2009
Posts: 5

Rep: Reputation: 0
Hi,
I am trying to use kgdb for 2.6.28.6 for ARM architecture.
kgdbwait does not seem to work for me?
Can you tell me what is the exact kernel command line parameter for the same to use kgdboc with kgdbwait (Hang with "Waiting for connection from remote gdb...")?
Do I need to apply any patch if I want to use kgdboe since I could not find any code related to kgdb over ethernet in kernel sources?
 
Old 06-26-2009, 09:58 AM   #4
droneprime
LQ Newbie
 
Registered: Aug 2008
Location: /dev/null
Distribution: Gentoo at home. Everything at work.
Posts: 24

Original Poster
Rep: Reputation: 15
I have no idea about kgdboe. that seemed like another can of worms that i didn't want to open.

The following is the boot parameter string that I use. I haven't had the time to test and see if I have any redundant/unnecessary tags in there...
But yea, this line works for me.

Code:
kgdb=/dev/ttyS0,38400N8 kgdb8250=/dev/ttyS0,38400N8 kgdboc=/dev/ttyS0,38400N8 kgdbwait
That should stop the running kernel in it's tracks.

Best of Luck.
 
Old 06-27-2009, 01:04 PM   #5
curious_linux
LQ Newbie
 
Registered: Jun 2009
Posts: 5

Rep: Reputation: 0
Hi,
Thanks for your reply....
I will try it...
38400N8 is Baud rate right?
 
Old 06-28-2009, 02:00 PM   #6
droneprime
LQ Newbie
 
Registered: Aug 2008
Location: /dev/null
Distribution: Gentoo at home. Everything at work.
Posts: 24

Original Poster
Rep: Reputation: 15
Actually remove:
Code:
/dev/
from each of my responses.
 
Old 06-28-2009, 11:22 PM   #7
curious_linux
LQ Newbie
 
Registered: Jun 2009
Posts: 5

Rep: Reputation: 0
I tried with "kgdboc=ttyS0,115200 kgdbwait" as boot option.
I also enabled kernel hacking->KGDB-kernel debugging with remote GDB->KGDB-use KGDB over serial console.
But still it didn't seem to work. Do I need to enable anything else...?
I will try "kgdb8250" option also.
 
Old 06-28-2009, 11:55 PM   #8
curious_linux
LQ Newbie
 
Registered: Jun 2009
Posts: 5

Rep: Reputation: 0
I even tried with kgdb8250 option but still it is not working.
I am using ARM as an architecture. Do I need to make any other changes for that?
 
Old 07-01-2009, 12:27 PM   #9
droneprime
LQ Newbie
 
Registered: Aug 2008
Location: /dev/null
Distribution: Gentoo at home. Everything at work.
Posts: 24

Original Poster
Rep: Reputation: 15
I have no idea about what you would need to do for the ARM architecture...
It might just not work, I have not had much luck with KGDB at any point along the way.

Try:
"kdgb=ttyS0,115200N8 kgdboc=ttyS0,115200N8 kgdbwait"
 
Old 07-01-2009, 11:39 PM   #10
curious_linux
LQ Newbie
 
Registered: Jun 2009
Posts: 5

Rep: Reputation: 0
ok
I will try it out....
What does N in 115200N stand for? Any idea?
Actually I am using ARM board and Minicom to connec to the board, I want to do some driver testing for the board.
Thanks for your help.
 
Old 07-06-2009, 04:17 PM   #11
droneprime
LQ Newbie
 
Registered: Aug 2008
Location: /dev/null
Distribution: Gentoo at home. Everything at work.
Posts: 24

Original Poster
Rep: Reputation: 15
'N' stands for "No parity".
The '8' after is for 8 data-bits per character.
 
  


Reply

Tags
debugging, kernel


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to debug without having debug section in an executable ? unclesam Linux - Newbie 0 02-02-2006 06:23 AM
debug loadable modules with kgdb??? Igor007 Programming 0 09-09-2005 04:42 PM
[debug]what does the following debug information mean icoming Programming 21 06-08-2004 02:13 AM
Re: modprobe: Note: /etc/modules.conf is more recent than lib/modules/2.4.9/modules.d Andy.M Linux - General 1 01-24-2002 01:50 AM
Re: modprobe: Note: /etc/modules.conf is more recent than lib/modules/2.4.9/modules.d Andy.M Linux - Newbie 2 01-24-2002 01:40 AM


All times are GMT -5. The time now is 06:17 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration