linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* debugging kernel modules
@ 2002-08-05 23:00 Brian Kuschak
  2002-08-05 23:14 ` Daniel L. Taylor
  2002-08-06  4:31 ` Michael Habermann
  0 siblings, 2 replies; 7+ messages in thread
From: Brian Kuschak @ 2002-08-05 23:00 UTC (permalink / raw)
  To: linuxppc-embedded


Wolfgang has a nice tutorial on this:
http://www.denx.de/doc/TQM8xxL/debugging.html

But here's the question - is there any way to dump the
module load addresses, after the fact?  'insmod -m'
works well if you always remember to use it to load
the module.  FreeBSD has 'kldstat' which dumps module
address information at any time.  Is there anything
similar to kldstat for linux?  If not, any comments on
how hard it would be to write one?

-Brian


** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

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

* Re: debugging kernel modules
  2002-08-05 23:00 debugging kernel modules Brian Kuschak
@ 2002-08-05 23:14 ` Daniel L. Taylor
  2002-08-06  2:43   ` Brian Kuschak
  2002-08-06  4:31 ` Michael Habermann
  1 sibling, 1 reply; 7+ messages in thread
From: Daniel L. Taylor @ 2002-08-05 23:14 UTC (permalink / raw)
  To: Brian Kuschak; +Cc: linuxppc-embedded


apropos modules -> lsmod; man lsmod -> ksyms;
man ksyms -> "ksyms -m"

Does this help?

Brian Kuschak wrote:
>
> Wolfgang has a nice tutorial on this:
> http://www.denx.de/doc/TQM8xxL/debugging.html
>
> But here's the question - is there any way to dump the
> module load addresses, after the fact?  'insmod -m'
> works well if you always remember to use it to load
> the module.  FreeBSD has 'kldstat' which dumps module
> address information at any time.  Is there anything
> similar to kldstat for linux?  If not, any comments on
> how hard it would be to write one?
>
> -Brian
>

--
Dan.Taylor@atlp.com

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

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

* RE: debugging kernel modules
@ 2002-08-06  1:12 Ken Chou
  2002-08-06  6:53 ` Wolfgang Denk
  0 siblings, 1 reply; 7+ messages in thread
From: Ken Chou @ 2002-08-06  1:12 UTC (permalink / raw)
  To: Brian Kuschak, linuxppc-embedded


Hi,

Is there is pointer on how to debug Linux Kernel and Statically Linked
Device Drivers?

Thanks,
Ken

-----Original Message-----
From: Brian Kuschak [mailto:bkuschak@yahoo.com]
Sent: Monday, August 05, 2002 4:01 PM
To: linuxppc-embedded@lists.linuxppc.org
Subject: debugging kernel modules


Wolfgang has a nice tutorial on this:
http://www.denx.de/doc/TQM8xxL/debugging.html

But here's the question - is there any way to dump the
module load addresses, after the fact?  'insmod -m'
works well if you always remember to use it to load
the module.  FreeBSD has 'kldstat' which dumps module
address information at any time.  Is there anything
similar to kldstat for linux?  If not, any comments on
how hard it would be to write one?

-Brian


** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

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

* Re: debugging kernel modules
  2002-08-05 23:14 ` Daniel L. Taylor
@ 2002-08-06  2:43   ` Brian Kuschak
  0 siblings, 0 replies; 7+ messages in thread
From: Brian Kuschak @ 2002-08-06  2:43 UTC (permalink / raw)
  To: Daniel L. Taylor; +Cc: linuxppc-embedded


Thanks Dan, I think that's it.  With a little bit of
scripting I should be able to make it work nicely.


--- "Daniel L. Taylor" <Dan.Taylor@atlp.com> wrote:
> apropos modules -> lsmod; man lsmod -> ksyms;
> man ksyms -> "ksyms -m"
>
> Does this help?
>
> Brian Kuschak wrote:
> >
> > Wolfgang has a nice tutorial on this:
> > http://www.denx.de/doc/TQM8xxL/debugging.html
> >
> > But here's the question - is there any way to dump
> the
> > module load addresses, after the fact?  'insmod
> -m'
> > works well if you always remember to use it to
> load
> > the module.  FreeBSD has 'kldstat' which dumps
> module
> > address information at any time.  Is there
> anything
> > similar to kldstat for linux?  If not, any
> comments on
> > how hard it would be to write one?
> >
> > -Brian
> >
>
> --
> Dan.Taylor@atlp.com


** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

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

* Re: debugging kernel modules
  2002-08-05 23:00 debugging kernel modules Brian Kuschak
  2002-08-05 23:14 ` Daniel L. Taylor
@ 2002-08-06  4:31 ` Michael Habermann
  1 sibling, 0 replies; 7+ messages in thread
From: Michael Habermann @ 2002-08-06  4:31 UTC (permalink / raw)
  To: Brian Kuschak; +Cc: linuxppc-embedded


Brian Kuschak wrote:
> But here's the question - is there any way to dump the
> module load addresses, after the fact?  'insmod -m'

If necessary, it also works without tools.

The linux kernel has the symbol module_list, which contains a linked
list of all modules. You can follow the linked list until you find your
module. Take the address of the struct module list entry (!) and add
(size_of_struct+4). Then you get to the start address of your module.

E.g.:
&struct module = 0xc100b000
size_of_struct = 0x60

=> .text = 0xc1000064


** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

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

* Re: debugging kernel modules
  2002-08-06  1:12 Ken Chou
@ 2002-08-06  6:53 ` Wolfgang Denk
  0 siblings, 0 replies; 7+ messages in thread
From: Wolfgang Denk @ 2002-08-06  6:53 UTC (permalink / raw)
  To: Ken Chou; +Cc: Brian Kuschak, linuxppc-embedded


In message <7D036BD3216A084DB1BD9D62BCEAF2900884D8@mail1irv.inside.istor.com> you wrote:
>
> Is there is pointer on how to debug Linux Kernel and Statically Linked
> Device Drivers?

This is implicitely included here:

> Wolfgang has a nice tutorial on this:
> http://www.denx.de/doc/TQM8xxL/debugging.html

Just follow the description how to start the Linux kernel  under  the
debugger  -  all  the  statically  linked drivers etc. are accessable
without additional tricks.

Wolfgang Denk

--
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-4596-87  Fax: (+49)-8142-4596-88  Email: wd@denx.de
"...this does not mean that some of us should not want, in  a  rather
dispassionate sort of way, to put a bullet through csh's head."
                   - Larry Wall in <1992Aug6.221512.5963@netlabs.com>

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

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

* Re: debugging kernel modules
       [not found] <20020809010652.6470.qmail@web40201.mail.yahoo.com>
@ 2002-08-09  7:15 ` Wolfgang Denk
  0 siblings, 0 replies; 7+ messages in thread
From: Wolfgang Denk @ 2002-08-09  7:15 UTC (permalink / raw)
  To: Brian Kuschak; +Cc: linuxppc-embedded


In message <20020809010652.6470.qmail@web40201.mail.yahoo.com> you wrote:
>
> With GDB-5.2, after adding symbols, GDB can't find
> line numbers for my module source code.  However
> 'powerpc-linux-objdump -S -l fs/fat/fat.o' shows line
> numbers just fine.  Wolfgang, on your page you used
> GDB-5.1.1.  Ever see this problem?

We saw, and fixed, this, and other problems.

The GDB that comes with our ELDK contains a couple of bug  fixes  and
extensions:

- module debugging: there were some issues, including the problem you
  mentioned

- thread support: you can use our GDB / gdbserver to debug
  multi-threaded applications

- gdbserver with "remote shell" extension: you  can  use  our  GDB  /
  gdbserver  to  execute commands on the target, for example in cases
  where you don;t have a login or other shell running

- gdbserver in "server mode": you can start our gdbserver as a "real"
  server, i. e. without a process to debug, and use it later to
  attach to _any_ running process(es) onthe target

  For example, on a couple of systems we start a gdbserver  from  the
  inittab,  and  if we suspect a process goes haywire we use "rsh ps"
  to run the "ps" command on the  target  to  get  the  PIDs  of  the
  running  processes, and then we use "attach <pid>" to attach to the
  suspect process



Wolfgang Denk

--
Software Engineering:  Embedded and Realtime Systems,  Embedded Linux
Phone: (+49)-8142-4596-87  Fax: (+49)-8142-4596-88  Email: wd@denx.de
"If you can, help others. If you can't, at least don't hurt  others."
- the Dalai Lama

** Sent via the linuxppc-embedded mail list. See http://lists.linuxppc.org/

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

end of thread, other threads:[~2002-08-09  7:15 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-08-05 23:00 debugging kernel modules Brian Kuschak
2002-08-05 23:14 ` Daniel L. Taylor
2002-08-06  2:43   ` Brian Kuschak
2002-08-06  4:31 ` Michael Habermann
  -- strict thread matches above, loose matches on Subject: below --
2002-08-06  1:12 Ken Chou
2002-08-06  6:53 ` Wolfgang Denk
     [not found] <20020809010652.6470.qmail@web40201.mail.yahoo.com>
2002-08-09  7:15 ` Wolfgang Denk

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).