/proc/kcore_elf

Tigran Aivazian tigran@sco.COM
Thu Apr 1 07:22:00 GMT 1999


Please have a look at this with /* my comments */

# cat .gdbinit 
file vmlinux
target core /proc/kcore_elf
set output-radix 16
# ls -l vmlinux
-rwxr-xr-x   1 root     root      5196936 Apr  1 15:34 vmlinux*
/* why is vmlinux so small? I am used to 10M -g compiled kernels? */

# gdb -q
Core was generated by `auto BOOT_IMAGE=225a ro root=801'.
#0  0x0 in ?? ()
(gdb) p task
$1 = 0xc01f2000
(gdb) p task[0]
cannot subscript something of type `<data variable, no debug info>'
(gdb) whatis task
type = <data variable, no debug info>
(gdb) p *(struct task_struct *)task
.... /* lots of correct output skipped */
/* now, the last command fixes (almost) everything up */

(gdb) p task[0]
$3 = (struct task_struct *) 0xc01f2000
(gdb) whatis task
type = struct task_struct *[512]
(gdb) p task[0]->comm
$4 = "swapper\000\000\000\000\000\000\000\000"
/* correct, but see below */

(gdb) p task[1]->comm
$5 = "swapper\000\000\000\000\000\000\000\000"
/* incorrect, task[1] is init, task[2] is kflushd etc */

(gdb) p task[2]->comm
$6 = "init\000er\000\000\000\000\000\000\000\000"
(gdb) p task[3]->comm
$7 = "kflushd\000\000\000\000\000\000\000\000"

Any comments? (I am no gdb guru as is probably obvious from my remarks)
The situation is much better than with aout /proc/kcore where none of the
above examples (except task[0]) would work. So, the concept of
/proc/kcore_elf certainly works, but there are some glitches and suspicion
is on egcs/gdb (just a hunch).

Also, I am not sure if it helps, but when compiled with gcc I can't do
"list start_kernel" (but can list other things, e.g. sys_open). When
compiled with egcs I can list start_kernel. I checked objdump --debugging
vmlinux output on both and found that with gcc there is no /* file
init/main.c */ thingy, while there is when compiled with egcs.

However, for task[] the entries in objdump --debugging output for both gcc
and egcs are (almost) identical:

On gcc:
struct task_struct /* id 11 */ *task[512] /* 0x64 */;

On egcs:
struct task_struct /* id 3 */ *task[512] /* 0x80 */;

Regards,
Tigran.







More information about the Gcc-bugs mailing list