display function parameters for call stack
by Lei Wen
Hi Dave,
I notice there was some discussion around on enabling
the display function parameters feature for crash tool.
Like this one:
http://www.redhat.com/archives/crash-utility/2009-May/msg00016.html
Although the answer seems to be quite clear, it should be hard to
support such feature. But does this feature cannot be done anyway?
I think this feature would be great in assisting kernel debug.
The main feature I require, first should be know each param's value in the
call stack.
Then it is better to know each call stack's param's name.
Like for do_vfs_ioctl function, it is better to display as:
do_vfs_ioctl(filp=xxx, fd=xxx, cmd=xxx, arg=xxx)
Do you have any idea on how this could be implemented?
Thanks,
Lei
12 years, 3 months
[PATCH] s390(x): Allow "lowcore" and "_lowcore"
by Michael Holzheu
Hello Dave,
In future s390/s390x Linux kernels struct "_lowcore" will be renamed
to "lowcore". This patch checks which struct is defined and uses the
correct one.
Michael
---
s390.c | 33 +++++++++++++++++++++------------
s390x.c | 36 +++++++++++++++++++++++-------------
2 files changed, 44 insertions(+), 25 deletions(-)
--- a/s390.c
+++ b/s390.c
@@ -68,15 +68,24 @@ static struct line_number_hook s390_line
static int s390_is_uvaddr(ulong, struct task_context *);
/*
+ * struct lowcore name (old: "_lowcore", new: "lowcore")
+ */
+static char *lc_struct;
+
+/*
* Initialize member offsets
*/
static void s390_offsets_init(void)
{
- if (MEMBER_EXISTS("_lowcore", "st_status_fixed_logout"))
- MEMBER_OFFSET_INIT(s390_lowcore_psw_save_area, "_lowcore",
+ if (STRUCT_EXISTS("lowcore"))
+ lc_struct = "lowcore";
+ else
+ lc_struct = "_lowcore";
+ if (MEMBER_EXISTS(lc_struct, "st_status_fixed_logout"))
+ MEMBER_OFFSET_INIT(s390_lowcore_psw_save_area, lc_struct,
"st_status_fixed_logout");
else
- MEMBER_OFFSET_INIT(s390_lowcore_psw_save_area, "_lowcore",
+ MEMBER_OFFSET_INIT(s390_lowcore_psw_save_area, lc_struct,
"psw_save_area");
}
@@ -578,9 +587,9 @@ static void s390_get_int_stack(char *sta
{
unsigned long stack_addr;
- if (!MEMBER_EXISTS("_lowcore", stack_name))
+ if (!MEMBER_EXISTS(lc_struct, stack_name))
return;
- stack_addr = ULONG(lc + MEMBER_OFFSET("_lowcore", stack_name));
+ stack_addr = ULONG(lc + MEMBER_OFFSET(lc_struct, stack_name));
if (stack_addr == 0)
return;
readmem(stack_addr - INT_STACK_SIZE, KVADDR, int_stack,
@@ -793,18 +802,18 @@ s390_print_lowcore(char* lc, struct bt_i
if (bt->flags & BT_LINE_NUMBERS)
s390_dump_line_number(tmp[1] & S390_ADDR_MASK);
}
- ptr = lc + MEMBER_OFFSET("_lowcore","cpu_timer_save_area");
+ ptr = lc + MEMBER_OFFSET(lc_struct, "cpu_timer_save_area");
tmp[0]=UINT(ptr);
tmp[1]=UINT(ptr + S390_WORD_SIZE);
fprintf(fp," -cpu timer: %#010lx %#010lx\n", tmp[0],tmp[1]);
- ptr = lc + MEMBER_OFFSET("_lowcore","clock_comp_save_area");
+ ptr = lc + MEMBER_OFFSET(lc_struct, "clock_comp_save_area");
tmp[0]=UINT(ptr);
tmp[1]=UINT(ptr + S390_WORD_SIZE);
fprintf(fp," -clock cmp: %#010lx %#010lx\n", tmp[0], tmp[1]);
fprintf(fp," -general registers:\n");
- ptr = lc + MEMBER_OFFSET("_lowcore","gpregs_save_area");
+ ptr = lc + MEMBER_OFFSET(lc_struct, "gpregs_save_area");
tmp[0]=ULONG(ptr);
tmp[1]=ULONG(ptr + S390_WORD_SIZE);
tmp[2]=ULONG(ptr + 2 * S390_WORD_SIZE);
@@ -831,7 +840,7 @@ s390_print_lowcore(char* lc, struct bt_i
tmp[0], tmp[1], tmp[2], tmp[3]);
fprintf(fp," -access registers:\n");
- ptr = lc + MEMBER_OFFSET("_lowcore","access_regs_save_area");
+ ptr = lc + MEMBER_OFFSET(lc_struct, "access_regs_save_area");
tmp[0]=ULONG(ptr);
tmp[1]=ULONG(ptr + S390_WORD_SIZE);
tmp[2]=ULONG(ptr + 2 * S390_WORD_SIZE);
@@ -858,7 +867,7 @@ s390_print_lowcore(char* lc, struct bt_i
tmp[0], tmp[1], tmp[2], tmp[3]);
fprintf(fp," -control registers:\n");
- ptr = lc + MEMBER_OFFSET("_lowcore","cregs_save_area");
+ ptr = lc + MEMBER_OFFSET(lc_struct, "cregs_save_area");
tmp[0]=ULONG(ptr);
tmp[1]=ULONG(ptr + S390_WORD_SIZE);
tmp[2]=ULONG(ptr + 2 * S390_WORD_SIZE);
@@ -885,7 +894,7 @@ s390_print_lowcore(char* lc, struct bt_i
fprintf(fp," %#010lx %#010lx %#010lx %#010lx\n",
tmp[0], tmp[1], tmp[2], tmp[3]);
- ptr = lc + MEMBER_OFFSET("_lowcore","floating_pt_save_area");
+ ptr = lc + MEMBER_OFFSET(lc_struct, "floating_pt_save_area");
fprintf(fp," -floating point registers 0,2,4,6:\n");
tmp[0]=ULONG(ptr);
tmp[1]=ULONG(ptr + 2 * S390_WORD_SIZE);
@@ -911,7 +920,7 @@ s390_get_stack_frame(struct bt_info *bt,
/* get the stack pointer */
if(esp){
if(s390_has_cpu(bt)){
- ksp = ULONG(lowcore + MEMBER_OFFSET("_lowcore",
+ ksp = ULONG(lowcore + MEMBER_OFFSET(lc_struct,
"gpregs_save_area") + (15 * S390_WORD_SIZE));
} else {
readmem(bt->task + OFFSET(task_struct_thread_ksp),
--- a/s390x.c
+++ b/s390x.c
@@ -117,6 +117,11 @@ static int s390x_get_kvaddr_ranges(struc
static int set_s390x_max_physmem_bits(void);
/*
+ * struct lowcore name (old: "_lowcore", new: "lowcore")
+ */
+static char *lc_struct;
+
+/*
* Read a unsigned long value from address
*/
static unsigned long readmem_ul(unsigned long addr)
@@ -132,11 +137,16 @@ static unsigned long readmem_ul(unsigned
*/
static void s390x_offsets_init(void)
{
- if (MEMBER_EXISTS("_lowcore", "st_status_fixed_logout"))
- MEMBER_OFFSET_INIT(s390_lowcore_psw_save_area, "_lowcore",
+ if (STRUCT_EXISTS("lowcore"))
+ lc_struct = "lowcore";
+ else
+ lc_struct = "_lowcore";
+
+ if (MEMBER_EXISTS(lc_struct, "st_status_fixed_logout"))
+ MEMBER_OFFSET_INIT(s390_lowcore_psw_save_area, lc_struct,
"st_status_fixed_logout");
else
- MEMBER_OFFSET_INIT(s390_lowcore_psw_save_area, "_lowcore",
+ MEMBER_OFFSET_INIT(s390_lowcore_psw_save_area, lc_struct,
"psw_save_area");
if (!STRUCT_EXISTS("stack_frame")) {
ASSIGN_OFFSET(s390_stack_frame_back_chain) = 0;
@@ -908,9 +918,9 @@ static void get_int_stack(char *stack_na
stack_addr = symbol_value("restart_stack");
stack_addr = readmem_ul(stack_addr);
} else {
- if (!MEMBER_EXISTS("_lowcore", stack_name))
+ if (!MEMBER_EXISTS(lc_struct, stack_name))
return;
- stack_addr = ULONG(lc + MEMBER_OFFSET("_lowcore", stack_name));
+ stack_addr = ULONG(lc + MEMBER_OFFSET(lc_struct, stack_name));
}
if (stack_addr == 0)
return;
@@ -1191,22 +1201,22 @@ s390x_print_lowcore(char* lc, struct bt_
if (bt->flags & BT_LINE_NUMBERS)
s390x_dump_line_number(tmp[1]);
}
- ptr = lc + MEMBER_OFFSET("_lowcore","prefixreg_save_area");
+ ptr = lc + MEMBER_OFFSET(lc_struct, "prefixreg_save_area");
tmp[0] = UINT(ptr);
fprintf(fp," -prefix : %#010lx\n", tmp[0]);
- ptr = lc + MEMBER_OFFSET("_lowcore","cpu_timer_save_area");
+ ptr = lc + MEMBER_OFFSET(lc_struct, "cpu_timer_save_area");
tmp[0]=UINT(ptr);
tmp[1]=UINT(ptr + S390X_WORD_SIZE);
fprintf(fp," -cpu timer: %#010lx %#010lx\n", tmp[0],tmp[1]);
- ptr = lc + MEMBER_OFFSET("_lowcore","clock_comp_save_area");
+ ptr = lc + MEMBER_OFFSET(lc_struct, "clock_comp_save_area");
tmp[0]=UINT(ptr);
tmp[1]=UINT(ptr + S390X_WORD_SIZE);
fprintf(fp," -clock cmp: %#010lx %#010lx\n", tmp[0], tmp[1]);
fprintf(fp," -general registers:\n");
- ptr = lc + MEMBER_OFFSET("_lowcore","gpregs_save_area");
+ ptr = lc + MEMBER_OFFSET(lc_struct, "gpregs_save_area");
tmp[0]=ULONG(ptr);
tmp[1]=ULONG(ptr + S390X_WORD_SIZE);
tmp[2]=ULONG(ptr + 2 * S390X_WORD_SIZE);
@@ -1233,7 +1243,7 @@ s390x_print_lowcore(char* lc, struct bt_
fprintf(fp," %#018lx %#018lx\n", tmp[2],tmp[3]);
fprintf(fp," -access registers:\n");
- ptr = lc + MEMBER_OFFSET("_lowcore","access_regs_save_area");
+ ptr = lc + MEMBER_OFFSET(lc_struct, "access_regs_save_area");
tmp[0]=UINT(ptr);
tmp[1]=UINT(ptr + 4);
tmp[2]=UINT(ptr + 2 * 4);
@@ -1260,7 +1270,7 @@ s390x_print_lowcore(char* lc, struct bt_
tmp[0], tmp[1], tmp[2], tmp[3]);
fprintf(fp," -control registers:\n");
- ptr = lc + MEMBER_OFFSET("_lowcore","cregs_save_area");
+ ptr = lc + MEMBER_OFFSET(lc_struct, "cregs_save_area");
tmp[0]=ULONG(ptr);
tmp[1]=ULONG(ptr + S390X_WORD_SIZE);
tmp[2]=ULONG(ptr + 2 * S390X_WORD_SIZE);
@@ -1286,7 +1296,7 @@ s390x_print_lowcore(char* lc, struct bt_
fprintf(fp," %#018lx %#018lx\n", tmp[0],tmp[1]);
fprintf(fp," %#018lx %#018lx\n", tmp[2],tmp[3]);
- ptr = lc + MEMBER_OFFSET("_lowcore","floating_pt_save_area");
+ ptr = lc + MEMBER_OFFSET(lc_struct, "floating_pt_save_area");
fprintf(fp," -floating point registers:\n");
tmp[0]=ULONG(ptr);
tmp[1]=ULONG(ptr + S390X_WORD_SIZE);
@@ -1330,7 +1340,7 @@ s390x_get_stack_frame(struct bt_info *bt
/* get the stack pointer */
if(esp){
if (!LIVE() && s390x_has_cpu(bt)) {
- ksp = ULONG(lowcore + MEMBER_OFFSET("_lowcore",
+ ksp = ULONG(lowcore + MEMBER_OFFSET(lc_struct,
"gpregs_save_area") + (15 * S390X_WORD_SIZE));
} else {
readmem(bt->task + OFFSET(task_struct_thread_ksp),
12 years, 3 months
[PATCH] clean commnad line from pipe
by qiaonuohan
Hello Dave,
When I try to input gdb command through pipe, I find crash doesn't work
well, like below.
# echo -ne "gdb help\n gdb help" | ./crash -s
Undefined command: "". Try "help".
gdb: gdb request failed: help
No source file named help.
gdb: gdb request failed: b help
So I make the patch to clean command, please refer to the patch.
--
--
Regards
Qiao Nuohan
12 years, 3 months
[PATCH]: gcore extension, anonymous union in inode struct
by Per Fransson
Hi Crash people,
The gcore extension fails on the 3.4 kernel I'm using. It attempts to
find the offset of a member within the inode struct, but the member is
part of an anonymous union. This patch fixes the problem for me.
Regards,
Per
12 years, 3 months
[PATCH]: nr_node_ids
by Per Fransson
Hi all,
I'm wondering about the use of the kernel 'nr_node_ids' variable in
memory.c. In kmem_cache_downsize(), vt->kmem_cache_len_nodes defaults
to 1 when 'nr_node_ids' isn't present. But in vm_init() an error
message is printed in the same case. The reason I'm asking is that I'm
getting that error
"unable to initialize kmem slab cache subsystem"
on a 3.4 kernel. Having vm_init() default to
vt->kmem_cache_len_nodes=1
as well seems to bring up the slab subsystem, although I'm getting a couple of
"kmem: vm_area_struct: full list: slab: <nn1> bad next pointer: <nn2>"
mixed into my kmem -S output. I have no idea if it's related.
Regards,
Per
12 years, 3 months
resolve symbols: sial.so vs eppic.so
by Sebastian Ott
The way symbols are resolved in sial scripts is different between
sial.so and eppic.so. A symbol resolves to the address of the
symbol using sial.so and to the memory content using eppic.so.
In crash 6.0.9 I got e.g.:
crash> sym dev_kobj
979138 (b) dev_kobj
crash> rd dev_kobj
979138: 0000000174c9aac0 ....t...
crash> dev_kobj
dev_kobj = $3 = (struct kobject *) 0x174c9aac0
Using a sial script:
crash> !cat foo.sial
string foo_help() { return ""; }
string foo_opt() { return ""; }
string foo_usage() { return ""; }
int foo()
{
printf("0x%x\n", dev_kobj);
return 1;
}
./eppic.so: shared object loaded
crash> load foo.sial
crash> foo
0x74c9aac0
./sial.so: shared object loaded
crash> load foo.sial
crash> foo
0x979138
Is this an intentional change or a bug?
Regards,
Sebastian
12 years, 3 months