dbghelp: merge dwarf code from ntdll/signal_x86_64.c

Eric Pouech eric.pouech at orange.fr
Mon Jan 11 15:29:07 CST 2010


André Hentschel a écrit :
> Eric Pouech schrieb:
>   
>> André Hentschel a écrit :
>>     
>>> thanks Eric Pouech for the reviews
>>> ---
>>>  dlls/dbghelp/dwarf.c |  229
>>> +++++++++++++++++++++++++++++++++++++++++---------
>>>  dlls/dbghelp/dwarf.h |   15 ++++
>>>  2 files changed, 204 insertions(+), 40 deletions(-)
>>>
>>> diff --git a/dlls/dbghelp/dwarf.c b/dlls/dbghelp/dwarf.c
>>> index 48e6351..d7f4f50 100644
>>> --- a/dlls/dbghelp/dwarf.c
>>> +++ b/dlls/dbghelp/dwarf.c
>>> @@ -241,6 +241,13 @@ static DWORD64 dwarf2_get_u8(const unsigned char*
>>> ptr)
>>>      return *(const UINT64*)ptr;
>>>  }
>>>  
>>> +static DWORD64 dwarf2_parse_u8(dwarf2_traverse_context_t* ctx)
>>> +{
>>> +    unsigned long uvalue = dwarf2_get_u8(ctx->data);
>>> +    ctx->data += 8;
>>> +    return uvalue;
>>> +}
>>> +
>>>  static unsigned long dwarf2_get_leb128_as_unsigned(const unsigned
>>> char* ptr, const unsigned char** end)
>>>  {
>>>      unsigned long ret = 0;
>>> @@ -344,6 +351,58 @@ static unsigned long
>>> dwarf2_parse_addr(dwarf2_traverse_context_t* ctx)
>>>      return ret;
>>>  }
>>>  
>>> +static ULONG_PTR dwarf2_get_ptr( const unsigned char **p, unsigned
>>> char encoding, unsigned word_size)
>>> +{
>>> +    ULONG_PTR base;
>>> +
>>> +    if (encoding == DW_EH_PE_omit) return 0;
>>> +
>>> +    switch (encoding & 0xf0)
>>> +    {
>>> +    case DW_EH_PE_abs:
>>> +        base = 0;
>>> +        break;
>>> +    case DW_EH_PE_pcrel:
>>> +        base = (ULONG_PTR)*p;
>>>   
>>>       
>> I'm afraid I've got some further comments
>> this is wrong, as it implies that the underlying ELF section (relative
>> to p) is mapped at same address between the process dbghelp is working
>> on (it has been mapped by the ELF loader) and where dbghelp has mapped
>> some ELF sections (likely in another process)
>>
>> a proper fix will require some extra work
>>
>> I've started doing it
>> So either so you do it properly, or you drop the EH frame support out of
>> this patch
>>
>> A+
>>
>>     
> I am not sure if thats critical as we dont access them in any way, we just read the address out of the context-structure and write it to our stack, as far as i looked at it.
> But if thats not true, then i think you have more knowledge to do this than me.
>
>   
it's not just a matter of dereferencing those values (and potentially 
crashing) (which shouldn't be the case) but rather copying code that 
just won't work (and will require some changes in the interfaces to do 
the job properly)
A+


-- 
Eric Pouech
"The problem with designing something completely foolproof is to underestimate the ingenuity of a complete idiot." (Douglas Adams)






More information about the wine-devel mailing list