LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-09-2013, 07:47 PM   #1
Saptarshi4031
LQ Newbie
 
Registered: May 2010
Posts: 8

Rep: Reputation: 0
Kernel debugging with Qemu and gdb


Hi,

I am trying to debug a panic problem observed in linux 3.x kernels.
I have seen it with 3.4.48,3.8.8 and 3.9.4.

I have trouble debugging the kernel with gdb.

STEPS TRIED
--------------------------

These are my command-line :


qemu-system-x86_64 -m 256
-kernel vmlinuz-3.x
-initrd initramfs-3.x
-s
-S
-hda rootfs.img
-append "root=/dev/sda1"




To debug :
I do
gdb vmlinux-3.x
(gdb) target remote:1234
(gdb) c

I run the qemu and the gdb on the same machine. I am root and have
set iptables -F. I have also set CONFIG_DEBGUG_INFO.

OBSERVATION
----------------------------

My problem is that gdb hangs after 'c' . It does not proceed.
When I do Ctrl-C, I observe at the prompt "interrupted while
waiting for the program". I feel I m missing something.

The qemu output is relayed through vnc. But after 'c' in gdb.
I do not see anything in the vncviewer console. I assume that the
kernel is not being executed.

SUMMARY
--------------------

In short, my main problem is debugging with gdb. I am not able to run the kernel using gdb so that I can do a trace analysis at the required breakpoint. I have seen in gdb-tutorials for kernel where they proceed with kernel execution with cont. But that too do not work in my case.

Help is appreciated.
 
Old 06-10-2013, 11:46 AM   #2
smallpond
Senior Member
 
Registered: Feb 2011
Location: Massachusetts, USA
Distribution: CentOS 6 (pre-systemd)
Posts: 2,776

Rep: Reputation: 746Reputation: 746Reputation: 746Reputation: 746Reputation: 746Reputation: 746Reputation: 746
Let's first address "I assume that the kernel is not being executed."

After 'c' what do you get from doing the qemu command 'info cpus' a few times? Are the cpus halted? Is the instruction pointer changing?
 
Old 06-10-2013, 11:36 PM   #3
Saptarshi4031
LQ Newbie
 
Registered: May 2010
Posts: 8

Original Poster
Rep: Reputation: 0
The prompt does not come after pressing 'c'. gdb terminal hangs. Have to Ctrl-D to terminate gdb
 
Old 06-11-2013, 11:12 AM   #4
smallpond
Senior Member
 
Registered: Feb 2011
Location: Massachusetts, USA
Distribution: CentOS 6 (pre-systemd)
Posts: 2,776

Rep: Reputation: 746Reputation: 746Reputation: 746Reputation: 746Reputation: 746Reputation: 746Reputation: 746
After a 'c' nothing should be happening on the gdb terminal because the system is running. You can only type gdb commands when you are in a breakpoint or Ctl-C.

The qemu prompt is what you get in the term where you issued the qemu-system-x86_64 command.
 
  


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
debug kernel module with gdb - how to solve "no debugging symbols founds" smithyvn Programming 1 01-10-2013 11:57 PM
debugging with GDB jone kim Linux - General 2 04-13-2010 12:22 AM
Debugging linux kernel GDB & JTAG 256Doofus Linux - Hardware 0 03-08-2010 04:34 AM
Problems debugging usermode linux kernel with gdb StevenR Linux - Kernel 2 02-02-2009 03:14 AM
using GDB for remote kernel debugging vibhooti Linux - Software 0 04-23-2007 01:17 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 03:05 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration