mirror of
https://github.com/ptitSeb/box64.git
synced 2025-10-13 18:07:41 +08:00
[GDBJIT] Show x64pc in gdb, also added documentation (#2163)
* [GDBJIT] Show x64pc in gdb * Add env. variable and documentation * typo * oops
This commit is contained in:
@@ -239,6 +239,11 @@ Behavior with FillBlock is not available (FillBlock build Dynarec blocks and is
|
||||
* 0 : Dynarec will not wait for FillBlock to ready and use Interpreter instead (might speedup a bit massive multithread or JIT programs)
|
||||
* 1 : Dynarec will wait for FillBlock to be ready (Default)
|
||||
|
||||
#### BOX64_DYNAREC_GDBJIT *
|
||||
The GDBJIT debugging support, only available with the compilation option GDBJIT=ON, enable it with gdb command: jit-reader-load /usr/local/lib/libbox64gdbjitreader.so.
|
||||
* 0 : Dynarec will not generate GDBJIT debuginfo. (Default)
|
||||
* 1 : Dynarec will generate GDBJIT debuginfo.
|
||||
|
||||
#### BOX64_DYNAREC_MISSING *
|
||||
Dynarec print the missing opcodes
|
||||
* 0 : not print the missing opcode (Default, unless DYNAREC_LOG>=1 or DYNAREC_DUMP>=1 is used)
|
||||
|
@@ -367,6 +367,13 @@ Behavior with FillBlock is not available (FillBlock build Dynarec blocks and is
|
||||
* 0 : Dynarec will not wait for FillBlock to ready and use Interpreter instead (might speedup a bit massive multithread or JIT programs)
|
||||
* 1 : Dynarec will wait for FillBlock to be ready (Default)
|
||||
|
||||
=item B<BOX64_DYNAREC_GDBJIT>=I<0|1>
|
||||
|
||||
The GDBJIT debugging support, only available with the compilation option GDBJIT=ON, enable it with gdb command: jit-reader-load /usr/local/lib/libbox64gdbjitreader.so.
|
||||
|
||||
* 0 : Dynarec will not generate GDBJIT debuginfo. (Default)
|
||||
* 1 : Dynarec will generate GDBJIT debuginfo.
|
||||
|
||||
=item B<BOX64_SSE_FLUSHTO0>=I<0|1>
|
||||
|
||||
Handling of SSE Flush to 0 flags
|
||||
|
@@ -1,4 +1,7 @@
|
||||
#include "gdbjit.h"
|
||||
#include <stdio.h>
|
||||
|
||||
static char block_name_buffer[16];
|
||||
|
||||
static enum gdb_status read_debug_info(struct gdb_reader_funcs* self, struct gdb_symbol_callbacks* cbs, void* memory, long memory_sz)
|
||||
{
|
||||
@@ -6,7 +9,8 @@ static enum gdb_status read_debug_info(struct gdb_reader_funcs* self, struct gdb
|
||||
|
||||
struct gdb_object* object = cbs->object_open(cbs);
|
||||
struct gdb_symtab* symtab = cbs->symtab_open(cbs, object, block->filename);
|
||||
cbs->block_open(cbs, symtab, NULL, block->start, block->end, "(block)");
|
||||
sprintf(block_name_buffer, "%x", block->x64start);
|
||||
cbs->block_open(cbs, symtab, NULL, block->start, block->end, block_name_buffer);
|
||||
|
||||
cbs->line_mapping_add(cbs, symtab, block->nlines, block->lines);
|
||||
|
||||
|
11
src/core.c
11
src/core.c
@@ -72,7 +72,6 @@ int box64_rdtsc_1ghz = 0;
|
||||
uint8_t box64_rdtsc_shift = 0;
|
||||
char* box64_insert_args = NULL;
|
||||
char* box64_new_args = NULL;
|
||||
int box64_dynarec_gdbjit = 1;
|
||||
#ifdef DYNAREC
|
||||
int box64_dynarec = 1;
|
||||
int box64_dynarec_dump = 0;
|
||||
@@ -98,6 +97,7 @@ uintptr_t box64_nodynarec_start = 0;
|
||||
uintptr_t box64_nodynarec_end = 0;
|
||||
uintptr_t box64_dynarec_test_start = 0;
|
||||
uintptr_t box64_dynarec_test_end = 0;
|
||||
int box64_dynarec_gdbjit = 0;
|
||||
#ifdef ARM64
|
||||
int arm64_asimd = 0;
|
||||
int arm64_aes = 0;
|
||||
@@ -901,6 +901,15 @@ void LoadLogEnv()
|
||||
if(!box64_dynarec_wait)
|
||||
printf_log(LOG_INFO, "Dynarec will not wait for FillBlock to ready and use Interpreter instead\n");
|
||||
}
|
||||
p = getenv("BOX64_DYNAREC_GDBJIT");
|
||||
if(p) {
|
||||
if(strlen(p)==1) {
|
||||
if(p[0]>='0' && p[0]<='1')
|
||||
box64_dynarec_gdbjit = p[0]-'0';
|
||||
}
|
||||
if(box64_dynarec_gdbjit)
|
||||
printf_log(LOG_INFO, "Dynarec will generate debuginfo for gdbjit\n");
|
||||
}
|
||||
p = getenv("BOX64_DYNAREC_ALIGNED_ATOMICS");
|
||||
if(p) {
|
||||
if(strlen(p)==1) {
|
||||
|
@@ -754,7 +754,7 @@ void* FillBlock64(dynablock_t* block, uintptr_t addr, int alternate, int is32bit
|
||||
dynarec_log(LOG_NONE, "%s\n", (box64_dynarec_dump>1)?"\e[m":"");
|
||||
}
|
||||
if (box64_dynarec_gdbjit) {
|
||||
GdbJITNewBlock(helper.gdbjit_block, (GDB_CORE_ADDR)block->actual_block, (GDB_CORE_ADDR)block->actual_block + native_size);
|
||||
GdbJITNewBlock(helper.gdbjit_block, (GDB_CORE_ADDR)block->actual_block, (GDB_CORE_ADDR)block->actual_block + native_size, helper.start);
|
||||
}
|
||||
int oldtable64size = helper.table64size;
|
||||
size_t oldnativesize = helper.native_size;
|
||||
|
@@ -11,19 +11,20 @@ typedef struct gdbjit_block_s {
|
||||
FILE* file;
|
||||
GDB_CORE_ADDR start;
|
||||
GDB_CORE_ADDR end;
|
||||
uintptr_t alloced;
|
||||
uintptr_t x64start;
|
||||
size_t alloced;
|
||||
size_t nlines;
|
||||
struct gdb_line_mapping lines[0];
|
||||
} gdbjit_block_t;
|
||||
|
||||
|
||||
void GdbJITNewBlock(gdbjit_block_t* block, GDB_CORE_ADDR start, GDB_CORE_ADDR end);
|
||||
void GdbJITNewBlock(gdbjit_block_t* block, GDB_CORE_ADDR start, GDB_CORE_ADDR end, uintptr_t x64start);
|
||||
gdbjit_block_t* GdbJITBlockAddLine(gdbjit_block_t* block, GDB_CORE_ADDR addr, const char* line);
|
||||
void GdbJITBlockReady(gdbjit_block_t* block);
|
||||
|
||||
#else
|
||||
|
||||
#define GdbJITNewBlock(a, b, c)
|
||||
#define GdbJITNewBlock(a, b, c, d)
|
||||
#define GdbJITBlockAddLine(a, b, c) NULL
|
||||
#define GdbJITBlockReady(a)
|
||||
|
||||
|
@@ -46,7 +46,7 @@ gdbjit_descriptor_t __jit_debug_descriptor = { 1, GDBJIT_NOACTION, NULL, NULL };
|
||||
|
||||
/* --------------------------------------------------------------------------- */
|
||||
|
||||
void GdbJITNewBlock(gdbjit_block_t* block, GDB_CORE_ADDR start, GDB_CORE_ADDR end)
|
||||
void GdbJITNewBlock(gdbjit_block_t* block, GDB_CORE_ADDR start, GDB_CORE_ADDR end, uintptr_t x64start)
|
||||
{
|
||||
if (!block)
|
||||
return;
|
||||
@@ -59,6 +59,7 @@ void GdbJITNewBlock(gdbjit_block_t* block, GDB_CORE_ADDR start, GDB_CORE_ADDR en
|
||||
|
||||
block->start = start;
|
||||
block->end = end;
|
||||
block->x64start = x64start;
|
||||
block->alloced = block->nlines = 0;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user