diff options
Diffstat (limited to 'src/lj_gdbjit.c')
-rw-r--r-- | src/lj_gdbjit.c | 13 |
1 files changed, 2 insertions, 11 deletions
diff --git a/src/lj_gdbjit.c b/src/lj_gdbjit.c index 284195a1..334a906e 100644 --- a/src/lj_gdbjit.c +++ b/src/lj_gdbjit.c | |||
@@ -14,6 +14,7 @@ | |||
14 | #include "lj_err.h" | 14 | #include "lj_err.h" |
15 | #include "lj_debug.h" | 15 | #include "lj_debug.h" |
16 | #include "lj_frame.h" | 16 | #include "lj_frame.h" |
17 | #include "lj_buf.h" | ||
17 | #include "lj_jit.h" | 18 | #include "lj_jit.h" |
18 | #include "lj_dispatch.h" | 19 | #include "lj_dispatch.h" |
19 | 20 | ||
@@ -426,16 +427,6 @@ static void gdbjit_catnum(GDBJITctx *ctx, uint32_t n) | |||
426 | *ctx->p++ = '0' + n; | 427 | *ctx->p++ = '0' + n; |
427 | } | 428 | } |
428 | 429 | ||
429 | /* Add a ULEB128 value. */ | ||
430 | static void gdbjit_uleb128(GDBJITctx *ctx, uint32_t v) | ||
431 | { | ||
432 | uint8_t *p = ctx->p; | ||
433 | for (; v >= 0x80; v >>= 7) | ||
434 | *p++ = (uint8_t)((v & 0x7f) | 0x80); | ||
435 | *p++ = (uint8_t)v; | ||
436 | ctx->p = p; | ||
437 | } | ||
438 | |||
439 | /* Add a SLEB128 value. */ | 430 | /* Add a SLEB128 value. */ |
440 | static void gdbjit_sleb128(GDBJITctx *ctx, int32_t v) | 431 | static void gdbjit_sleb128(GDBJITctx *ctx, int32_t v) |
441 | { | 432 | { |
@@ -452,7 +443,7 @@ static void gdbjit_sleb128(GDBJITctx *ctx, int32_t v) | |||
452 | #define DU16(x) (*(uint16_t *)p = (x), p += 2) | 443 | #define DU16(x) (*(uint16_t *)p = (x), p += 2) |
453 | #define DU32(x) (*(uint32_t *)p = (x), p += 4) | 444 | #define DU32(x) (*(uint32_t *)p = (x), p += 4) |
454 | #define DADDR(x) (*(uintptr_t *)p = (x), p += sizeof(uintptr_t)) | 445 | #define DADDR(x) (*(uintptr_t *)p = (x), p += sizeof(uintptr_t)) |
455 | #define DUV(x) (ctx->p = p, gdbjit_uleb128(ctx, (x)), p = ctx->p) | 446 | #define DUV(x) (p = (uint8_t *)lj_buf_wuleb128((char *)p, (x))) |
456 | #define DSV(x) (ctx->p = p, gdbjit_sleb128(ctx, (x)), p = ctx->p) | 447 | #define DSV(x) (ctx->p = p, gdbjit_sleb128(ctx, (x)), p = ctx->p) |
457 | #define DSTR(str) (ctx->p = p, gdbjit_strz(ctx, (str)), p = ctx->p) | 448 | #define DSTR(str) (ctx->p = p, gdbjit_strz(ctx, (str)), p = ctx->p) |
458 | #define DALIGNNOP(s) while ((uintptr_t)p & ((s)-1)) *p++ = DW_CFA_nop | 449 | #define DALIGNNOP(s) while ((uintptr_t)p & ((s)-1)) *p++ = DW_CFA_nop |