This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH 4/8] Implement target_emit_ops
- From: Antoine Tremblay <antoine dot tremblay at ericsson dot com>
- To: Yao Qi <qiyaoltc at gmail dot com>, <gdb-patches at sourceware dot org>, Pierre Langlois <pierre dot langlois at arm dot com>
- Date: Fri, 5 Feb 2016 15:09:22 -0500
- Subject: Re: [PATCH 4/8] Implement target_emit_ops
- Authentication-results: sourceware.org; auth=none
- References: <1442230282-20751-1-git-send-email-pierre dot langlois at arm dot com> <1442580184-22562-1-git-send-email-yao dot qi at linaro dot org> <1442580184-22562-5-git-send-email-yao dot qi at linaro dot org>
On 09/18/2015 08:43 AM, Yao Qi wrote:
From: Pierre Langlois <pierre.langlois@arm.com>
This patch implements compiling agent expressions to native code for
AArch64. This allows us to compile conditions set on fast tracepoints.
The compiled function has the following prologue:
High *------------------------------------------------------*
| LR |
| FP | <- FP
| x1 (ULONGEST *value) |
| x0 (unsigned char *regs) |
Low *------------------------------------------------------*
We save the function's argument on the stack as well as the return
address and the frame pointer. We then set the current frame pointer to
point to the previous one.
The generated code for the expression will freely update the stack
pointer so we use the frame pointer to refer to `*value' and `*regs'.
`*value' needs to be accessed in the epilogue of the function, in order
to set it to whatever is on top of the stack. `*regs' needs to be passed
down to the `gdb_agent_get_reg' function with the `reg' operation.
+static void
+aarch64_emit_prologue (void)
+{
+ uint32_t buf[16];
+ uint32_t *p = buf;
+
+ /* This function emit a prologue for the following function prototype:
+
+ e
....
Hi,
I'm working on adding JIT compiling of agent expressions for ARM and
I've been looking at the aarch64 implementation.
I'm wondering is there a reason we don't use gcc to generate the
native bytecode like done on x86 ?
x86 has a macro like so :
#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 "\n"
"\t" "start_" #NAME ":"
"\t" INSNS "\n"
"\t" "end_" #NAME ":");
} while (0)
Could the same be done for armv7 or there's a reason that prevents it ?
Same question for aarch64 ?
Thanks,
Antoine