Jak symulować Delphi breakpoint w kodzie?
Jestem prawie pewien, że widziałem to wcześniej, ale nie dowiedziałem się / pamiętałem, jak to zrobić. Chcę mieć wiersz kodu, który po wykonaniu z debugera Delphi chcę, aby debuger wyskakiwał, jakby na tej linii był punkt przerwania.
Coś w stylu:
FooBar := Foo(Bar);
SimulateBreakPoint; // Cause break point to occur in Delphi IDE if attached
WriteLn('Value: ' + FooBar);
Mam nadzieję, że to ma sens. Wiem, że przydałby mi się wyjątek, ale to byłoby o wiele bardziej kosztowne niż chcę. To dla jakiegoś kodu demonstracyjnego.
Z góry dzięki! 25
2 answers
Aby uruchomić debugger z kodu (podobno nie mam pod ręką kopii delphi do wypróbowania):
asm int 3 end;
Zobacz tę stronę:
Http://17slon.com/blogs/gabr/2008/03/debugging-with-lazy-breakpoints.html
37
Author: Joeri Sebrechts,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2008-10-02 05:47:38
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2008-10-02 05:47:38
Jak stwierdził Andreas Hausladen w komentarzach do tego artykułu, funkcja DebugBreak() API Win32 jest mniej DOS-owska i działa równie dobrze.
14
Author: gabr,
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2008-10-02 05:59:44
Warning: date(): Invalid date.timezone value 'Europe/Kyiv', we selected the timezone 'UTC' for now. in /var/www/agent_stack/data/www/doraprojects.net/template/agent.layouts/content.php on line 54
2008-10-02 05:59:44