How to debug dll in lazarus - lazarus

I am creating a dll by lazarus and calling from another host application creating by lazarus too.
I config the debug compile option with above two projects:
and set Host Application in Run parameters with dll project:
and click F9 in the dll project, the Host application is started. However, execution of the dll project does not stop at a breakpoint I set in the dll project.

Related

How do you set up debugging in Visual Studio for a .DLL that runs inside a host.exe file?

I have a Visual Studio project that builds a plugin (.DLL file). To use the built plugin, I load it in a host.exe application. The trouble I'm having is that I don't know how to set up Visual Studio to debug the plugin (.DLL) whilst it is loaded and running inside the host.exe application. I want to be able to use breakpoints in my plugin code, and for those breakpoints to be hit when the plugin is loaded and running in the host.exe application.
I have tried (in Visual Studio) going to Project>Properties>Debugging, and setting the path to the host.exe application in the 'Command' field. Also in the debugging section I set the 'Attach' field to 'yes'. Then when I run the host.exe application, and then click 'start debugging' in Visual Studio, the debugger appears to successfully attach to the host.exe application. The problem is that when I then load my plugin (DLL) in the host.exe application, none of the breakpoints in my plugin code are being hit. It's as if Visual Studio thinks it's supposed to be debugging the host.exe application its self, rather than the plugin(DLL) that is loaded into the host.exe applications address space.
Can anyone tell me how to configure Visual Studio to debug the plugin (DLL) whilst it is running inside the host.exe application?

How to debug a shared library (.so) in VS2019 (NDK Projekt)

I have a NDK Project in Visual Studio 2019 which uses several shared libraries.
In the project which contains the android_main function i can set breakpoints and use them without problems. If I set a breakpoint in one of my shared libraries (.so) and start the debugger I get this message:
The breakpoint will not currently be hit. Module containing this breakpoint has not yet loaded or the breakpoint address could not be obtained.
How can I load the missing symbols?
I'm using the platform toolset Clang 5.0
What I tried so far:
With this command I proved that symbols are present:
llvm-nm -D libMySharedLib.so
In the modules window (in debug mode) I can see that symbols are loaded for my .so module.
What I'm guessing is wrong:
With NDK typically such problems show up when the debugging info is being stripped away. There is also an option to disable this behavior which is called "donotstrip" in Android Studio. But I'm on Visual Studio.
Apparently, in Visual Studio, when starting the debugger, the respective shared library (.so) project must be set as "Startup Project". Only the breakpoints of the current Startup Project are reached or those breakpoints that are contained in .cpp files, which in turn are part of the respective Startup Project. This is of course not very comfortable and if someone here knows a better solution, a corresponding comment would be very helpful.
Anyway, if a shared library project is to be launched, the appropriate path and name of the .apk file must be set under "Configuration Properties"->"Debugging"->"Package to Launch".

Debugging DLL from the EXE project?

I have a VB6 application that runs dependent on a DLL, to which both of them I hold the source code and are in separate vbp projects.
I know how to use breakpoint and run VB6 debug mode in the application project, but I want to know if it is possible to run debug mode for the DLL?
I saw this article http://www.ni.com/tutorial/4071/en/. Does it mean I first have to compile the application, then in the DLL project I start debug mode by invoking the compiled application and hook it to use the DLL from the project? what does the "TestStand" in the article mean?
Open one of those 2 projects and add another (File - Add Project...) and then set your
application project as start up (project explorer, right click on application project).

Error registering a COM component and using in WPF application

I have a COM DLL (MyWrapper), with a COM ATL Object (class) defined inside. This COM dll is basically to be an interface between my WPF .exe and native MFC DLLs.
Everything works perfectly fine until I put the COM DLL in my source control to check in the code. I put the Pre and post build events to copy the DLL to our desired location. when I compiled I got the error.
Unable to register the dll. Try enabling per user redirection
I enabled the option in linker. The DLL compiled and copied to the directory successfully. Then I tried to add the reference to the WPF project, it gave me the following error
A reference to MyWrapper.dll" could not be added. Please make sure that the file is accessible and that it is a valid assembly or COM component
When I remove the pre/post build events and then add the reference, everything works great. I loaded the DLL in Dependency walker it shows IESHIMS.dll is missing.
I have tried to register the DLL using regsvr32 but that returns an error:
The module 'MyWrapper.dll' was loaded but the call to DllRegisterserver failed with error code 0x80070715.
I have admin rights on my machine and am running Visual Studio as administrator.
In the postBuild events, I created a Proxy dll of the COM and added that dll in my WPF application. This solved my problem.

Monodevelop,debuging DLL project which attachs to a process,

I create a project,and I set "DLL" mode on output. I want debug my dll project , so I do "attach to process",(at the beginning ,I can not find "attach to process",but after I install the "GUN debugger plugin monodevelop",I can find it in the RUN menu.)
I debug a DLL project which has already attached to a process, but it always stop at the Line: "b7799424 pop %ebp" in the "Disassemly+"file.
Application output shows:"0Xb7799424in__kernel_vsyscall()".
I can not debug the DLL program.
Anyone can give me some help to this trouble.
Demi
The method of debugging the DLL (or library) project in Monodevelop IDE :
Instead of attaching to the exe that references your dll have MonoDevelop launch the exe for you. The trick to getting MonoDevelop to launch the exe for you is like this :
Create an empty solution.
Add your .exe project to this solution.
Continue to add your .dll project to the solution.
Set that your .exe project as the startup project.
Set the output path of your dll project in the debug file of your .exe project .
Build the entire solution and select Debug from the Run menu.
The MonoDevelop will launch your exe in the debugger and should be able to break at breakpoints within your dll project.
This methode is referenced by this webpage.I tried this method and it can work.
Hope this can help other people.
Demi
It looks like you are using the GDB debugger which is pretty low level, maybe you should try with the soft or hard debugger, instructions are found on the monodevelop website

Resources