Re: a couple questions about "gdb vmlinux /proc/kcore"

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

 



On Sun, Aug 2, 2009 at 7:58 PM, Robert P. J. Day<rpjday@xxxxxxxxxxxxxx> wrote:
> On Sun, 2 Aug 2009, Manish Katiyar wrote:
>
>> Hi Robert,
>>
>> May be you can add how to see the already loaded modules and traverse
>> or find a particular module. Something like ....
>>
>> (gdb) p modules
>> $1 = {next = 0x3502cea4, prev = 0x3502cea4}
>>
>> (gdb) p *((struct module *)0x3502cea0)
>> $3 = {state = MODULE_STATE_LIVE, list = {next = 0x81e0dec, prev = 0x81e0dec},
>>   name = "loop", '\0' <repeats 55 times>, mkobj = {kobj = {
>>       k_name = 0x3502ceec "loop", name = "loop", '\0' <repeats 15 times>,
>>       kref = {refcount = {counter = 2}}, entry = {next = 0x81e0ac8,
>>         prev = 0x34a486c8}, parent = 0x81e0ad0, kset = 0x81e0ac0, ktype = 0x0,
>>       dentry = 0x3297277c, poll = {lock = {raw_lock = {<No data fields>}},
>>         task_list = {next = 0x3502cf1c, prev = 0x3502cf1c}}},
>>     mod = 0x3502cea0}, param_attrs = 0x0, modinfo_attrs = 0x9598620,
>>   version = 0x0, srcversion = 0x0, syms = 0x3502bc20, num_syms = 2,
>>   crcs = 0x0, gpl_syms = 0x0, num_gpl_syms = 0, gpl_crcs = 0x0,
>>   unused_syms = 0x0, num_unused_syms = 0, unused_crcs = 0x0,
>>   unused_gpl_syms = 0x0, num_unused_gpl_syms = 0, unused_gpl_crcs = 0x0,
>>   gpl_future_syms = 0x0, num_gpl_future_syms = 0, gpl_future_crcs = 0x0,
>>   num_exentries = 0, extable = 0x0, init = 0x3502f000, module_init = 0x0,
>>   module_core = 0x3502a000, init_size = 0, core_size = 12328,
>>   init_text_size = 0, core_text_size = 6468, unwind_info = 0x0,
>>   arch = {<No data fields>}, unsafe = 0, license_gplok = 1, ref = {{count = {
>>         counter = 0}}}, modules_which_use_me = {next = 0x3502cfe0,
>>     prev = 0x3502cfe0}, waiter = 0x94cf7c0, exit = 0x3502b8b6,
>>   symtab = 0x3502bc30, num_symtab = 166, strtab = 0x3502c690 "",
>>   sect_attrs = 0x346e14d8, percpu = 0x0, args = 0x94c3698 ""}
>>
>> And similarly traversing the chain and printing the list .....  Also
>> to add that the loading address == $3.module_core and may be highlight
>> on other important members.
>
>  possibly, but to start with, i'm looking for simple variables that
> beginners can print out, just for the entertainment value, to convince
> themselves that they really are getting to examine kernel data values.
> by way of clarification, let me explain what i'm trying to do with my
> "kernel newbie" column over at linux.com.
>
>  my main beef with documentation as long as i can remember is that it
> so often doesn't carefully explain how to get *started* doing
> something.  most of the time, it blasts through the initial install
> and setup, then launches straight into how to do involved and advanced
> stuff.  but a lot of the time, if so much as a single setup
> instruction is mistyped or forgotten, the poor beginner is left
> sitting there, not even able to get the program *started*.  and if
> only the newbie could get past that point to do the *simple* stuff,
> everything after that follows nicely.  so the critical issue is to get
> past that startup phase.
>
>  that's what i'm trying to do -- get newbies past that introductory
> phase.

Hi Robert,

I understand and appreciate your effort and motive. My motive behind
suggesting that was that most of the beginners look kernel code as
black box with some smart or complex data structures and are afraid to
delve into it. Assuming most of them are already pretty good in
userspace, by traversing you are just trying to say that this is
nothing more than a simple linked list program and adding a loadable
modules is just adding a node in that list.

Thanks -
Manish

> as long as a beginner can write a simple module and get it
> compiled and loaded, that's a *huge* victory because, after that, they
> can simply start adding new features a little at a time to see how
> they work.  but if they can't even get that first "hello, world"
> module loaded and running, they get frustrated and walk away.  *my*
> focus in my columns is to get total beginners over that initial hump,
> at which point a lot of them will take off from there.
>
>  so while printing out the loaded modules is cool (and i might even
> use that), i don't want to get into such advanced examples that the
> beginners lose sight of what they're trying to do.  anyway, for better
> or worse, that's the philosophy behind the weekly column -- to get
> people with *no* kernel programming experience into kernel
> programming.
>
> rday
> --
>
> ========================================================================
> Robert P. J. Day                               Waterloo, Ontario, CANADA
>
>        Linux Consulting, Training and Annoying Kernel Pedantry.
>
> Web page:                                          http://crashcourse.ca
> Twitter:                                       http://twitter.com/rpjday
> "Kernel Newbie Corner" column @ linux.com:          http://cli.gs/WG6WYX
> ========================================================================
>



-- 
Thanks -
Manish

--
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