LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
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 03-23-2015, 01:24 PM   #1
Feoggou
LQ Newbie
 
Registered: Mar 2015
Posts: 5

Rep: Reputation: Disabled
Debugging the Kernel?


Hello.

Can anybody please direct me / give me a link to, e.g. a tutorial, where I can learn how to debug the Linux Kernel from?

I want to set breakpoints, step over, step in, etc., into code of the linux kernel, not into a loadable module. The linux os target will be a VM, so the channel will need to be serial port / named pipe.

Additional questions I have:
1. Can gdb be used to debug the kernel as well? Or kdb is used only?
2. Can I drive the debugging from within some IDE? Or the debugger commands require that I stick to the terminal?
3. Does the debugger need debugging symbols in order to be able to interpret the binary? If yes, how do I do use them?

Thanks!
 
Old 03-23-2015, 01:34 PM   #2
smallpond
Senior Member
 
Registered: Feb 2011
Location: Massachusetts, USA
Distribution: Fedora
Posts: 4,138

Rep: Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263Reputation: 1263
Best place to start is the hacking guide in the kernel source in Documentation/DocBook/kernel-hacking.tmpl
 
Old 03-23-2015, 01:43 PM   #3
Feoggou
LQ Newbie
 
Registered: Mar 2015
Posts: 5

Original Poster
Rep: Reputation: Disabled
Uhm, what should I use to read the *.tmpl files properly? (I see it's an xml format)

Is there such a tool on Windows as well? (I'm usually using Windows)

Edit: I see you can call "make pdfdocs"

Last edited by Feoggou; 03-23-2015 at 01:52 PM.
 
Old 03-23-2015, 01:59 PM   #4
veerain
Senior Member
 
Registered: Mar 2005
Location: Earth bound to Helios
Distribution: Custom
Posts: 2,524

Rep: Reputation: 319Reputation: 319Reputation: 319Reputation: 319
Better reference link about kernel documentation.
 
Old 03-23-2015, 02:41 PM   #5
Feoggou
LQ Newbie
 
Registered: Mar 2015
Posts: 5

Original Poster
Rep: Reputation: Disabled
Thanks for the link,

Apparently, the "kgdb" help item is of more use.

However...
Quote:
Originally Posted by https://www.kernel.org/doc/htmldocs/kgdb/CompilingAKernel.html
To enable CONFIG_KGDB you should look under "Kernel hacking" / "Kernel debugging" and select "KGDB: kernel debugger"
What is and where do I find CONFIG_KGDB?
What / where is the item "Kernel debugging"? (folder help file, or what's supposed to be?)
Where do I set "KDGDB: kernel debugger"? in a config command? or?

Also, I see that in order to be able to connect with kgdb, the kernel must have been built specifically so as to allow debugging (and / or build with symbols). So, for my particular case, where my target (linux) OS is in a VM, I should build the linux kernel on the target with this specific config ("./Kconfig CONFIG_DEBUG_INFO=y"?), and then make install, then reboot - right?

Edit: I've found it, it's /boot/config-3.19.0-031900-generic
Edit: I've found this - http://www.linux.org/attachments/lin...ries-pdf.1982/ - talks about configuring the kernel. I think I should study this first.

Last edited by Feoggou; 03-23-2015 at 03:21 PM.
 
Old 03-23-2015, 11:10 PM   #6
veerain
Senior Member
 
Registered: Mar 2005
Location: Earth bound to Helios
Distribution: Custom
Posts: 2,524

Rep: Reputation: 319Reputation: 319Reputation: 319Reputation: 319
Yes. You have a build the linux kernel for enabling debugging options. Read Kernel-Howto from LDP. It may be of some help.
 
  


Reply



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
kernel debugging methods;3.14.25-rt22 Kernel hangs during TCP server client communica linuxaz Linux - Kernel 2 01-18-2015 11:31 PM
kernel debugging methods;3.14.25-rt22 Kernel hangs during TCP server client communica linuxaz Linux - Networking 0 01-17-2015 01:45 PM
[SOLVED] Which bleeding-edge kernel source to use for kernel testing/debugging? GrapefruiTgirl Linux - Kernel 4 09-24-2009 08:11 AM
Difference between kernel - debugging and application debugging topworld Linux - Software 2 03-30-2006 12:50 AM
Visual Debugging and Linux Kernel Debugging Igor007 Programming 0 09-30-2005 10:33 AM

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

All times are GMT -5. The time now is 08:03 AM.

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