Details
Description
Setting a breakpoint in javascript code that imports mjs module(s) leads to the following segmentation fault:.
1 QV4::Runtime::TypeofValue::call qv4runtime.cpp 1631 0x7ffff762e570
2 collectProperty qv4scopedvalue_p.h 242 0x7ffff016854f
3 QV4DataCollector::collectAsJson qv4datacollector.h 78 0x7ffff0168e2e
4 QV4DataCollector::collectProperties qv4datacollector.cpp 385 0x7ffff0168fe7
5 QV4DataCollector::lookupRef qv4datacollector.cpp 198 0x7ffff01691bd
6 QV4DataCollector::collectScope qv4datacollector.cpp 240 0x7ffff01699e0
7 ScopeJob::run qv4debugjob.cpp 184 0x7ffff016b416
8 QV4Debugger::pauseAndWait qv4debugger.cpp 278 0x7ffff0164a5e
9 QV4Debugger::pauseAndWait qv4debugger.cpp 269 0x7ffff0165cd1
10 QV4Debugger::maybeBreakAtInstruction qv4debugger.cpp 209 0x7ffff0165cd1
11 debug_slowPath qv4vme_moth.cpp 291 0x7ffff7619382
12 QV4::Moth::VME::interpret qv4vme_moth.cpp 1386 0x7ffff76194b9
13 QV4::Moth::VME::exec qv4vme_moth.cpp 466 0x7ffff761f3d0
14 QV4::ArrowFunction::virtualCall qv4functionobject.cpp 528 0x7ffff75b24f8
15 QV4::FunctionObject::call qv4functionobject_p.h 202 0x7ffff761c8a3
16 QV4::Moth::VME::interpret qv4vme_moth.cpp 757 0x7ffff761c8a3
17 QV4::Moth::VME::exec qv4vme_moth.cpp 466 0x7ffff761f3d0
18 QV4::Module::evaluate qv4module.cpp 125 0x7ffff762347b
19 QQmlScriptData::scriptValueForContext qqmlscriptdata.cpp 130 0x7ffff76b3bfd
20 QQmlScriptData::scriptValueForContext qqmlscriptdata.cpp 151 0x7ffff76b3c4d
21 QQmlObjectCreator::create qqmlobjectcreator.cpp 198 0x7ffff7757133
22 QQmlComponentPrivate::beginCreate qscopedpointer.h 116 0x7ffff76e3712
23 QQmlComponent::create qqmlcomponent.cpp 818 0x7ffff76e412e
24 QQmlApplicationEnginePrivate::finishLoad qqmlapplicationengine.cpp 148 0x7ffff774844a
25 QQmlApplicationEnginePrivate::startLoad qqmlapplicationengine.cpp 132 0x7ffff7748aac
26 QQmlApplicationEngine::load qqmlapplicationengine.cpp 279 0x7ffff7748b41
27 main main.cpp 19 0x555555556774
Analysis had shown that the reason is invalid Value being appended to the list in QV4DataCollector::collectScope() because the loop here accesses beyond context local variables array bounds.
Steps to reproduce:
Open the project in the attached qmldebug_crash.zip archive in qtcreator, set a breakpoint on line 6 in module2.mjs and start debugging (F5). As soon as breakpoint is hit, there will be segmentation fault in C++ code.
See the attached qmldebug_fix_localvars_count.patch for what fixes the issue for me, however, I am not sure that's a proper fix given that it excludes imported modules from the list of local variables shown in the debugger.
I am hitting the issue on Ubuntu 22.04.3 with Qt coming with the distro, however I believe all patforms and 5.x/6.x versions are affected.
Attachments
Issue Links
- split to
-
QTBUG-118478 Can't query ExecutionContext for properties of imported ECMAScript modules
- Reported