RFC: dwarf merge patch

Eric Pouech eric.pouech at orange.fr
Thu Jan 21 15:23:00 CST 2010


André Hentschel a écrit :
> Eric Pouech schrieb:
>   
>> André Hentschel a écrit :
>>     
>>> Hi,
>>> I made a patch to merge code from ntdll/signal_x86_64.c to
>>> dbghelp/dwarf.c
>>> The operator DW_OP_deref_size needs to read different sizes of
>>> variables from memory into a fixed size variable.
>>> Now i am not sure if my solution is the smallest and easiest one, so i
>>> would be happy for every comment on this.
>>>
>>> http://www.winehq.org/pipermail/wine-patches/2010-January/083899.html
>>>   
>>>       
>> you could factorize all the calls to ReadProcessMemory into a single
>> one, then use more explicit integral conversion
>>
>> BYTE deref[8];
>> if (!ReadProcessMemory(hproc, (void*)addr, &deref, derefsize, NULL))
>> {
>>     WARN("Couldn't read memory at %lx\n", addr);
>>        return loc_err_cant_read;
>> }
>>
>> switch (derefsize)
>> {
>>    case 1: stack[++stk] = *(unsigned char*)&deref; break;
>>    case 2: stack[++stk] = *(unsigned short*)&deref; break;
>>    case 4: stack[++stk] = *(DWORD*)&deref; break;
>>    case 8: stack[++stk] = *(DWORD64*)&deref; break;
>> }
>>
>> A+
>>
>>     
> Hi Eric,
> correct me if i am wrong, but IMO that leads to problems with endianess(Big Endian vs. Little Endian).
> In that case, is my last implementation ok or should i extend yours to be aware of endianess?
>
>   
no
it just implies that debugger and debuggee use the same integral storage 
convetion
it could cause however some alignment faults on some hardware
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