Re: debugging kernel module __init function?

2015-08-04 Thread Aruna Hewapathirane
>> In this case, no.  But I’m curious if there’s a way to pull this off, or if 
>> it’s fundamentally impossible?

What happens 'after' __init gets called ?

After boot, the kernel frees up a special section. All functions
marked with __init and data structures marked with __initdata are
dropped after boot is complete.

Similarly 'modules' DISCARD this memory after initialization.

So what is the workaround ?  Write the module_init function without
the __init attribute.

( They never read the documentation :
/Documentation/DocBook/kernel-hacking.tmpl , I never used to read the
documentation either :)

___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: debugging kernel module __init function?

2015-08-04 Thread Nicholas Murphy
In this case, no.  But I’m curious if there’s a way to pull this off, or if 
it’s fundamentally impossible?

Thanks,
Nick

> On Aug 4, 2015, at 1:07 PM, valdis.kletni...@vt.edu wrote:
> 
> On Tue, 04 Aug 2015 12:23:18 -0700, Nicholas Murphy said:
> 
>> How do I debug the __init function (that is called on module load)?
> 
> Is your .init function actually doing so much odd stuff that a few
> carefully placed printk() calls aren't sufficient?


___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


Re: debugging kernel module __init function?

2015-08-04 Thread Valdis . Kletnieks
On Tue, 04 Aug 2015 12:23:18 -0700, Nicholas Murphy said:

> How do I debug the __init function (that is called on module load)?

Is your .init function actually doing so much odd stuff that a few
carefully placed printk() calls aren't sufficient?


pgpAYpKItGKDg.pgp
Description: PGP signature
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies


debugging kernel module __init function?

2015-08-04 Thread Nicholas Murphy
I can’t for the life of me figure out how to set a breakpoint on a kernel 
module’s __init function.  Everything I’ve read talks about using 
add-symbol-file with the values for .text, .bss, and .data after the module is 
loaded, a la:

https://www.linux.com/learn/linux-training/33991-the-kernel-newbie-corner-kernel-and-module-debugging-with-gdb

How do I debug the __init function (that is called on module load)?

Thanks,
Nick
___
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies