Bug 97432 - Breakpoints ignore when macro first run
Summary: Breakpoints ignore when macro first run
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: BASIC (show other bugs)
Version:
(earliest affected)
Inherited From OOo
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords:
: 104947 (view as bug list)
Depends on:
Blocks: Macro-UI
  Show dependency treegraph
 
Reported: 2016-01-29 12:48 UTC by tim
Modified: 2022-08-26 11:59 UTC (History)
5 users (show)

See Also:
Crash report or crash signature:


Attachments
Test database (13.87 KB, application/vnd.oasis.opendocument.database)
2016-01-29 12:48 UTC, tim
Details

Note You need to log in before you can comment on or make changes to this bug.
Description tim 2016-01-29 12:48:21 UTC
Created attachment 122274 [details]
Test database

When a breakpoint is set in a BAsic Macro, the first time the routine is executed the breakpoint is ignored.  This can be baffling at times.

Open the attached database.  

Open the macros: Tools, Macros, Organise Macros, LibreOffice Basic
Under testbreakpoint.odb, Standard, Module1 select the TestBreakpoint macro and Edit.

Put a breakpoint on the line: oCodeRun.Text = "Code Run" 

Leave the Macro page open and go back to the BASE home page for this database and open the Table1 Form.

Press the button marked 'Press'.  Look at the Macro page - the breakpoint has not been executed, but the code has been, and the field below the Press button contains 'Code Run', proving that the macro has been executed without a breakpoint.

Now press the button marked 'Press' again.  Look at the Macro page - the breakpoint has been executed this time and code is halted.
Comment 1 raal 2016-01-29 20:41:13 UTC
I can confirm Version: 4.2.0.0.alpha1+ and Version: 5.2.0.0.alpha0+
Build ID: d1a49df6833ff16f5cbaf98534eaae62693e520b
CPU Threads: 4; OS Version: Linux 4.2; UI Render: default; 
TinderBox: Linux-rpm_deb-x86_64@70-TDF, Branch:master, Time: 2016-01-29_02:01:58
Comment 2 Regina Henschel 2016-12-27 20:53:56 UTC
*** Bug 104947 has been marked as a duplicate of this bug. ***
Comment 3 Regina Henschel 2016-12-27 20:57:59 UTC
I see it already in OOo3.2.1
Comment 4 QA Administrators 2017-12-28 03:29:06 UTC Comment hidden (obsolete)
Comment 5 tim 2017-12-28 18:09:42 UTC
It still happens in:

Version: 5.4.4.2
Build ID: 1:5.4.4~rc2-0ubuntu0.17.10.1~lo1
CPU threads: 8; OS: Linux 4.13; UI render: default; VCL: gtk2; 
Locale: en-GB (en_GB.UTF-8); Calc: group
Comment 6 QA Administrators 2018-12-29 03:49:36 UTC Comment hidden (obsolete)
Comment 7 tim 2018-12-30 15:54:19 UTC
The problem still exists in:

Version: 6.1.4.2
Build ID: 1:6.1.4-0ubuntu0.18.10.1~lo1
CPU threads: 8; OS: Linux 4.18; UI render: default; VCL: x11; 
Locale: en-GB (en_GB.UTF-8); Calc: group threaded

I have retested both the example I provided, and another database.

It's an irritating but small niggle.
Comment 8 himajin100000 2019-11-30 06:36:25 UTC
https://opengrok.libreoffice.org/xref/core/basic/source/runtime/runtime.cxx?r=f853ec31#4220

Somehow static_cast<int>(nFlags) is 0 when the code fails to break,
while in successful cases it's 1.
Comment 10 himajin100000 2019-12-16 10:06:42 UTC
further logging suggested that
this line creates pThisCopy(INSTANCE-1,just for later explanation) as another instance than *this(INSTANCE-2)

https://opengrok.libreoffice.org/xref/core/basic/source/classes/sbxmod.cxx?r=91937535#2100

Then pThisCopy is given to SbxHint constructor

https://opengrok.libreoffice.org/xref/core/basic/source/classes/sbxmod.cxx?r=91937535#2112

Later, at some point I cannot tell when,

SbMethod::SetDebugFlags is called ,with static_cast<int>(n) being 1.
https://opengrok.libreoffice.org/xref/core/include/basic/sbmeth.hxx?r=c02c4df9#60

probably *this in SetDebugFlags is referencing INSTANCE-1, not INSTANCE-2.

mpBroadcaster = std::move(pSaveBroadcaster);
mpBroadcaster->Broadcast( SbxHint( nHintId, pThisCopy ) );
SAL_INFO("basic",static_cast<int>(GetDebugFlags())); // INSTANCE-2
SAL_INFO("basic",static_cast<int>(pThisCopy->GetDebugFlags())); // INSTANCE-1

gave me
0
1

https://opengrok.libreoffice.org/xref/core/basic/source/classes/sbxmod.cxx?r=91937535#1160

this pMeth after the SbMethod::Broadcast call is , as the same as the one before the call, INSTANCE-2.

INSTANCE-2 is used to initialize SbRuntime here as I mentioned in the previous post.

https://opengrok.libreoffice.org/xref/core/basic/source/classes/sbxmod.cxx?r=91937535#1168

I think this is somewhat related to this bug.

Any thoughts?
Comment 11 QA Administrators 2022-08-26 03:36:40 UTC Comment hidden (obsolete)
Comment 12 tim 2022-08-26 09:13:16 UTC
I tried it, and the bug is, unfortunately, still present.  Quite baffling.


Version: 7.3.5.2 / LibreOffice Community
Build ID: 30(Build:2)
CPU threads: 8; OS: Linux 5.15; UI render: default; VCL: gtk3
Locale: en-GB (en_GB.UTF-8); UI: en-GB
Ubuntu package version: 1:7.3.5-0ubuntu0.22.04.1
Calc: threaded
Comment 13 Peter Toye 2022-08-26 11:59:47 UTC
I also tried it - it's still there.
Version: 7.3.5.2 (x64) / LibreOffice Community
Build ID: 184fe81b8c8c30d8b5082578aee2fed2ea847c01
CPU threads: 12; OS: Windows 10.0 Build 19043; UI render: Skia/Raster; VCL: win
Locale: en-GB (en_GB); UI: en-GB
Calc: threaded