<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 10pt;
font-family:Verdana
}
--></style>
</head>
<body class='hmmessage'>
> We should do the same for POSIX too I think.<BR>
<BR>
Posix just calls abort.<BR>
<BR>
Posix:<BR>
PROCEDURE Crash () =<BR> BEGIN<BR> Cstdlib.abort ();<BR> LOOP END; (* wait *)<BR> END Crash;<BR><BR>
<BR>
Win32:<BR>
<BR>
<BR>PROCEDURE Crash () =<BR> CONST Magic = 1 * ADRSIZE (INTEGER); (* == offset of "fp" in this frame *)<BR> VAR fp: ADDRESS := ADR (fp) + Magic; (* == my frame pointer *)<BR> BEGIN<BR> IF WinBase.IsDebuggerPresent () # 0 THEN (* I moved these three lines up. *) <BR> WinBase.DebugBreak ();<BR> END;<BR> RTThread.SuspendOthers ();<BR> RTMachInfo.DumpStack (LOOPHOLE (Crash, ADDRESS), fp);<BR> RTSignal.RestoreHandlers (); (* so we really do crash... *)<BR> Exit (-1);<BR> END Crash;<BR><BR>
<BR>
That said..I'm missing something and I should review the code.<BR>
Obviously there are calls elsewhere to DumpStack, and they or may not be similarly crufty.<BR>
<BR>
<BR>
/Actually/ one thing I'd like is for the m3core to be able to dump better callstacks.<BR>
Like, the ability to carry more debuginfo of its own custom format in itself.<BR>
Like, to get line numbers.<BR>
<BR>
<BR>
- Jay<BR> <BR>
<HR id=stopSpelling>
From: hosking@cs.purdue.edu<BR>Date: Fri, 11 Dec 2009 10:00:35 -0500<BR>To: jkrell@elego.de<BR>CC: m3commit@elegosoft.com<BR>Subject: Re: [M3commit] CVS Update: cm3<BR><BR>We should do the same for POSIX too I think.
<DIV>
<DIV><SPAN style="TEXT-TRANSFORM: none; TEXT-INDENT: 0px; BORDER-COLLAPSE: separate; FONT: 12px Helvetica; WHITE-SPACE: normal; LETTER-SPACING: normal; COLOR: rgb(0,0,0); WORD-SPACING: 0px" class=ecxApple-style-span><SPAN style="TEXT-TRANSFORM: none; TEXT-INDENT: 0px; BORDER-COLLAPSE: separate; FONT: 12px Helvetica; WHITE-SPACE: normal; LETTER-SPACING: normal; COLOR: rgb(0,0,0); WORD-SPACING: 0px" class=ecxApple-style-span>
<DIV style="WORD-WRAP: break-word"><SPAN style="TEXT-TRANSFORM: none; TEXT-INDENT: 0px; BORDER-COLLAPSE: separate; FONT: 12px Helvetica; WHITE-SPACE: normal; LETTER-SPACING: normal; COLOR: rgb(0,0,0); WORD-SPACING: 0px" class=ecxApple-style-span><SPAN style="TEXT-TRANSFORM: none; TEXT-INDENT: 0px; BORDER-COLLAPSE: separate; FONT: 12px Helvetica; WHITE-SPACE: normal; LETTER-SPACING: normal; COLOR: rgb(0,0,0); WORD-SPACING: 0px" class=ecxApple-style-span><SPAN style="TEXT-TRANSFORM: none; TEXT-INDENT: 0px; BORDER-COLLAPSE: separate; FONT: 12px Helvetica; WHITE-SPACE: normal; LETTER-SPACING: normal; COLOR: rgb(0,0,0); WORD-SPACING: 0px" class=ecxApple-style-span><SPAN style="TEXT-TRANSFORM: none; TEXT-INDENT: 0px; BORDER-COLLAPSE: separate; FONT: 12px Helvetica; WHITE-SPACE: normal; LETTER-SPACING: normal; COLOR: rgb(0,0,0); WORD-SPACING: 0px" class=ecxApple-style-span><SPAN style="TEXT-TRANSFORM: none; TEXT-INDENT: 0px; BORDER-COLLAPSE: separate; FONT: 12px Helvetica; WHITE-SPACE: normal; LETTER-SPACING: normal; COLOR: rgb(0,0,0); WORD-SPACING: 0px" class=ecxApple-style-span><SPAN style="TEXT-TRANSFORM: none; TEXT-INDENT: 0px; BORDER-COLLAPSE: separate; FONT: 12px Helvetica; WHITE-SPACE: normal; LETTER-SPACING: normal; COLOR: rgb(0,0,0); WORD-SPACING: 0px" class=ecxApple-style-span><SPAN style="TEXT-TRANSFORM: none; TEXT-INDENT: 0px; BORDER-COLLAPSE: separate; FONT: 12px Helvetica; WHITE-SPACE: normal; LETTER-SPACING: normal; COLOR: rgb(0,0,0); WORD-SPACING: 0px" class=ecxApple-style-span><SPAN style="TEXT-TRANSFORM: none; TEXT-INDENT: 0px; BORDER-COLLAPSE: separate; FONT: 12px Helvetica; WHITE-SPACE: normal; LETTER-SPACING: normal; COLOR: rgb(0,0,0); WORD-SPACING: 0px" class=ecxApple-style-span>
<DIV><SPAN style="FONT-SIZE: medium" class=ecxApple-style-span><FONT class=ecxApple-style-span color=#0000ff face="'Gill Sans'"><BR></FONT></SPAN></DIV></SPAN></SPAN></SPAN></SPAN></SPAN></SPAN></SPAN></SPAN></DIV></SPAN></SPAN></DIV>
<DIV>
<DIV>On 11 Dec 2009, at 12:42, Jay Krell wrote:</DIV><BR class=ecxApple-interchange-newline>
<BLOCKQUOTE>
<DIV>CVSROOT:<SPAN style="WHITE-SPACE: pre" class=ecxApple-tab-span> </SPAN>/usr/cvs<BR>Changes by:<SPAN style="WHITE-SPACE: pre" class=ecxApple-tab-span> </SPAN>jkrell@birch.<SPAN style="WHITE-SPACE: pre" class=ecxApple-tab-span> </SPAN>09/12/11 12:42:57<BR><BR>Modified files:<BR><SPAN style="WHITE-SPACE: pre" class=ecxApple-tab-span></SPAN>cm3/m3-libs/m3core/src/runtime/WIN32/: Tag: <BR><SPAN style="WHITE-SPACE: pre" class=ecxApple-tab-span></SPAN> release_branch_cm3_5_8 <BR><SPAN style="WHITE-SPACE: pre" class=ecxApple-tab-span></SPAN> RTOS.m3 <BR><BR>Log message:<BR><SPAN style="WHITE-SPACE: pre" class=ecxApple-tab-span></SPAN>port from head: very small change that makes debugging sometimes much better<BR><SPAN style="WHITE-SPACE: pre" class=ecxApple-tab-span></SPAN>(break right into debugger, don't waste time trying to suspend threads<BR><SPAN style="WHITE-SPACE: pre" class=ecxApple-tab-span></SPAN>and dump stacks, the debugger does a much better job of suspending<BR><SPAN style="WHITE-SPACE: pre" class=ecxApple-tab-span></SPAN>threads and usually (if you have symbols) of dumping stacks)<BR><SPAN style="WHITE-SPACE: pre" class=ecxApple-tab-span></SPAN>If you aren't using a debugger, then no change.<BR><SPAN style="WHITE-SPACE: pre" class=ecxApple-tab-span></SPAN><BR><SPAN style="WHITE-SPACE: pre" class=ecxApple-tab-span></SPAN>The thing about RestoreHandlers can probably just be removed since<BR><SPAN style="WHITE-SPACE: pre" class=ecxApple-tab-span></SPAN>in my brief experience the DebugBreak works fine before it.<BR><SPAN style="WHITE-SPACE: pre" class=ecxApple-tab-span></SPAN><BR><SPAN style="WHITE-SPACE: pre" class=ecxApple-tab-span></SPAN>Really it can probably just go like this:<BR><SPAN style="WHITE-SPACE: pre" class=ecxApple-tab-span></SPAN>If debugger<BR><SPAN style="WHITE-SPACE: pre" class=ecxApple-tab-span></SPAN>debugbreak<BR><SPAN style="WHITE-SPACE: pre" class=ecxApple-tab-span></SPAN>ELSE<BR><SPAN style="WHITE-SPACE: pre" class=ecxApple-tab-span></SPAN>suspend others, maybe<BR><SPAN style="WHITE-SPACE: pre" class=ecxApple-tab-span></SPAN>dumpstack one of the important parts<BR><SPAN style="WHITE-SPACE: pre" class=ecxApple-tab-span></SPAN>restore handlers probably can be removed<BR><SPAN style="WHITE-SPACE: pre" class=ecxApple-tab-span></SPAN>Exit(-1) also important though maybe should be TerminateProcess which is much quicker/cleaner<BR><SPAN style="WHITE-SPACE: pre" class=ecxApple-tab-span></SPAN>doesn't run all the dllmains<BR><SPAN style="WHITE-SPACE: pre" class=ecxApple-tab-span></SPAN><BR><SPAN style="WHITE-SPACE: pre" class=ecxApple-tab-span></SPAN>though currently I just made the small change of moving the debugbreak much earlier</DIV></BLOCKQUOTE></DIV></DIV> </body>
</html>