[Crash-utility] Re: [PATCH 0/2] Display local variables & function parameters fromstack frames

Sharyathi Nagesh sharyath at in.ibm.com
Mon May 11 06:16:31 UTC 2009


Dave
	Excuse me for the late response, My laptop HW crashed and had some 
difficulty accessing mails.
	Packaging and x86_64/x86 support is still work in progress, we are 
hitting some unwinding issues with x86_64 code and trying to fix them 
along with local.mk changes. More help on the packaging front / 
re-writing local.mk will be an added favor :)

Dave Anderson wrote:
> ----- "Sharyathi Nagesh" <sharyath at in.ibm.com> wrote:
> 
>> Hi
>> 	Mohan, Sachin and myself have implemented this feature in crash to 
>> display local variables and arguments from vmcore dumps. This feature
>> introduces a new command 'local' in crash utility which provides
>> interface for stack unwinding along with option to display local
>> variables and arguments. This patch is based on crash utility
>> crash-4.0-8.9. It has dependency on libdw/libelf libraries provided by
>> elfutils package.
>> 	This has been tested on dumps taken on ppc64 machine. We were able to 
>> unwind the stack as well as display local variables, arguments. It 
>> currently displays values for non-optimized variables only (this fallows 
>> gdb's convention)
>>
>> TODO Items:
>> 	1. Support on x86_64 and x86 need to be implemented/tested
>> 	2. Makefile need to be updated to help packaging this feature
>> 	
>> Regards
>> Sharyathi Nagesh
> 
> A couple suggestions -- move the get_netdump_arch() and get_regs_from_elf_notes()
> prototypes to defs.h under the others listed for netdump.c.
> 
> Then remove this from local.c:
> 
>   + #include <../netdump.h>
> 
> By removing the netdump.h inclusion, you can build your package with just
> the "defs.h" file like so:
Sure that can be done
> 
>   # make -f local.mk TARGET=X86_64
>   gcc -nostartfiles -shared -g -rdynamic -o local.so local.c unwind_dw.c -fPIC \
>       -ldw -L ../../elfutils-0.137/libdw -I ../../elfutils-0.137/libdw \
>       -I ../../elfutils-0.137/libelf/ -DX86_64   -Wall;
>   #
> 
> Also, the TARGET_FLAGS setting you have in your local.mk doesn't do anything.
> I see that you copied it from the sial.mk file, where it's used as a replacement
> in sial.mk to replace the suggested "-D$(TARGET) $(TARGET_CFLAGS)" part of the
> compile line.  For x86_64 nothing is needed in TARGET_CFLAGS -- these are what
> the supported arches need:

Oops my apologies for overlooking this, yes we will correct this

>   #define TARGET_CFLAGS_X86    "TARGET_CFLAGS=-D_FILE_OFFSET_BITS=64"
>   #define TARGET_CFLAGS_ALPHA  "TARGET_CFLAGS="
>   #define TARGET_CFLAGS_PPC    "TARGET_CFLAGS=-D_FILE_OFFSET_BITS=64"
>   #define TARGET_CFLAGS_IA64   "TARGET_CFLAGS="
>   #define TARGET_CFLAGS_S390   "TARGET_CFLAGS=-D_FILE_OFFSET_BITS=64"
>   #define TARGET_CFLAGS_S390X  "TARGET_CFLAGS="
>   #define TARGET_CFLAGS_PPC64  "TARGET_CFLAGS=-m64"
>   #define TARGET_CFLAGS_X86_64 "TARGET_CFLAGS="

Ok we will include this, after verifying
> 
> So I presume you do need the -m64 for ppc64, but I don't see how your
> local.mk file would pick it up?  I also don't understand where your extra
> $ADD_CFLAGS is supposed to get set up?
This is again copied from some other code and need to be removed

> 
> For that matter, the additional -L and -I for the elfutils stuff you've added
> seem to be unnecessary, just -ldw seems to be suffice:
> 
>   # make -f local2.mk TARGET=X86_64
>   gcc -nostartfiles -shared -g -rdynamic -o local.so local.c unwind_dw.c -fPIC -ldw -DX86_64 -Wall; 
>   # 
Yes you are right, along with that code has some requirements like 
libdw/libelf already installed and elfutils installed is version > 
0.125, as this library has a bug that breaks the code, needs to be checked

Thanks for the information, we will try our best to fix some issues we 
are facing and incorporate these changes

Thanks
Yeehaw




More information about the Crash-utility mailing list