From: Josh Stone Date: Wed, 7 Nov 2012 19:41:16 +0000 (-0800) Subject: stapdyn: Workaround for an i686 Dyninst bug in argument passing X-Git-Tag: release-2.1~301 X-Git-Url: https://sourceware.org/git/?a=commitdiff_plain;h=2f29445de5deaa99bd319d0a7ac649ed6bfcac2f;p=systemtap.git stapdyn: Workaround for an i686 Dyninst bug in argument passing Dyninst appears to be filling only 32-bits for the index to enter_dyninst_uprobe_regs, which makes the following arguments shift badly too. This is reported upstream, but we can detect and work around it ourselves too. --- diff --git a/runtime/dyninst/uprobes.c b/runtime/dyninst/uprobes.c index 70ace0ddb..723600967 100644 --- a/runtime/dyninst/uprobes.c +++ b/runtime/dyninst/uprobes.c @@ -74,6 +74,16 @@ int enter_dyninst_uprobe_regs(uint64_t index, unsigned long nregs, ...) va_list varegs; va_start(varegs, nregs); +#ifdef __i386__ + // XXX Dyninst currently has a bug where it's only passing a 32-bit + // index, which means nregs gets stuffed into the upper bits of index, + // and the varegs are all off by one. Hacking it into shape for now... + if (index > UINT32_MAX) { + SET_REG_IP((®s), nregs); + nregs = index >> 32; + index &= UINT32_MAX; + } else +#endif if (nregs > 0) SET_REG_IP((®s), va_arg(varegs, unsigned long));