Forum > Debugger

Strange debugger behaviour

(1/3) > >>

cct:
I am revisiting some code I wrote in 2020 - just simple FreePascal, but I wrote it in lazarus.

I have been getting some strange runtime behaviour, so tried to run in the debugger, which I previously did fine. Initially I was just getting a cmd.exe window, just at a prompt, but retying, I either get into an assembler windows (which is of no use to me!) or sometimes I get the error:

Execution stopped with exit-code -1073741510 ($C000013A)

What am I doing wrong?

This is Lazarus 3.4, FPC 3.2.2 on Win 11

Chris

Martin_fr:
Google says the app was interrupted with Ctrl-C or equivalent.

First of all you can try from the "run" menu: "Reset debugger". That makes sure you get a clean start, in case any stuff of the last debug session still had an impact (it never should, but ...)

Next, what debugger backend do you use? Menu: Tools > Options => then: Debugger > Backend => at the very top, in the toolbar: does it say ..."fpdebug" or ..."gdb" ?
If it isn't fpdebug, then you should be able to change it (the text at the very top is a drop down).
Though you can also try gdb, if the issue occurs with fpdebug.


Make sure Windows defender is not killing your project when it starts.

For all else, probably need more info.

cct:
Thanks. I have reset debugger, and am set to use fpdebug - I did have a browse of the settings and help files.

I get the error above if I run - I get the cmd.exe window, and if I either type exit, or close the window.

If I set a breakpoint after the program start, I just go into the assembler window, and stepping  through I get the error show in the attachment.

If I run it from powershell, it seems to run, but sometimes doesn't perform. I have set the parameters up.

A bit lost now

Chris

Martin_fr:
OK, so an Access violation. Usually that means some pointer (address of some data/object) was not initialized correctly.
It happens in the kernel, may mean that you called some Windows API with incorrect settings.

If it isn't initialized, then depending on many factors, it may sometimes "not cause a noticeable error". But that is just good luck.

Can you open menu: View > Debug Windows > Call Stack

There should be a list of "callers" => hopefully somewhere in that list is some of your code.
You can the double click to open that code in the editor.

Check, what it calls and what params it passes on.
- values can be seen in the stack window
- or in the stack window select the line with your code, and click the "green arrow" (which has a hint "current") // or from context menu select "current". => your code will then be marked by an arrow in the stack window => then you can hover over variables to see their content.


(Sorry if too verbose / don't know how much of the debugger you know)

cct:
It just seems to be in bits of the RTL, when it fails it shows ntdll:RtlNtdllName+17200  against index 0 and just an address against index 2

Seems funny to throw an exception in debug, but not when running outside the debugger - whether compiled with debug, or without,

I am not doing anything odd - just using:

uses
    {$IFDEF UNIX}{$IFDEF UseCThreads}
        cthreads,
    {$ENDIF}    {$ENDIF}
    Classes,
    SysUtils,
    CustApp,
    paradoxds,                                  // Package lazparadoxpkg
    db,
    sqlite3conn,
    sqldb
    ;





Navigation

[0] Message Index

[#] Next page

Go to full version