-----Original Message-----
From: crash-utility-bounces(a)redhat.com [mailto:crash-utility-
bounces(a)redhat.com] On Behalf Of Lei Wen
Sent: Wednesday, March 07, 2012 10:58 AM
To: Discussion list for crash utility usage, maintenance and
development
Subject: [Crash-utility] How to use scripts in crash?
Hi Dave,
Do you have some guide doc that describe how to use the scripts in
crash?
Like the example, I want to print out current filesystems
registered.
I then need do following
1. using "p" to get "file_systems" symbol value 2. using
"list" with
command as
"list -o file_system_type.next -s file_system_type.name,fs_flags
<the
file_systems symbol value>"
So if the previous file_systems symbol value could be stored, and then
I don't
need to copy the "p" result to "list" command by
hand, but could let
script do
such kind of thing.
I also notice there is "sial" script support in crash, but that is too
complex for
me... I don't know how to start a basic usage with that... Is
there
any detailed
doc that could help me from a start?
Thanks,
Lei
--
Crash-utility mailing list
Crash-utility(a)redhat.com
https://www.redhat.com/mailman/listinfo/crash-utility
Sial is a C interpreter with a few twists like the string type and its
associated operators .
The ps example is a good one. Using args and callbacks, including
printing recursively (parent->siblings) the process tree.
Let me know if you have questions. I tried to comment the example as
much as I could at the time. And yes, check out the readme files.
It also has a built in preprocessor which enables you to write/modify
debugging code that easily adapts to the linux version of the core you
are looking at.
All of the type and symbol information from kernel space is available in
sial through the dwarf interface.
You can combine these 2 features with the built in 'exists' operators on
member and variables to enable yet better portability across various
linux flavors.
SGI and other engineering outfits have been cut&pasting kernel code into
sial scripts for years.
The hello worl skeleton for a sial command :
==
string foo_opt(){ return "lt:h"; }
string foo_usage() { return "[-l] [-t counter] [-h]\n"; }
string foo_help(){return " This is the help for command foo\n"}
int
foo()
{
if(tflag) tval=atoi(targ)
if(lflag) {
printf("lflag is set, targ=[%s], targ);
}
printf("Hello world!\n");
}
==
By load'ing this file into crash you automatically create a callable
foo command in crash, complete with help and usage.
Sial can be extended with 'sial builtins' and associated APis.
If there are native crash functions (like back traces and fast searches)
that can be useful as a function in sial, we can do that.
-Luc