Recent

Author Topic: Dll debug in Win 64  (Read 5867 times)

Amper_CZ

  • Newbie
  • Posts: 3
Dll debug in Win 64
« on: July 08, 2010, 01:01:09 pm »
I am trying to debug dll on Win64 (lazarus SVN 26516 and FPC 2.5.1)

GDB is already updated to version 7.1.5 from MinGw, imagebase work's ok on exe but still don't have luck on DLL


I can see "pendings" breakpoints in GDB output but it ends with

<-exec-continue>
^error,msg="Warning:\nCannot insert breakpoint 1.\nError accessing memory address 0x15c4: Input/output error.\n"
(gdb)

DLL is dynamic loaded - simple dll loaded by regsvr32. Not COM part implemented yet, it works without debugger but I am unable to put breakpoint there.

Is there some way how to make that works ? For example some parameter to GDB which will point debugger to symbol files or something like this ?

Complete debugger output is attached

Amper_CZ

  • Newbie
  • Posts: 3
Re: Dll debug in Win 64
« Reply #1 on: July 08, 2010, 01:03:27 pm »
one note : I need 64bit dll and now I am trying to make Lazarus/FPC work before I will rewrite it to C++. So I can spend some time in Lazarus/FPC internals if there is way how to implement.

I am thinking about possibility to send manual commands to GDB and load symbols by that way. Will pending breakpoints work after that ?

Amper_CZ

  • Newbie
  • Posts: 3
Re: Dll debug in Win 64
« Reply #2 on: July 08, 2010, 02:58:35 pm »
I added Send command into console debug window so now I am able to delete invalid breakpoint, let gdb continue and also load symbol file so "info sources" show my sources too but still missing something and Lazarus breakpoint is not fired


MikeFinch

  • Jr. Member
  • **
  • Posts: 79
Re: Dll debug in Win 64
« Reply #3 on: November 03, 2019, 04:00:35 am »
This "Cannot insert breakpoint ... ... Error accessing memory address ... Input/output error" problem is occurring in Windows 10 (and 7) in Lazarus version 2.0.4; I have just upgraded to 2.0.6. THE PROBLEM HASN'T GONE AWAY.

The code I am using is imported from Linux where it performs perfectly. So seemingly a Windows interaction problem (which 2.0.6 hasn't fixed). Most annoying : I seem to have had a similar [?] problem with Linux a while ago which Pierre Muller fixed with 4 replacement files for FPC 3.0.4 - something to do with an outdated compiler. But that is history!

Since my Linux version works properly can't someone sort out why Windows (or the gdb), or whatever, is misbehaving?  :(

One thing I have noticed is that a black-filled rectangle (the konsole?) flashes briefly prior to the program opening (when it does run!). My exe program, which is actually created, seems to run outside Lazarus and gives a "File not open" error in one situation - not so with the Linux equivalent!?

440bx

  • Hero Member
  • *****
  • Posts: 3946
Re: Dll debug in Win 64
« Reply #4 on: November 03, 2019, 04:21:48 am »
@Amper_CZ,

You could insert the breakpoint manually, code like this should work:
Code: Pascal  [Select][+][-]
  1. if IsDebuggerPresent() then asm int 3 end;
You can control the inclusion or exclusion of the "if" statement depending on the build mode or simply leave it there since the "int 3" won't be triggered unless the process is being debugged.

Once the breakpoint has triggered, single step all you want.

HTH.

ETA: just noticed this question was asked nine (9) years ago.... <laugh>
« Last Edit: November 03, 2019, 04:39:37 am by 440bx »
(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v3.2) on Windows 7 SP1 64bit.

Thaddy

  • Hero Member
  • *****
  • Posts: 14205
  • Probably until I exterminate Putin.
Re: Dll debug in Win 64
« Reply #5 on: November 03, 2019, 08:30:39 am »
If you want to debug the dll, simply open the dll project, select attach to program and run the dll project.
Now you are debug the dll instead of the progam. Same as in Delphi.
Specialize a type, not a var.

 

TinyPortal © 2005-2018