From d3f80c1e9f144ac73bfcb9f60d64158a2803bbc6 Mon Sep 17 00:00:00 2001 From: Andrew Eikum Date: Mon, 24 May 2010 17:48:36 -0500 Subject: [PATCH] winedbg: Allow user to specify length of stack info output. --- programs/winedbg/dbg.y | 3 ++- programs/winedbg/debugger.h | 2 +- programs/winedbg/info.c | 2 +- programs/winedbg/stack.c | 13 ++++++++----- programs/winedbg/tgt_active.c | 2 +- programs/winedbg/tgt_minidump.c | 2 +- 6 files changed, 14 insertions(+), 10 deletions(-) diff --git a/programs/winedbg/dbg.y b/programs/winedbg/dbg.y index 855407f9f99..336f99319b5 100644 --- a/programs/winedbg/dbg.y +++ b/programs/winedbg/dbg.y @@ -274,7 +274,8 @@ info_command: | tINFO tALLREGS { be_cpu->print_context(dbg_curr_thread->handle, &dbg_context, 1); } | tINFO tSEGMENTS expr_rvalue { info_win32_segments($3 >> 3, 1); } | tINFO tSEGMENTS { info_win32_segments(0, -1); } - | tINFO tSTACK { stack_info(); } + | tINFO tSTACK tNUM { stack_info($3); } + | tINFO tSTACK { stack_info(-1); } | tINFO tSYMBOL tSTRING { symbol_info($3); } | tINFO tLOCAL { symbol_info_locals(); } | tINFO tDISPLAY { display_info(); } diff --git a/programs/winedbg/debugger.h b/programs/winedbg/debugger.h index 8ebac1e08f5..ae949f26c7e 100644 --- a/programs/winedbg/debugger.h +++ b/programs/winedbg/debugger.h @@ -384,7 +384,7 @@ extern void source_nuke_path(struct dbg_process* p); extern void source_free_files(struct dbg_process* p); /* stack.c */ -extern void stack_info(void); +extern void stack_info(int len); extern void stack_backtrace(DWORD threadID); extern BOOL stack_set_frame(int newframe); extern BOOL stack_get_current_frame(IMAGEHLP_STACK_FRAME* ihsf); diff --git a/programs/winedbg/info.c b/programs/winedbg/info.c index e501f43e6a4..a09af5d167e 100644 --- a/programs/winedbg/info.c +++ b/programs/winedbg/info.c @@ -106,7 +106,7 @@ void info_help(void) " info segments Displays information about all known segments", " info share Displays all loaded modules", " info share Displays internal module state", - " info stack Dumps information about top of stack", + " info stack [] Dumps information about top of stack, up to len words", " info symbol Displays information about a given symbol", " info thread Shows all running threads", " info wnd Displays internal window state", diff --git a/programs/winedbg/stack.c b/programs/winedbg/stack.c index bccb56aeb91..be535f9b1e2 100644 --- a/programs/winedbg/stack.c +++ b/programs/winedbg/stack.c @@ -33,12 +33,15 @@ /*********************************************************************** * stack_info * - * Dump the top of the stack + * Dump the top of the stack. If len <= 0, a default length is used. */ -void stack_info(void) +void stack_info(int len) { struct dbg_lvalue lvalue; + if(len <= 0) + len = 24; + lvalue.cookie = 0; lvalue.type.id = dbg_itype_segptr; lvalue.type.module = 0; @@ -51,14 +54,14 @@ void stack_info(void) switch (lvalue.addr.Mode) { case AddrModeFlat: /* 32-bit or 64-bit mode */ - memory_examine(&lvalue, 24, 'a'); + memory_examine(&lvalue, len, 'a'); break; case AddrMode1632: /* 32-bit mode */ - memory_examine(&lvalue, 24, 'x'); + memory_examine(&lvalue, len, 'x'); break; case AddrModeReal: /* 16-bit mode */ case AddrMode1616: - memory_examine(&lvalue, 24, 'w'); + memory_examine(&lvalue, len, 'w'); break; } } diff --git a/programs/winedbg/tgt_active.c b/programs/winedbg/tgt_active.c index 0572d9558f1..c0c12dd261a 100644 --- a/programs/winedbg/tgt_active.c +++ b/programs/winedbg/tgt_active.c @@ -182,7 +182,7 @@ static unsigned dbg_exception_prolog(BOOL is_debug, BOOL first_chance, const EXC { /* This is a real crash, dump some info */ be_cpu->print_context(dbg_curr_thread->handle, &dbg_context, 0); - stack_info(); + stack_info(-1); be_cpu->print_segment_info(dbg_curr_thread->handle, &dbg_context); stack_backtrace(dbg_curr_tid); } diff --git a/programs/winedbg/tgt_minidump.c b/programs/winedbg/tgt_minidump.c index f099b4e8b67..c24fd8c46bc 100644 --- a/programs/winedbg/tgt_minidump.c +++ b/programs/winedbg/tgt_minidump.c @@ -389,7 +389,7 @@ static enum dbg_start minidump_do_reload(struct tgt_process_minidump_data* data) memory_get_current_pc(&addr); stack_fetch_frames(&dbg_context); be_cpu->print_context(dbg_curr_thread->handle, &dbg_context, 0); - stack_info(); + stack_info(-1); be_cpu->print_segment_info(dbg_curr_thread->handle, &dbg_context); stack_backtrace(mes->ThreadId); source_list_from_addr(&addr, 0);