[RFC] Enhance backtrace for microsoft system DLL calls

Pedro Alves pedro_alves@portugalmail.pt
Mon Dec 10 18:41:00 GMT 2007


> @@ -650,6 +650,17 @@ i386_analyze_frame_setup (CORE_ADDR pc,
>
>    read_memory_nobpt (pc, &op, 1);
>
> +  if (op == 0x8b) /* Ignore no-op instruction `mov %edi, %edi' */
> +    {
> +      read_memory_nobpt (pc + 1, &op, 1);
> +      if (op == 0xff)
> +       {
> +         pc += 2;
> +         read_memory_nobpt (pc, &op, 1);
> +       }
> +      else
> +       op = 0x8b;
> +    }
>    if (op == 0x55)              /* pushl %ebp */
>      {
>        /* Take into account that we've executed the `pushl %ebp' that
>
>
>

Oh, I forgot to ask on the previous mail  -- Is there a reason you don't
read both bytes in one go?

 /* small hot patching description here.  */
 gdb_byte hot_patch[2] = { 0x8b, 0xff };
 read_memory_nobpt (pc, buf, 2);
 if (memcmp (hot_patch, buf) == 0)
   pc += 2;

 read_memory_nobpt (pc, &op, 1);
 if (op == 0x55)              /* pushl %ebp */

 ... and since this isn't really frame setup code, it
could be moved into a separate function called from
i386_analyze_prologue, probably even before
i386_follow_jump, as this is put really at the
start of the function </end nit>

-- 
Pedro Alves



More information about the Gdb-patches mailing list