Gintracer: v0.6.1 - add stability
@fix * callgrah: fix bitmap transmission. * disasm: fix commands arguments error. * input: remove timer which cause concurrency error that could freeze the calculator. @update * disasm: you can press [(-)] to move the cursor directely into the current location * disasm: remove useless information. * move <src/menu/disassmbler/dictionary> into <src/menu/internal/dictionary> * add some syscalls information
This commit is contained in:
parent
1890fd39cf
commit
58a7717640
4
TODO.txt
4
TODO.txt
|
@ -1,9 +1,11 @@
|
|||
@update
|
||||
* call uninit() to each menu (disasm = set the next break point) !
|
||||
* fix fixed size 'space' character
|
||||
* disasm circular buffer (code only)
|
||||
* move <src/menu/disassembler/dictionary> to <src/menu/common>
|
||||
* fix tabulation
|
||||
|
||||
|
||||
@feature
|
||||
* display internal note (OS specific)
|
||||
* call graph export for laptop
|
||||
* night mode (refacto gui and handle color template)
|
||||
|
|
BIN
gintrace.g3a
BIN
gintrace.g3a
Binary file not shown.
|
@ -47,7 +47,6 @@ struct tracer {
|
|||
uint16_t *memory;
|
||||
uintptr_t next_break;
|
||||
uintptr_t next_instruction;
|
||||
uintptr_t spc;
|
||||
};
|
||||
|
||||
/* extern menu information */
|
||||
|
|
|
@ -28,9 +28,6 @@ struct {
|
|||
off_t cursor;
|
||||
char *data;
|
||||
} buffer;
|
||||
struct {
|
||||
int id;
|
||||
} timer;
|
||||
} input_info;
|
||||
|
||||
//---
|
||||
|
@ -46,13 +43,8 @@ void input_display(void)
|
|||
int x;
|
||||
int y;
|
||||
|
||||
/* stop the timer too avoid interrupt-loop */
|
||||
if (input_info.timer.id >= 0)
|
||||
timer_pause(input_info.timer.id);
|
||||
|
||||
/* mark special characte that the cursor is here */
|
||||
if (input_info.cursor.visible == 1)
|
||||
input_info.buffer.data[input_info.buffer.cursor] |= 0x80;
|
||||
/* add cursor mark */
|
||||
input_info.buffer.data[input_info.buffer.cursor] |= 0x80;
|
||||
|
||||
/* display part */
|
||||
cursor_x = 0;
|
||||
|
@ -85,23 +77,8 @@ void input_display(void)
|
|||
}
|
||||
dupdate();
|
||||
|
||||
|
||||
/* remove cursor mark */
|
||||
input_info.buffer.data[input_info.buffer.cursor] &= ~0x80;
|
||||
|
||||
/* restart the timer */
|
||||
if (input_info.timer.id >= 0)
|
||||
timer_start(input_info.timer.id);
|
||||
}
|
||||
|
||||
//---
|
||||
// Cursor management
|
||||
//---
|
||||
/* input_cursor_handler(): Involved at 0.5hz, blink the cursor */
|
||||
int input_cursor_handler(void) {
|
||||
input_info.cursor.visible ^= 1;
|
||||
input_display();
|
||||
return (0);
|
||||
}
|
||||
|
||||
//---
|
||||
|
@ -114,10 +91,6 @@ static void input_buffer_remove(void)
|
|||
if (input_info.buffer.cursor == 0)
|
||||
return;
|
||||
|
||||
/* stop the timer to avoid interrupt */
|
||||
if (input_info.timer.id >= 0)
|
||||
timer_pause(input_info.timer.id);
|
||||
|
||||
/* move data if needed */
|
||||
if (input_info.buffer.cursor < input_info.buffer.size - 1) {
|
||||
memcpy(
|
||||
|
@ -129,10 +102,6 @@ static void input_buffer_remove(void)
|
|||
/* force NULL-char and update cursor/size */
|
||||
input_info.buffer.cursor = input_info.buffer.cursor - 1;
|
||||
input_info.buffer.data[--input_info.buffer.size - 1] = '\0';
|
||||
|
||||
/* restart the timer */
|
||||
if (input_info.timer.id >= 0)
|
||||
timer_start(input_info.timer.id);
|
||||
}
|
||||
|
||||
/* input_buffer_insert() - Insert character based on current cursor position */
|
||||
|
@ -142,10 +111,6 @@ static int input_buffer_insert(char n)
|
|||
if (input_info.buffer.size + 1 >= input_info.buffer.max)
|
||||
return (-1);
|
||||
|
||||
/* stop the timer to avoid interrupt */
|
||||
if (input_info.timer.id >= 0)
|
||||
timer_pause(input_info.timer.id);
|
||||
|
||||
/* move data if needed */
|
||||
if (input_info.buffer.cursor < input_info.buffer.size - 1) {
|
||||
off_t i = input_info.buffer.size + 1;
|
||||
|
@ -157,10 +122,6 @@ static int input_buffer_insert(char n)
|
|||
/* insert the character and force NULL-char */
|
||||
input_info.buffer.data[input_info.buffer.cursor++] = n;
|
||||
input_info.buffer.data[++input_info.buffer.size] = '\0';
|
||||
|
||||
/* restart the timer */
|
||||
if (input_info.timer.id >= 0)
|
||||
timer_start(input_info.timer.id);
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
@ -268,12 +229,6 @@ int input_read(char *buffer, size_t size)
|
|||
input_info.buffer.size = 1;
|
||||
input_info.buffer.max = size;
|
||||
|
||||
/* start cursor blink timer */
|
||||
input_info.timer.id = timer_setup(TIMER_ANY, 250000,
|
||||
(void*)&input_cursor_handler);
|
||||
if (input_info.timer.id >= 0)
|
||||
timer_start(input_info.timer.id);
|
||||
|
||||
/* Gint workaround to freeze the current display */
|
||||
dgetvram(&main, &secondary);
|
||||
if (gint_vram == main) {
|
||||
|
@ -285,6 +240,7 @@ int input_read(char *buffer, size_t size)
|
|||
|
||||
/* keyboard handling */
|
||||
while (input_info.mode.exit == 0) {
|
||||
input_display();
|
||||
key = getkey_opt(GETKEY_REP_ALL | GETKEY_MENU, NULL);
|
||||
spe = input_key_handle_special(key);
|
||||
if (spe < 0) {
|
||||
|
@ -293,12 +249,7 @@ int input_read(char *buffer, size_t size)
|
|||
}
|
||||
if (spe == 0)
|
||||
input_key_buffer_update(key);
|
||||
input_display();
|
||||
}
|
||||
|
||||
/* stop the timer */
|
||||
if (input_info.timer.id >= 0)
|
||||
timer_stop(input_info.timer.id);
|
||||
return (input_info.buffer.size);
|
||||
}
|
||||
|
||||
|
|
|
@ -64,10 +64,14 @@ static void gintrace_handler(struct ucontext *context)
|
|||
/* casio_handler(): Casio handler */
|
||||
static void casio_handler(void)
|
||||
{
|
||||
#if 0
|
||||
void (*bfile_openfile_os)(const uint16_t *filename, int mode, int p3);
|
||||
|
||||
bfile_openfile_os = syscall;
|
||||
bfile_openfile_os(u"\\fls0\\dyntest", BFile_ReadOnly, 0);
|
||||
#endif
|
||||
void (*debug_menu_filesystem)(void) = syscall;
|
||||
debug_menu_filesystem();
|
||||
}
|
||||
|
||||
/* main(): User entry */
|
||||
|
@ -82,17 +86,15 @@ int main(void)
|
|||
|
||||
/* get syscall address */
|
||||
void **systab = *(void ***)0x8002007c;
|
||||
syscall = systab[0x1da3];
|
||||
syscall = systab[0x1e48];
|
||||
|
||||
|
||||
/* intialize UBC information */
|
||||
ubc_install();
|
||||
ubc_set_handler(&gintrace_handler);
|
||||
//ubc_set_breakpoint(0, (void*)0x80358a6c, NULL);
|
||||
ubc_set_breakpoint(0, syscall, NULL);
|
||||
|
||||
/* try to trace the function */
|
||||
//gint_switch((void *)0x80358a6c); // stack menu (syscall %1e66)
|
||||
gint_switch((void*)&casio_handler);
|
||||
|
||||
//TODO : destructor part !!
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
#include <gint/keyboard.h>
|
||||
#include <gint/display.h>
|
||||
|
||||
#include "./src/menu/disassembler/dictionary.h"
|
||||
#include "./src/menu/internal/dictionary.h"
|
||||
|
||||
/* define the menu information */
|
||||
/* TODO: find a way to have local information (session) */
|
||||
|
@ -58,13 +58,6 @@ static void callnode_display(struct callnode *node, uint32_t bitmap[4],
|
|||
|
||||
if (node == NULL || *row + callgraph.cursor.voffset >= GUI_DISP_NB_ROW)
|
||||
return;
|
||||
if (*row + callgraph.cursor.voffset < 0) {
|
||||
*row = *row + 1;
|
||||
callnode_display(node->child, bitmap, row, depth + 1);
|
||||
callnode_display(node->sibling, bitmap, row, depth);
|
||||
return;
|
||||
}
|
||||
|
||||
/* handle the bitmap (ugly / 20) */
|
||||
i = -1;
|
||||
idx = 0;
|
||||
|
@ -73,7 +66,8 @@ static void callnode_display(struct callnode *node, uint32_t bitmap[4],
|
|||
if (idx >= 4)
|
||||
break;
|
||||
shift = i & 0x1f;
|
||||
if ((bitmap[idx] & (1 << shift)) != 0) {
|
||||
if ((bitmap[idx] & (1 << shift)) != 0
|
||||
&& *row + callgraph.cursor.voffset >= 0) {
|
||||
dtext((2 + callgraph.cursor.hoffset + (i << 2))
|
||||
* (FWIDTH + 1), (*row
|
||||
+ callgraph.cursor.voffset)
|
||||
|
@ -108,6 +102,16 @@ static void callnode_display(struct callnode *node, uint32_t bitmap[4],
|
|||
type = "(rts)";
|
||||
pipe = '`';
|
||||
}
|
||||
|
||||
/* skip display part */
|
||||
if (*row + callgraph.cursor.voffset < 0) {
|
||||
*row = *row + 1;
|
||||
callnode_display(node->child, bitmap, row, depth + 1);
|
||||
callnode_display(node->sibling, bitmap, row, depth);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
const char *addrname =
|
||||
disasm_dictionary_check_syscalls((void*)node->address);
|
||||
if (addrname == NULL) {
|
|
@ -7,8 +7,7 @@
|
|||
#include <gint/keyboard.h>
|
||||
#include <gint/display.h>
|
||||
|
||||
/* bad architectur */
|
||||
#include "./src/menu/disassembler/dictionary.h"
|
||||
#include "./src/menu/internal/dictionary.h"
|
||||
|
||||
/* define the menu information */
|
||||
/* TODO: find a way to have local information (session) */
|
|
@ -4,7 +4,7 @@
|
|||
#include "gintrace/gui/display.h"
|
||||
#include "gintrace/gui/input.h"
|
||||
|
||||
#include "./src/menu/disassembler/dictionary.h"
|
||||
#include "./src/menu/internal/dictionary.h"
|
||||
|
||||
#include <gint/std/string.h>
|
||||
#include <gint/std/stdlib.h>
|
||||
|
@ -344,7 +344,6 @@ static void disasm_init(struct ucontext *context)
|
|||
tracer.buffer.anchor.addr = (void*)(uintptr_t)((context->spc + 1) & ~1);
|
||||
tracer.next_break = context->spc;
|
||||
tracer.next_instruction = context->spc;
|
||||
tracer.spc = context->spc;
|
||||
|
||||
tracer.buffer.cursor.note_idx = 0;
|
||||
tracer.buffer.cursor.line_idx = 0;
|
||||
|
@ -450,6 +449,8 @@ static int disasm_keyboard(struct ucontext *context, int key)
|
|||
tracer.next_break += 2;
|
||||
if (key == KEY_MINUS)
|
||||
tracer.next_break -= 2;
|
||||
if (key == KEY_NEG)
|
||||
tracer.next_break = (uintptr_t)tracer.buffer.anchor.addr;
|
||||
|
||||
/* skip instruction */
|
||||
if (key == KEY_OPTN) {
|
||||
|
@ -495,11 +496,11 @@ static void disasm_command(struct ucontext *context, int argc, char **argv)
|
|||
}
|
||||
goto error_part;
|
||||
}
|
||||
if (i >= 8)
|
||||
if (i > 8)
|
||||
goto error_part;
|
||||
|
||||
if ((action & 1) == 1) {
|
||||
tracer.spc = address & ~3;
|
||||
tracer.buffer.anchor.addr = (void*)(address & ~1);
|
||||
tracer.buffer.cursor.note_idx = 0;
|
||||
tracer.buffer.cursor.line_idx = 0;
|
||||
i = disasm_util_line_update(tracer.buffer.cursor.line_idx, -1);
|
|
@ -1,4 +1,4 @@
|
|||
#include "./src/menu/disassembler/dictionary.h"
|
||||
#include "./src/menu/internal/dictionary.h"
|
||||
#include <gint/std/stdio.h>
|
||||
|
||||
//---
|
|
@ -1,4 +1,4 @@
|
|||
#include "./src/menu/disassembler/dictionary.h"
|
||||
#include "./src/menu/internal/dictionary.h"
|
||||
#include <gint/std/stdio.h>
|
||||
|
||||
/* disasm_dictionaru_check_peripheral(): Check preipheral address */
|
|
@ -1,4 +1,4 @@
|
|||
#include "./src/menu/disassembler/dictionary.h"
|
||||
#include "./src/menu/internal/dictionary.h"
|
||||
|
||||
#include <gint/std/stdio.h>
|
||||
|
||||
|
@ -615,6 +615,12 @@ const struct sysname casio_syscalls[] = {
|
|||
//
|
||||
// Yatis
|
||||
//
|
||||
{.syscall = 0x0ea6, .name = "void Debug_menu_TestMode(void);"},
|
||||
{.syscall = 0x0ea7, .name = "void Debug_menu_TestMode(int unknown);"},
|
||||
{.syscall = 0x1e44, .name = "void Debug_menu_FileSystem(void);"},
|
||||
{.syscall = 0x1e45, .name = "void Debug_menu_Fugue_OpenFileInfo(void);"},
|
||||
{.syscall = 0x1e48, .name = "void Debug_menu_Fugue_VolumeInfo(void);"},
|
||||
{.syscall = 0x1e49, .name = "void Debug_menu_Fugue_LogInfo(void);"},
|
||||
{.syscall = 0x1e66, .name = "void Debug_menu_stackAndHeap(void);"},
|
||||
|
||||
//
|
Loading…
Reference in New Issue