[Dwarf-Discuss] Does gcc optimization impacts retriving Dwarf information?

Michael Eager eager at eagercon.com
Fri May 29 08:47:47 PDT 2009


M. Mohan Kumar wrote:
> On Thu, May 28, 2009 at 08:55:31AM -0700, Michael Eager wrote:
>> Frank Ch. Eigler wrote:
>>> Hi -
>>>
>>> On Thu, May 28, 2009 at 02:57:08AM -0700, Michael Eager wrote:
>>>> [...]
>>>>> This problem (unable to retrieve variable values) raises two questions:
>>>>> 1. Does it mean that compiling with -O2 option removes some of the
>>>>> information needed by DWARF library functions?
>>>> [...]  DIEs for variables which do not have DW_AT_location
>>>> attributes do not have physical locations.  Your crash dump utility
>>>> should not attempt to find the locations or print the values for
>>>> these variables.
> 
> Hi Eager,
> 
> We checked the objdump of vmlinux and we observed:
> 
> linux-2.6.27.orig/arch/powerpc/platforms/pseries/setup.c:484
>   80352 c00000000003b06c:       a3 ed 00 0a     lhz     r31,10(r13)
> 
> and the corresponding C source is:
> 482 static void pseries_dedicated_idle_sleep(void)
> 483 {
> 484         unsigned int cpu = smp_processor_id();
> 
> So the variable 'cpu' is placed in the register r31 and whenever cpu needs
> to be accessed, r31 was used and not the value of variable cpu in the
> instruction. So is it a problem with GCC generating dwarf information?

The DWARF DIE which describes 'cpu' but probably should contain a location
expression which says that the value is in r31.



-- 
Michael Eager	 eager at eagercon.com
1960 Park Blvd., Palo Alto, CA 94306  650-325-8077



More information about the Dwarf-Discuss mailing list