[Crash-utility] Retrieve pointer value for scripting

Buland Kumar Singh 6b65726e656c at gmail.com
Fri Dec 6 09:50:23 UTC 2013


Hi Patrick,

You can use the combination of foreach, awk and cut commands to get the
desired results.

Eg:
crash> foreach RU task|grep " stack =" |awk '{print $3}'|cut -f1 -d"," |awk
'{print "rd "$1 " " 3 }' > rd_stack_number

crash> rd 0xffffffff81a00000 3
ffffffff81a00000:  ffffffff81a8d020 ffffffff81a9a8a0    ...............
ffffffff81a00010:  0000000400000000                    ........
crash> rd 0xffff88106961e000 3
ffff88106961e000:  ffff884069dd8040 ffffffff81a9a8a0   @..i at ...........
ffff88106961e010:  0000000400000000                    ........

The above example is some what similar to the Louis example.

-- BKS



On 6 December 2013 14:32, Patrick Agrain
<patrick.agrain at alcatel-lucent.com>wrote:

> Hello,
>
> We wish to call 'crash' with a script file to automate some basic command
> and output the result on a text file.
>
> This works perfectly for basic commands such as bt, log, mod and so on,
> especially when no input data is required.
>
> We try now to dump the kernel stack through a 'rd <@> <size>'.
> My problem is to "extract" this <@> and to "input" it in this 'rd' command.
>
> For the moment, I'm able to get the task_struct * with following command :
> ps | grep '>' | awk '{ print $5 };'
>
> From that, the pointer of the thread_info would be available through
> (task_struct *)->stack.
>
> But how to get all these together to finally ouptut a valid 'rd' command ?
> Meaby another way to get this kernel stack dump would exist ?
>
> Any help would be appreciate.
> Regards,
> Patrick Agrain
>
> --
> Crash-utility mailing list
> Crash-utility at redhat.com
> https://www.redhat.com/mailman/listinfo/crash-utility
>



-- 
BKS
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/crash-utility/attachments/20131206/fb806fc3/attachment.htm>


More information about the Crash-utility mailing list