public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* kernel debugging
@ 2005-07-24 13:15 UmaMaheswari Devi
  2005-07-24 14:02 ` Jesper Juhl
  2005-07-25 19:23 ` uma
  0 siblings, 2 replies; 5+ messages in thread
From: UmaMaheswari Devi @ 2005-07-24 13:15 UTC (permalink / raw)
  To: linux-kernel

I am new to kernel hacking and am facing problems in trying to peek at the
runtime values of some kernel variables using gdb.

I am issuing the gdb command as follows:
     gdb vmlinux /proc/kcore
This displays the message
    /proc/kcore: Operation not permitted
before the (gdb) prompt is displayed.
gdb then prints a value of 0 for any valid variable that is requested.

vmlinux appears to be OK, as gdb correctly identifies undefined variables.
The problem seems to be with /proc/kcore. This file has a permission of 400. I
am using the Red Hat distribution.

Any help is appreciated. 

Thanks,
Uma.



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: kernel debugging
  2005-07-24 13:15 kernel debugging UmaMaheswari Devi
@ 2005-07-24 14:02 ` Jesper Juhl
  2005-07-24 14:03   ` Jesper Juhl
  2005-07-25 19:23 ` uma
  1 sibling, 1 reply; 5+ messages in thread
From: Jesper Juhl @ 2005-07-24 14:02 UTC (permalink / raw)
  To: UmaMaheswari Devi; +Cc: linux-kernel

On 7/24/05, UmaMaheswari Devi <uma@cs.unc.edu> wrote:
> I am new to kernel hacking and am facing problems in trying to peek at the
> runtime values of some kernel variables using gdb.
> 
> I am issuing the gdb command as follows:
>      gdb vmlinux /proc/kcore
> This displays the message
>     /proc/kcore: Operation not permitted
> before the (gdb) prompt is displayed.
> gdb then prints a value of 0 for any valid variable that is requested.
> 
> vmlinux appears to be OK, as gdb correctly identifies undefined variables.
> The problem seems to be with /proc/kcore. This file has a permission of 400. I
> am using the Red Hat distribution.
> 
> Any help is appreciated.
> 
If you want to use gdb to debug the kernel you should probably
investigate UML (User Mode Linux). Take a look at this link :
http://user-mode-linux.sourceforge.net/debugging.html

Alternatives include kgdb - http://kgdb.sourceforge.net/ 
and kdb - http://oss.sgi.com/projects/kdb/

You can also find many documents on Linux Kernel debugging aids and
techniques via google.

-- 
Jesper Juhl <jesper.juhl@gmail.com>
Don't top-post  http://www.catb.org/~esr/jargon/html/T/top-post.html
Plain text mails only, please      http://www.expita.com/nomime.html

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: kernel debugging
  2005-07-24 14:02 ` Jesper Juhl
@ 2005-07-24 14:03   ` Jesper Juhl
  0 siblings, 0 replies; 5+ messages in thread
From: Jesper Juhl @ 2005-07-24 14:03 UTC (permalink / raw)
  To: UmaMaheswari Devi; +Cc: linux-kernel

On 7/24/05, Jesper Juhl <jesper.juhl@gmail.com> wrote:
> On 7/24/05, UmaMaheswari Devi <uma@cs.unc.edu> wrote:
> > I am new to kernel hacking and am facing problems in trying to peek at the
> > runtime values of some kernel variables using gdb.
> >
> > I am issuing the gdb command as follows:
> >      gdb vmlinux /proc/kcore
> > This displays the message
> >     /proc/kcore: Operation not permitted
> > before the (gdb) prompt is displayed.
> > gdb then prints a value of 0 for any valid variable that is requested.
> >
> > vmlinux appears to be OK, as gdb correctly identifies undefined variables.
> > The problem seems to be with /proc/kcore. This file has a permission of 400. I
> > am using the Red Hat distribution.
> >
> > Any help is appreciated.
> >
> If you want to use gdb to debug the kernel you should probably
> investigate UML (User Mode Linux). Take a look at this link :
> http://user-mode-linux.sourceforge.net/debugging.html
> 
> Alternatives include kgdb - http://kgdb.sourceforge.net/
> and kdb - http://oss.sgi.com/projects/kdb/
> 
> You can also find many documents on Linux Kernel debugging aids and
> techniques via google.
> 
Ohh, and do search the LKML archives, kernel debuggers have been
discussed endlessly over the years on the list, so you should be able
to find many threads covering that.

-- 
Jesper Juhl <jesper.juhl@gmail.com>
Don't top-post  http://www.catb.org/~esr/jargon/html/T/top-post.html
Plain text mails only, please      http://www.expita.com/nomime.html

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: kernel debugging
  2005-07-24 13:15 kernel debugging UmaMaheswari Devi
  2005-07-24 14:02 ` Jesper Juhl
@ 2005-07-25 19:23 ` uma
  2005-07-25 20:02   ` Lee Revell
  1 sibling, 1 reply; 5+ messages in thread
From: uma @ 2005-07-25 19:23 UTC (permalink / raw)
  To: linux-kernel; +Cc: anderegg

I am using Red Hat sources, which has function open_kcore() hardcoded to
return -EPERM always.

Changing this function to the way it is defined in the public sources (as
shown below) did the trick.

open_kcore(struct inode * inode, struct file * filp)
{
    return capable(CAP_SYS_RAWIO) ? 0 : -EPERM;
}

I am now able to use gdb to examine kernel symbols.

Uma.


Quoting UmaMaheswari Devi <uma@cs.unc.edu>:

> I am new to kernel hacking and am facing problems in tryingstatic int
to peek at the
> runtime values of some kernel variables using gdb.
>
> I am issuing the gdb command as follows:
>     gdb vmlinux /proc/kcore
> This displays the message
>    /proc/kcore: Operation not permitted
> before the (gdb) prompt is displayed.
> gdb then prints a value of 0 for any valid variable that is requested.
>
> vmlinux appears to be OK, as gdb correctly identifies undefined variables.
> The problem seems to be with /proc/kcore. This file has a permission 
> of 400. I
> am using the Red Hat distribution.
>
> Any help is appreciated. Thanks,
> Uma.
>
>
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/
>



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: kernel debugging
  2005-07-25 19:23 ` uma
@ 2005-07-25 20:02   ` Lee Revell
  0 siblings, 0 replies; 5+ messages in thread
From: Lee Revell @ 2005-07-25 20:02 UTC (permalink / raw)
  To: uma; +Cc: linux-kernel, anderegg

On Mon, 2005-07-25 at 15:23 -0400, uma@email.unc.edu wrote:
> I am using Red Hat sources, which has function open_kcore() hardcoded to
> return -EPERM always.
> 
> Changing this function to the way it is defined in the public sources (as
> shown below) did the trick.

All these Red Hat / RHEL threads are completely OT.  Please take it to a
Red Hat list.

Lee


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2005-07-25 20:07 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-07-24 13:15 kernel debugging UmaMaheswari Devi
2005-07-24 14:02 ` Jesper Juhl
2005-07-24 14:03   ` Jesper Juhl
2005-07-25 19:23 ` uma
2005-07-25 20:02   ` Lee Revell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox