Solved

Stop Delphi Debugging into System.pas _HandleFinally

Posted on 2010-09-06
9
1,155 Views
Last Modified: 2013-11-23
I have a big application.

When debugging and I come accross a "raise exception" in my application, Delphi asks me if I want to Break or Continue?

If I select Break the debugger puts me on the line where the raise was issued.

If I then hit F8 once it takes me to the end of the procedure.

If I hit it once more it takes me into soem assembly code in the middle of _HandleFinally in System.pas.

How can I stop this?
0
Comment
Question by:enigmasolutions
  • 5
  • 4
9 Comments
 
LVL 36

Assisted Solution

by:Geert Gruwez
Geert Gruwez earned 500 total points
ID: 33611442
in the .dpr (project options), switch off checkbox "use debug dcu's"

this will switch off the debugging into native vcl system files



you need to recompile your app, for this to be in effect
0
 
LVL 1

Author Comment

by:enigmasolutions
ID: 33611447
This only started happenign recently.
The only thing I can think is that I added FastMM4.
0
 
LVL 36

Expert Comment

by:Geert Gruwez
ID: 33611547
usually a program like that adds a compiler directive
which does the same as in the project options
0
 
LVL 1

Author Comment

by:enigmasolutions
ID: 33611587
Thanks Geert.

Yes, but it is set to false!!! (in the IDE that is).

Hmm I just checked MyApp.dproj and I notice that debugDCUs=true - see below

removing this line in this file fixed the problem

I "think" I also tried to change it in the IDE (eg turning it on / turnign it off) - but it didn't seem to help.

FYI - The "corrupted" dproj file was my fault (due to poor version control).


            <PropertyGroup Condition="'$(Cfg_1)'!=''">
                  <DCC_LocalDebugSymbols>false</DCC_LocalDebugSymbols>
                  <DCC_DebugInformation>false</DCC_DebugInformation>
                  <DCC_SymbolReferenceInfo>0</DCC_SymbolReferenceInfo>
                  <DCC_Define>RELEASE;$(DCC_Define)</DCC_Define>
            </PropertyGroup>
            <PropertyGroup Condition="'$(Cfg_2)'!=''">
                  <DCC_DebugDCUs>true</DCC_DebugDCUs>
                  <DCC_SymbolReferenceInfo>2</DCC_SymbolReferenceInfo>
                  <DCC_MapFile>3</DCC_MapFile>
                  <DCC_Define>DEBUG;$(DCC_Define)</DCC_Define>
            </PropertyGroup>

0
Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

 
LVL 1

Author Comment

by:enigmasolutions
ID: 33611663
Whoa,

FastMM4 has masses of compiler directives.

I wonder if this setting in MyApp.DPROJ was caused by FastMM4.

See code here.  NOTE: From memory, I think I added the first {$D-} without any benefit.

Can you see anything in this code that migth cause the change to MyApp.DPROJ


{$D-} //prevent debugging into this unit



unit FastMM4;



interface



{$Include FastMM4Options.inc}



{$RANGECHECKS OFF}

{$BOOLEVAL OFF}

{$OVERFLOWCHECKS OFF}

{$OPTIMIZATION ON}

{$TYPEDADDRESS OFF}



{IDE debug mode always enables FullDebugMode and dynamic loading of the FullDebugMode DLL.}

{$ifdef FullDebugModeInIDE}

  {$define InstallOnlyIfRunningInIDE}

  {$define FullDebugMode}

  {$define LoadDebugDLLDynamically}

{$endif}



{Install in FullDebugMode only when the DLL is available?}

{$ifdef FullDebugModeWhenDLLAvailable}

  {$define FullDebugMode}

  {$define LoadDebugDLLDynamically}

  {$define DoNotInstallIfDLLMissing}

{$endif}



{Some features not currently supported under Kylix}

{$ifdef Linux}

  {$undef FullDebugMode}

  {$undef LogErrorsToFile}

  {$undef LogMemoryLeakDetailToFile}

  {$undef ShareMM}

  {$undef AttemptToUseSharedMM}

  {$undef RequireIDEPresenceForLeakReporting}

  {$undef UseOutputDebugString}

  {$ifdef PIC}

    {BASM version does not support position independent code}

    {$undef ASMVersion}

  {$endif}

{$endif}



{Do we require debug info for leak checking?}

{$ifdef RequireDebugInfoForLeakReporting}

  {$ifopt D-}

    {$undef EnableMemoryLeakReporting}

  {$endif}

{$endif}



{Enable heap checking and leak reporting in full debug mode}

{$ifdef FullDebugMode}

  {$STACKFRAMES ON}

  {$define CheckHeapForCorruption}

  {$ifndef CatchUseOfFreedInterfaces}

    {$define CheckUseOfFreedBlocksOnShutdown}

  {$endif}

{$else}

  {Error logging requires FullDebugMode}

  {$undef LogErrorsToFile}

  {$undef CatchUseOfFreedInterfaces}

  {$undef RawStackTraces}

  {$undef AlwaysAllocateTopDown}

{$endif}



{Only the Pascal version supports extended heap corruption checking.}

{$ifdef CheckHeapForCorruption}

  {$undef ASMVersion}

{$endif}



{$ifdef UseRuntimePackages}

  {$define AssumeMultiThreaded}

{$endif}



{Delphi versions}

{$ifndef BCB}

  {$ifdef ver120}

    {$define Delphi4or5}

  {$endif}

  {$ifdef ver130}

    {$define Delphi4or5}

  {$endif}

  {$ifdef ver140}

    {$define Delphi6}

  {$endif}

  {$ifdef ver150}

    {$define Delphi7}

  {$endif}

  {$ifdef ver170}

    {$define Delphi2005}

  {$endif}

{$else}

  {$ifndef PatchBCBTerminate}

    {Cannot uninstall safely under BCB}

    {$define NeverUninstall}

    {Disable memory leak reporting}

    {$undef EnableMemoryLeakReporting}

  {$endif}

  {for BCB4, use the Delphi 5 codepath}

  {$ifdef ver120}

    {$define Delphi4or5}

    {$define BCB4}

  {$endif}

  {for BCB5, use the Delphi 5 codepath}

  {$ifdef ver130}

    {$define Delphi4or5}

  {$endif}

{$endif}

{$ifdef ver180}

  {$define BDS2006}

{$endif}



{$ifndef Delphi4or5}

  {$ifndef BCB}

    {$define Delphi6AndUp}

  {$endif}

  {$ifndef Delphi6}

    {$define BCB6OrDelphi7AndUp}

    {$ifndef BCB}

      {$define Delphi7AndUp}

    {$endif}

    {$ifndef BCB}

      {$ifndef Delphi7}

        {$ifndef Delphi2005}

          {$define BDS2006AndUp}

        {$endif}

      {$endif}

    {$endif}

  {$endif}

{$endif}



{$ifdef Delphi6AndUp}

  {$WARN SYMBOL_PLATFORM OFF}

  {$WARN SYMBOL_DEPRECATED OFF}

{$endif}



{Leak detail logging requires error logging}

{$ifndef LogErrorsToFile}

  {$undef LogMemoryLeakDetailToFile}

  {$undef ClearLogFileOnStartup}

{$endif}



{$ifndef EnableMemoryLeakReporting}

  {Manual leak reporting control requires leak reporting to be enabled}

  {$undef ManualLeakReportingControl}

{$endif}



{$ifndef EnableMMX}

  {$undef ForceMMX}

{$endif}



{Are any of the MM sharing options enabled?}

{$ifdef ShareMM}

  {$define MMSharingEnabled}

{$endif}

{$ifdef AttemptToUseSharedMM}

  {$define MMSharingEnabled}

{$endif}



{Instruct GExperts to back up the messages file as well.}

{#BACKUP FastMM4Messages.pas}



{Should debug info be disabled?}

{$ifdef NoDebugInfo}

  {$DEBUGINFO OFF}

{$endif}



{$ifdef BCB}

  {$ifdef borlndmmdll}

    {$OBJEXPORTALL OFF}

  {$endif}

{$endif}



{-------------------------Public constants-----------------------------}

const

  {The current version of FastMM}

  FastMMVersion = '4.94';

  {The number of small block types}

{$ifdef Align16Bytes}

  NumSmallBlockTypes = 46;

{$else}

  NumSmallBlockTypes = 55;

{$endif}

Open in new window

0
 
LVL 36

Expert Comment

by:Geert Gruwez
ID: 33613150
have you checked in the file
{$Include FastMM4Options.inc}

?
0
 
LVL 1

Author Comment

by:enigmasolutions
ID: 33623688
I suspect my problem is nothing to do with FastMM4.

However I did find an issue in the file you mentioned.

I think I should set the NoDebugInfo option in this file (since I am not interested in debuggin FastMM4) - what do you think?

see code below - the dot "." after the { disables the setting I think.


{Enable this option to suppress the generation of debug info for the

 FastMM4.pas unit. This will prevent the integrated debugger from stepping into

 the memory manager code.}

{.$define NoDebugInfo}

Open in new window

0
 
LVL 36

Accepted Solution

by:
Geert Gruwez earned 500 total points
ID: 33624381
the easiest thing to do is indeed test and see what happens
i don't use FastMM but i had the same problem with EurekaLog
it also depended on DebugInfo for reporting
switching it off solved the problem i had
0
 
LVL 1

Author Closing Comment

by:enigmasolutions
ID: 33624399
Thanks Geert.
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
FMX enumerated colours 2 72
Downloading email attachments 2 55
select query - oracle 16 82
tidtcpserver connection lost handle 2 48
A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
In our object-oriented world the class is a minimal unit, a brick for constructing our applications. It is an abstraction and we know well how to use it. In well-designed software we are not usually interested in knowing how objects look in memory. …
The viewer will learn how to use NetBeans IDE 8.0 for Windows to connect to a MySQL database. Open Services Panel: Create a new connection using New Connection Wizard: Create a test database called eetutorial: Create a new test tabel called ee…
The viewer will learn how to synchronize PHP projects with a remote server in NetBeans IDE 8.0 for Windows.

759 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now