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]

Re: [NEWS/RFA] Re: [gdbserver] x86 agent expression bytecode compiler (speed up conditional tracepoints)


Doug Evans wrote:
On Mon, Jun 14, 2010 at 3:19 PM, Pedro Alves <pedro@codesourcery.com> wrote:
Thanks. I've checked the whole thing in.

I'm getting build failures that go away when compiling linux-x86-low.c with -g.


gcc is optimizing out the skipped over stuff I believe.

Hmm, this particular trickery was my idea, but it always seemed vulnerable to ever-smarter optimization. Does anybody have any better strategy? Declaring the asm volatile didn't work, because the compiler was whacking everything around it.


The other approach is to build up instructions from bitfields, which is reliable but needs a lot of setup and helper routines.

Stan

/* Our general strategy for emitting code is to avoid specifying raw bytes whenever possible, and instead copy a block of inline asm that is embedded in the function. This is a little messy, because we need to keep the compiler from discarding what looks like dead code, plus suppress various warnings. */

#define EMIT_ASM(NAME,INSNS)                                            \
  { extern unsigned char start_ ## NAME, end_ ## NAME;                  \
    add_insns (&start_ ## NAME, &end_ ## NAME - &start_ ## NAME);       \
    if (always_true ())                                         \
      goto skipover ## NAME;                                            \
    __asm__ ("start_" #NAME ":\n\t" INSNS "\n\tend_" #NAME ":\n\t");    \
    skipover ## NAME:                                                   \
    ; }



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