- from practical point of view pressing "F7" over B.free line and not going inside the "B.free -> B.destroy" gives the "false-impression" that the code in B.Destroy is not execute at all.
might it be better to "forbid" break point on "free" if debug info are not availabe ?
Only because "Free" is so commonly used, it is forgotten that it is a function of its own.
If I have code like
var MyList: TList;
begin
....
MyList.Sort(@MySortCompare);
Then the debugger never stops in MySortCompare (unless the rtl has debug info, and you step through the entire sorting code).
Same for
Form2 := TForm2.create;
Form2.Show; // debugger does not step into OnFormShow
// unless the LCL has debug info and you step the entire form show code
There of course you don't expect to debug the build in code for Sort or Show. And even if the LCL has debug info, then you may decide to intentionally step over it.
Well at least, in those cases
it's less of a surprise. Because the code that is called within is nested deeper.
I am aware that a few people would like to be able to step-over any code between any 2 methods that they wrote. But that isn't possible. (Well, for that the debugger would have to set breakpoints at every function that the user may be interested in, so assuming the debugger can predict the interests of the user...)
Only "Free" isn't really thought of a function of its own. Its more perceived as an alias (despite adding functionality).
Hence, the idea with the "jump pad" detection... Though not sure if that will happen. There is con and pro.
- how to enable "debug info" in RTL (and how to check that) ? this shall be useful for this specific case ?
You need to build your own FPC. The easiest way is fpcupdeluxe. Otherwise its download the sources, and call "make" with the option you want (and set up a start environment for the build....).
FpcUpDeluxe will do that for you.
- if the debbuger can stop if a breakpoint is put inside the "TB.destoy" it seems to me that "some-kind-of-debug-info" should be there...
There is debug info in TB.Destroy.
But there is none in TObject.Free. (which you call)
Just for experiment, open the ASM/assembler window, and use the step-into button in the asm view.
You will observe that there are some asm (mov/call) statements for the line "B.Free".
If you step into the "call" statement, the asm view will show you assembler without source code. This is the code from TObject.free.
This is about 5 to 10 asm statements. Some mov, cmp, je or jz, then a call.
If you step it using the "step into" button from the asm window, then the "call" will take you to your destroy code, and that will have sources (and debug info) again.