This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[patch] gdb.arch/amd64-pseudo.c: Mark regs as clobbered


On Mon, Sep 24, 2012 at 5:29 PM,  <dje@google.com> wrote:
> Hi.
>
> I was seeing amd64-dword.exp fail because gcc was using a register
> for local variable "data" from the previous asm in the next asm,
> even though the testcase has gdb modifying the register in between.
>
> This patch just informs gcc that the relevant registers are clobbered.
>
> Ok to check in?
> I'd check this in as obvious, but maybe there's something I'm missing.
>
> 2012-09-24  Doug Evans  <dje@google.com>
>
>         * gdb.arch/amd64-pseudo.c (main): Mark registers that the testsuite
>         changes as clobbered (e.g., amd64-dword.exp) so gcc doesn't try to
>         use them.
>
> Index: gdb.arch/amd64-pseudo.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/testsuite/gdb.arch/amd64-pseudo.c,v
> retrieving revision 1.3
> diff -u -p -r1.3 amd64-pseudo.c
> --- gdb.arch/amd64-pseudo.c     4 Jan 2012 08:17:44 -0000       1.3
> +++ gdb.arch/amd64-pseudo.c     25 Sep 2012 00:25:10 -0000
> @@ -63,6 +63,14 @@ main (int argc, char **argv)
>         : "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15");
>    asm ("nop"); /* second breakpoint here */
>
> +  /* amd64-dword.exp writes eax-edi here.
> +     Tell gcc they're clobbered so it doesn't try to keep "data" in
> +     one of them.  */
> +  asm (""
> +       : /* no outputs */
> +       : /* no inputs */
> +       : "eax", "ebx", "ecx", "edx", "esi", "edi");
> +
>    asm ("mov %%eax, 0(%0)\n\t"
>         "mov %%ebx, 4(%0)\n\t"
>         "mov %%ecx, 8(%0)\n\t"
> @@ -74,6 +82,14 @@ main (int argc, char **argv)
>         : "eax", "ebx", "ecx", "edx", "esi", "edi");
>    asm ("nop"); /* third breakpoint here */
>
> +  /* amd64-dword.exp writes r8-r15 here.
> +     Tell gcc they're clobbered so it doesn't try to keep "data" in
> +     one of them.  */
> +  asm (""
> +       : /* no outputs */
> +       : /* no inputs */
> +       : "r8", "r9", "r10", "r11", "r12", "r13", "r14", "r15");
> +
>    asm ("mov %%r8d, 24(%0)\n\t"
>         "mov %%r9d, 28(%0)\n\t"
>         "mov %%r10d, 32(%0)\n\t"


Hi.
I will check this in in a few days if there are no objections.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]