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

Ian Lance Taylor
2010-06-16T23:58:15Z

Doug Evans <dje@google.com> writes:

> This worked with the gcc4.4.0 variant I was using.
>
> Ian: Is there a Right way to do this?

I don't know about a right way, but since this code is both gcc and
x86 specific, I think I would just write something along the lines of

#define EMIT_ASM(NAME, INSNS) \
do \
{ \
extern unsigned char start_ ## NAME, end_ ## NAME; \
add_insns (&start_ ## NAME, &end_ ## NAME - &start_ ## NAME); \
asm ("jmp end_" NAME "\; start_" NAME ":\;" INSNS "\; end_" NAME ":"); \
} while (0)

Ian