tag:blogger.com,1999:blog-29331675.post2429694435562662050..comments2024-03-05T17:37:00.995+01:00Comments on The Delphi Geek: Debugging With Lazy Breakpointsgabr42http://www.blogger.com/profile/06903558857617342477noreply@blogger.comBlogger18125tag:blogger.com,1999:blog-29331675.post-57214209483524376202022-11-09T15:15:19.631+01:002022-11-09T15:15:19.631+01:00RE "Delphi should ... allow you to look at th...RE "Delphi should ... allow you to look at the stack and inspect local variables"<br />Press Ctrl-Alt-C to bring up the CPU window, F8 to single step, then close the CPU window. Debugger is now at the line that caught the exception. If the offending line is inside a try..except block you can now see the local variables.<br /><br />But I like your idea. Gonna try it out.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-29331675.post-91305718592202386632022-11-09T15:09:27.855+01:002022-11-09T15:09:27.855+01:00RE "Delphi should ... allow you to look at th...RE "Delphi should ... allow you to look at the stack and inspect local variables"<br />Press Ctrl-Alt-C to bring up the CPU window, F8 to single step, then close the CPU window. Debugger is now at the line that caught the exception. If the offending line is inside a try..except block you can now see the local variables.<br /><br />But I like your idea. Gonna try it out.<br />Guy Gordonnoreply@blogger.comtag:blogger.com,1999:blog-29331675.post-9821239383938543622008-03-06T11:55:00.000+01:002008-03-06T11:55:00.000+01:00We're using our own stack tracer, based on the Hal...We're using our own stack tracer, based on the Hallvard Vassbotn's work, and sometimes madExcept, which is simply great so I'm no stranger to stack traces.<BR/><BR/>But in this case stack trace was not enough - the problem depended on a state of various internal structures and you can't see that from a stack trace.<BR/><BR/>BTW, the trick I mentioned already helped. While working on another issue I caught the problem in the debugger and solved it in ten minutes. It was simple once I understood the cause.gabr42https://www.blogger.com/profile/06903558857617342477noreply@blogger.comtag:blogger.com,1999:blog-29331675.post-89653716154422592862008-03-06T11:30:00.000+01:002008-03-06T11:30:00.000+01:00This is were MadExcept scores. You can get your ap...This is were MadExcept scores. You can get your application to email you when an exception occurs along with the stack and line number of where the exception occurs.<BR/><BR/>We use MadExcept to log these errors in an event log in our applications.<BR/><BR/>Dave CraggsAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-29331675.post-16713886899270506232008-03-05T17:23:00.000+01:002008-03-05T17:23:00.000+01:00sm2, what are you trying to say?sm2, what are you trying to say?gabr42https://www.blogger.com/profile/06903558857617342477noreply@blogger.comtag:blogger.com,1999:blog-29331675.post-57200069156343483572008-03-05T17:15:00.000+01:002008-03-05T17:15:00.000+01:00The empty post. Just "asm int 3 end;" and that's a...The empty post. Just "asm int 3 end;" and that's all.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-29331675.post-18228899997734064022008-03-05T07:40:00.000+01:002008-03-05T07:40:00.000+01:00Do read what I wrote again.Breakpoints will stay i...Do read what I wrote again.<BR/><BR/>Breakpoints will stay in place during the day, may stay in place for days, but edit the unit in question for many days on many machines and you can be sure that they won't be placed at the original position after a week.gabr42https://www.blogger.com/profile/06903558857617342477noreply@blogger.comtag:blogger.com,1999:blog-29331675.post-36294656313781946402008-03-04T13:43:00.000+01:002008-03-04T13:43:00.000+01:00you may just write asm nop; end;instead of asm int...you may just write <BR/><I>asm nop; end;</I><BR/>instead of <BR/><I>asm int 3; end;</I><BR/>and set breakpoint thereAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-29331675.post-8245870625129189452008-03-04T10:53:00.000+01:002008-03-04T10:53:00.000+01:00My current practice in a huge, old and unstable pr...My current practice in a huge, old and unstable project (tends to break Delphi/Debugger) is: <BR/>Raising a "silent" exception (descending from EAbort), immediately catching it and using JCL's handler to log the call stack (plus some additional info, like tempvars and/or instvars). <BR/>This works really great when a bug occurs only in customers environment and w can't reproduce it.Viktorhttps://www.blogger.com/profile/01102622925380077305noreply@blogger.comtag:blogger.com,1999:blog-29331675.post-53406706864943337992008-03-04T07:57:00.000+01:002008-03-04T07:57:00.000+01:00Why not assert? Because assert raises an exception...Why not assert? Because assert raises an exception and something in this project interfers with Delphi debugger and exception handling in such a way that I can't examine variables on the stack when exception occurs.gabr42https://www.blogger.com/profile/06903558857617342477noreply@blogger.comtag:blogger.com,1999:blog-29331675.post-77963396912919331072008-03-04T07:25:00.000+01:002008-03-04T07:25:00.000+01:00We have some tests that throw expected exceptions,...We have some tests that throw expected exceptions, but we don't generally have problems with the debugger.<BR/><BR/>First of all, we only run under the debugger when we absolutely have to. We usually use "Run without debugging" (Ctrl+Shift+F9). The tests load and run faster if you're not debugging. And besides, we got in the habit of avoiding the debugger back when we were on Delphi 2005 and 2006, when the debugger crashed all the time. (2007's debugger seems pretty stable, though.)<BR/><BR/>Second, when we do need to debug, we'll just go into the DUnit GUI and uncheck all the tests except the one we're trying to troubleshoot. As a general thing, tests should be fine-grained enough that any one test won't throw-and-catch more than one exception (each exception should usually be its own test), so again, having the debugger stop on exceptions isn't a big deal.Unknownhttps://www.blogger.com/profile/04747855792846273047noreply@blogger.comtag:blogger.com,1999:blog-29331675.post-35457417621803476612008-03-04T01:13:00.000+01:002008-03-04T01:13:00.000+01:00why not asserts?why not asserts?Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-29331675.post-13715059130530825732008-03-04T01:11:00.000+01:002008-03-04T01:11:00.000+01:00Why you do not use asserts?Why you do not use asserts?Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-29331675.post-81921038260099768362008-03-03T17:55:00.000+01:002008-03-03T17:55:00.000+01:00Sorry, no idea. But maybe some other reader knows?...Sorry, no idea. But maybe some other reader knows?gabr42https://www.blogger.com/profile/06903558857617342477noreply@blogger.comtag:blogger.com,1999:blog-29331675.post-16821984130819090822008-03-03T16:41:00.000+01:002008-03-03T16:41:00.000+01:00In a related question: how can I programmatically ...In a related question: how can I programmatically disable the exception-handling of the debugger?<BR/><BR/>In some situations, an exception is rightly expected (for example in unit-tests) - But I wish I could make de debugger ignore those specific occurrances (I know I can ignore the whole exception-class, but that's a bit too much for my intent).<BR/><BR/>Any ideas?Patrickhttps://www.blogger.com/profile/00573028757978933821noreply@blogger.comtag:blogger.com,1999:blog-29331675.post-4574796290445829152008-03-03T15:58:00.000+01:002008-03-03T15:58:00.000+01:00how about just improve your logging instead?how about just improve your logging instead?BlackTigerXhttps://www.blogger.com/profile/05376454374607771065noreply@blogger.comtag:blogger.com,1999:blog-29331675.post-31274309935793698612008-03-03T12:20:00.000+01:002008-03-03T12:20:00.000+01:00Bah, Win32 API is for sissies.Just kidding. Thanks...Bah, Win32 API is for sissies.<BR/><BR/>Just kidding. Thanks for pointing it out.<BR/><BR/>I guess I'm just too caught in old school programming habbits. If I recall correctly, INT 3 is a legacy from DOS times.gabr42https://www.blogger.com/profile/06903558857617342477noreply@blogger.comtag:blogger.com,1999:blog-29331675.post-74458913151246883642008-03-03T12:14:00.000+01:002008-03-03T12:14:00.000+01:00You can also use the WinAPI DebugBreak().You can also use the WinAPI DebugBreak().Anonymousnoreply@blogger.com