LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 09-04-2009, 11:29 AM   #1
raycope14
LQ Newbie
 
Registered: Aug 2009
Posts: 8

Rep: Reputation: 0
Problem Debugging Kernel Module with KGDB


Dear LinuxQuestioners, I am having a problem debugging a kernel
loadable module (i.e., after insmod'ing a .ko module) using KGDB.

I have spent some time on the setup process just to make sure I have everything right to the best of my knowledge, but here is what I have come down to (close but no cigar yet):

1. Established kgdb session over serial link and successfully able to
break and single step on EMBEDDED routine (e.g., ./kernel/module.c).

2. Start up my target kernel under kgdb host control and able to
insmod the target module and added symbols using add-symbol-file
with target module object (.o) file OK. Note I got .text/.data/
.bss offsets from /sys/module/<target module>/sections as per
standard setup.

3. Used objdump -S -x <target module>.o command to verify target module
was compiled with debug symbols. Seems OK, meaning I see routine
names and source C-code information displayed.

4. Able to break on target module routine name OK. However, when I try
the gdb 'n' or 'list' commands, it says it has **no line number
information**. 'n' acts like 'cont' meanings it just runs through
the whole routine without stopping. 'stepi' works fine in dis-
asembly mode, so for temp workaround I am using stepi combined
with objdump information to debug but NEED FULLY SYMBOLIC SOURCE
CODE DEBUG facility to be really effective.

Any ideas, suggestions what might be wrong? Note I have spent a lot of
time on this and have tried all the basics including running from my native build machine as the kgdb host vs. tarring/un-tarring source code on host machine. Re:linux config, I have the following settings:

CONFIG_KGDB=y
CONFIG_KGDB_SERIAL_CONSOLE=y
CONFIG_PROC_KCORE=y
CONFIG_DEBUG_INFO=y

Any other config settings I might be missing to debug KLM's down-loadable modules)? Module was gcc compiled with -g and -O0 switch settings.

Thanks in advance for all replies.
 
Old 09-04-2009, 12:38 PM   #2
David1357
Senior Member
 
Registered: Aug 2007
Location: South Carolina, U.S.A.
Distribution: Ubuntu, Fedora Core, Red Hat, SUSE, Gentoo, DSL, coLinux, uClinux
Posts: 1,302
Blog Entries: 1

Rep: Reputation: 107Reputation: 107
Quote:
Originally Posted by raycope14 View Post
Any ideas, suggestions what might be wrong?
Someone else had the same problem: kgdb module debugging question
 
Old 09-08-2009, 11:46 AM   #3
raycope14
LQ Newbie
 
Registered: Aug 2009
Posts: 8

Original Poster
Rep: Reputation: 0
Thanks, that was a good post but not really the same problem. I have
no problem setting breakpoints and geting control back to gdb. My problem is I don't get any source code information after I insmod my .ko module and then do "add-symbol-file" as per standard procedure. I don't think it's necessary but I also tried the solib-search-path command directly on my source file, but that didn't do any good.

What's very strange to me is I can ***break on a routine name in my module but after I hit the breakpoint I can't single-step or list source file***. That's the problem I need to solve.
 
  


Reply


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
kgdb module debugging question vkmgeek Programming 5 09-30-2011 12:43 AM
KGDB Setting & Debugging Driver Module nickcheng Linux - Kernel 10 12-28-2009 12:14 PM
kgdb module debugging vkmgeek Programming 1 07-23-2008 05:41 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 01:04 PM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration