Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Message-ID: <000901c4efdf$7e29f180$0200000a@agamemnon> From: "Jon A. Lambert" To: "Cygwin Mail List" Subject: Stackdump trace - problem and patch Date: Sat, 1 Jan 2005 03:54:23 -0500 MIME-Version: 1.0 Content-Type: text/plain; format=flowed; charset="iso-8859-1"; reply-type=original Content-Transfer-Encoding: 7bit X-IsSubscribed: yes I was having this difficulty debugging a crashed application. I was using Cygwin environmental variable error_start to either call dumper or gdb. Both a core dump and invoking gdb didn't show anything relevant to my application. I tried various means of examining and setting the registers in the stack to get to a frame that was within my app. I have read the various messages on the list describing how to get to those frames. It's rather tricky, and it availed me not. Probably a personal problem. ;-) So I gave up on that, removed error_start and reran the app. Well the resulting stackdump file looked great. That is to say it was a nice clean stack that described a normal screwup on my part. The only problem with it was it only displays 16 entries. Well I needed more to pinpoint the problem because my app is pretty deeply nested. Well I patched up my cygwin and recompiled to show me more. I just added a tracesize option to the Cygwin environment variable. Anyway here's what I done to it. It might be useful or might not. --- environ.cc.orig 2005-01-01 03:15:33.913185600 -0500 +++ environ.cc 2005-01-01 03:16:55.670747200 -0500 @@ -34,6 +34,7 @@ extern bool allow_winsymlinks; extern bool strip_title_path; extern int pcheck_case; extern int subauth_id; +extern int tracesize; bool reset_com = false; static bool envcache = true; #ifdef USE_SERVER @@ -500,6 +501,12 @@ set_smbntsec (const char *buf) allow_smbntsec = (buf && strcasematch (buf, "yes") && wincap.has_security ()); } +static void +set_tracesize (const char *buf) +{ + int tracesize = strtol (buf, NULL, 0); +} + /* The structure below is used to set up an array which is used to parse the CYGWIN environment variable or, if enabled, options from the registry. */ @@ -541,6 +548,7 @@ static struct parse_thing {"strip_title", {&strip_title_path}, justset, NULL, {{false}, {true}}}, {"subauth_id", {func: &subauth_id_init}, isfunc, NULL, {{0}, {0}}}, {"title", {&display_title}, justset, NULL, {{false}, {true}}}, + {"tracesize", {func: set_tracesize}, isfunc, NULL, {{0}, {0}}}, {"tty", {NULL}, set_process_state, NULL, {{0}, {PID_USETTY}}}, {"winsymlinks", {&allow_winsymlinks}, justset, NULL, {{false}, {true}}}, {NULL, {0}, justset, 0, {{0}, {0}}} --- exceptions.cc.orig 2004-10-18 13:41:37.001000000 -0400 +++ exceptions.cc 2005-01-01 03:19:53.115900800 -0500 @@ -265,6 +265,8 @@ stack_info::walk () return 1; } +int tracesize = 16; + static void stackdump (DWORD ebp, int open_file, bool isexception) { @@ -280,7 +282,7 @@ stackdump (DWORD ebp, int open_file, boo thestack.init (ebp, 1, !isexception); /* Initialize from the input CONTEXT */ small_printf ("Stack trace:\r\nFrame Function Args\r\n"); - for (i = 0; i < 16 && thestack++; i++) + for (i = 0; i < tracesize && thestack++; i++) { small_printf ("%08x %08x ", thestack.sf.AddrFrame.Offset, thestack.sf.AddrPC.Offset); -- Jon A. Lambert -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/