RFC: dwarf merge patch

André Hentschel nerv at dawncrow.de
Thu Jan 21 11:44:39 CST 2010


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?

-- 

Best Regards, André Hentschel



More information about the wine-devel mailing list