All of lore.kernel.org
 help / color / mirror / Atom feed
* How to get object virtual address from a kernel core dump
@ 2016-03-18  9:58 Mohammad Y. Zachariah
  2016-03-22 11:39 ` Arun Sudhilal
  2016-03-23  3:41 ` Buland Kumar Singh
  0 siblings, 2 replies; 4+ messages in thread
From: Mohammad Y. Zachariah @ 2016-03-18  9:58 UTC (permalink / raw)
  To: kernelnewbies

Hello everyone,

I'm taking the way of analysing kernel core dumps as a learning approach
using 'crash tool'. One of the interesting crash commands is 'struct' which
can print kernel struct definition and/or the actual contents of the
structure.

According to struct help page, I need the virtual address of the struct in
order to view/print its contents, for example:

    crash> mm_struct.pgd ffff810022e7d080 -px
      pgd_t *pgd = 0xffff81000e3ac000
      -> {
           pgd = 0x2c0a6067
         }

My question is how to find the mm_struct address "ffff810022e7d080" in the
above example in the first place??

Thank you for your help in advance.
Zach
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20160318/aff2cddf/attachment.html 

^ permalink raw reply	[flat|nested] 4+ messages in thread
* How to get object virtual address from a kernel core dump
@ 2016-03-22 11:03 Manoj Nayak
  0 siblings, 0 replies; 4+ messages in thread
From: Manoj Nayak @ 2016-03-22 11:03 UTC (permalink / raw)
  To: kernelnewbies

task_struct contains mm_struct.

If we have pid of the process then task_struct can be obtained from pid
using following two methods.

1.
Please check find_task_by_pid() function in kernel. We can write a similar
macro to convert pid to task_struct.

2. We can write a macro that traverses all task starting from init_task and
check the required pid.

#define for_each_task(p) \
        for (p = &init_task ; (p = p->next_task) != &init_task ; )


If process is the current one then current_thread_info()->task provides
task_struct for current task.
We can write a macro similar to current_thread_info().

pid-> task_struct->mm_struct.

Regards
Manoj Nayak
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20160322/09d53114/attachment-0001.html 

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

end of thread, other threads:[~2016-03-23  3:41 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-18  9:58 How to get object virtual address from a kernel core dump Mohammad Y. Zachariah
2016-03-22 11:39 ` Arun Sudhilal
2016-03-23  3:41 ` Buland Kumar Singh
2016-03-22 11:03 Manoj Nayak

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.