Andrew Eikum : winedbg: Allow user to specify length of stack info output.

Alexandre Julliard julliard at winehq.org
Tue May 25 12:06:09 CDT 2010


Module: wine
Branch: master
Commit: d3f80c1e9f144ac73bfcb9f60d64158a2803bbc6
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=d3f80c1e9f144ac73bfcb9f60d64158a2803bbc6

Author: Andrew Eikum <aeikum at codeweavers.com>
Date:   Mon May 24 17:48:36 2010 -0500

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 855407f..336f993 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 8ebac1e..ae949f2 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 e501f43..a09af5d 100644
--- a/programs/winedbg/info.c
+++ b/programs/winedbg/info.c
@@ -106,7 +106,7 @@ void info_help(void)
             "  info segments <pid>  Displays information about all known segments",
             "  info share           Displays all loaded modules",
             "  info share <addr>    Displays internal module state",
-            "  info stack           Dumps information about top of stack",
+            "  info stack [<len>]   Dumps information about top of stack, up to len words",
             "  info symbol <sym>    Displays information about a given symbol",
             "  info thread          Shows all running threads",
             "  info wnd <handle>    Displays internal window state",
diff --git a/programs/winedbg/stack.c b/programs/winedbg/stack.c
index bccb56a..be535f9 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 0572d95..c0c12dd 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 f099b4e..c24fd8c 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);




More information about the wine-cvs mailing list