View Issue Details

IDProjectCategoryView StatusLast Update
0036644LazarusDebuggerpublic2020-02-04 04:17
ReporterSven Barth Assigned ToMartin Friebe  
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
PlatformX86_64OSWindows NT 
Product Version2.1 (SVN) 
Summary0036644: Can't debug COM library with regsvr32.exe as host application
DescriptionI recently had the need to debug the registration of a COM object and thus set the host application in the start parameters of my library project to C:\Windows\system32\regsvr32.exe which I'd also use outside of the IDE to register my COM library. However starting the application leads to a crash of the debugger (debugger is set to "GNU debugger (GDB)") with the following error message:

The GDB command:
"info address main"
returned the error:
",msg="No symbol \"main\" in current context.""

I don't know if it makes a difference, but regsvr32.exe loads the library dynamically at runtime instead of at load time.
Steps To Reproduce- create a new library project
- optional: adjust the main source to this:

=== code begin ===

library comtest;

{$mode objfpc}{$H+}

uses
  comserv
  { you can add units after this };

exports
  DllRegisterServer,
  DllUnregisterServer,
  DllCanUnloadNow,
  DllGetClassObject;

begin
end.

=== code end ===

- go to Run -> Run Parameters
- set Host Application to C:\Windows\system32\regsvr32.exe
- optional: set the run parameters to the path of the created library
- run the project
-> debugger crashes
TagsNo tags attached.
Fixed in Revision
LazTarget-
WidgetsetWin32/Win64
Attached Files

Activities

Martin Friebe

2020-02-01 16:31

manager   ~0120837

Until I find time to test, you can try:

Tools > Option > Debugger > General (or backend in Lazarus 2.1)
In the property grid changed the option "InternalStartBreak" to either ...AddZero, ...Entry, or in 2.1 ...None


Not to do with your issue, but in case: Ensure "DisableLoadSymbolsForLibraries" is FALSE (that is the default)

Consider downloading gdb 8.2 from our sourceforge page, if there are other problems. It is under Windows64 > Alternative GDB

Anton Kavalenka

2020-02-01 19:12

reporter   ~0120842

Is debug symbols embedded in DLL or striped to external .dbg file?

Martin Friebe

2020-02-04 04:17

manager   ~0120870

I did run some tests (64bit target).

It does not work with the old gdb 7.3.5. And I found no workaround for this.

It does however work with gdb 8.2.
The next release of Lazarus 64bit is already planed to go with 8.2.
In the meantime 8.2 is available on our sourceforge page.

I noted that the IDE does fail to set breakpoints for catching exceptions.
I added a fix for that in r62610
It does require the following settings
InternalExceptionBreakSetMethod = imbName
DisableForceBreakpoints = False

-----
@Anton Kavalenka
In my tests there was no difference for external or internal dbg-info for the dll.

The bug is not caused by the dll's debug info, but by the fact that regsvr32 has no debug info.

Issue History

Date Modified Username Field Change
2020-02-01 11:51 Sven Barth New Issue
2020-02-01 11:51 Sven Barth Status new => assigned
2020-02-01 11:51 Sven Barth Assigned To => Martin Friebe
2020-02-01 16:31 Martin Friebe Note Added: 0120837
2020-02-01 19:12 Anton Kavalenka Note Added: 0120842
2020-02-04 04:17 Martin Friebe Status assigned => resolved
2020-02-04 04:17 Martin Friebe Resolution open => fixed
2020-02-04 04:17 Martin Friebe LazTarget => -
2020-02-04 04:17 Martin Friebe Widgetset Win32/Win64 => Win32/Win64
2020-02-04 04:17 Martin Friebe Note Added: 0120870