RFC: dwarf merge patch
Eric Pouech
eric.pouech at orange.fr
Wed Jan 20 14:08:53 CST 2010
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+
--
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