From 40d44f5a884144733ff9c1f066a357f8f75eb1a2 Mon Sep 17 00:00:00 2001 From: chen Date: Sat, 11 Apr 2026 21:23:39 +0800 Subject: [PATCH] Add env REMAKE_PS for custom color prompt --- libdebugger/cmd.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/libdebugger/cmd.c b/libdebugger/cmd.c index 551488c4e..1554cd729 100644 --- a/libdebugger/cmd.c +++ b/libdebugger/cmd.c @@ -242,10 +242,17 @@ debug_return_t enter_debugger (target_stack_node_t *p, volatile debug_return_t debug_return = debug_readloop; static bool b_init = false; static bool b_readline_init = false; + static bool b_ps_init = false; + static char *custom_ps = NULL; char open_depth[MAX_NEST_DEPTH]; char close_depth[MAX_NEST_DEPTH]; unsigned int i = 0; + if (!b_ps_init) { + custom_ps = getenv("REMAKE_PS"); + b_ps_init = true; + } + last_stop_reason = reason; if ( in_debugger == DEBUGGER_QUIT_RC ) { @@ -360,14 +367,14 @@ debug_return_t enter_debugger (target_stack_node_t *p, #ifdef HAVE_LIBREADLINE if (use_readline_flag) { - snprintf(prompt, PROMPT_LENGTH, "remake%s%d%s ", - open_depth, where_history(), close_depth); + snprintf(prompt, PROMPT_LENGTH, "%s%s%d%s ", + custom_ps ? custom_ps : "remake", open_depth, where_history(), close_depth); line = readline (prompt); } else #endif /* HAVE_LIBREADLINE */ { - snprintf(prompt, PROMPT_LENGTH, "remake%s0%s ", open_depth, + snprintf(prompt, PROMPT_LENGTH, "%s%s0%s ", custom_ps ? custom_ps : "remake", open_depth, close_depth); printf("%s", prompt); if (line == NULL) line = calloc(1, 2048);