using gdb to debug a 64-bit kernel

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



  currently, i'm working on a short writeup showing how to use gdb to
debug a running kernel and, when i first wrote this a while back, it
was for a 32-bit system and things worked just fine.

  in short, i fired up gdb using the standard kernel-oriented
invocation with:

  $ sudo gdb /tmp/vmlinux /proc/kcore

where i copied the vmlinux file for the running kernel into /tmp to
save keystrokes.  and that's the standard way to use gdb to debug the
kernel, but here's where it starts to get weird.

  on a 32-bit system, if i wanted to print the current value of
jiffies, i used:

(gdb) p jiffies_64

however, since this *is* a 64-bit system, i apparently have no such
symbol, i would just use:

(gdb) p __jiffies
$12 = 4294937296
(gdb) p __jiffies
$13 = 4294937296
(gdb) p __jiffies
$14 = 4294937296
...

and as kernel-oriented gdb users know, you'll keep getting the same
answer over and over until you flush the gdb cache and reread
/proc/kcore:

(gdb) core-file /proc/kcore

but even after i do that, i'll get the same value.  why?  is there
some really fundamental difference between debugging a 32-bit vs
64-bit kernel?

  and this is also weird:

(gdb) p loops_per_jiffy
$16 = 4096

huh?  that value is way too low for this system.  on my old 32-bit
system, that value would be around 2 million or so.

  none of this makes sense.  am i missing something fundamental?  this
is the first time i've tried this on a 64-bit system.

rday

-- 

========================================================================
Robert P. J. Day                               Waterloo, Ontario, CANADA

        Top-notch, inexpensive online Linux/OSS/kernel courses
                        http://crashcourse.ca

Twitter:                                       http://twitter.com/rpjday
LinkedIn:                               http://ca.linkedin.com/in/rpjday
========================================================================

--
To unsubscribe from this list: send an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux