Skip to content

SIGSEGV during disassembly in model #702

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
GitMensch opened this issue Mar 18, 2025 · 4 comments
Open

SIGSEGV during disassembly in model #702

GitMensch opened this issue Mar 18, 2025 · 4 comments
Labels
bug needs_info not enough info

Comments

@GitMensch
Copy link
Contributor

GitMensch commented Mar 18, 2025

Happens on "Disassemble" of a specific function in the trace.
Several other functions can be the target of Disassemble without any problems.

QTextLine HighlightedText::lineAt(int index) const
{
auto& line = m_highlightedLines[index];
return line.layout()->lineAt(0);
}

retried with current AppImage - same result.

Thread 1 "hotspot" received signal SIGSEGV, Segmentation fault.
HighlightedText::lineAt (this=0x99cc30, index=46) at /github/workspace/src/models/highlightedtext.cpp:356

(gdb) p line
$1 = (const HighlightedLine &) <error reading variable>
(gdb) p m_highlightedLines[index]
Cannot access memory at address 0x5c0
(gdb) p m_highlightedLines
$2 = std::vector of length 0, capacity 0

(gdb) up
#1   0x000000000051d29c in SourceCodeModel::data (this=0x99cc10, index=..., role=260) at /github/workspace/src/models/sourcecodemodel.cpp:173
(gdb) p m_highlightedText
$3 = {<QObject> = {<No data fields>}, static staticMetaObject = {d = {superdata = {direct = 0x7f75db3ab760 <QObject::staticMetaObject>}, stringdata = 0x579b80, data = 0x579ac0, static_metacall = 0x4e4130 <HighlightedText::qt_static_metacall(QObject*, QMetaObject::Call, int, void**)>, relatedMetaObjects = 0x0, extradata = 0x0}}, m_repository = 0x987820, m_highlighter = std::unique_ptr<HighlightingImplementation> = {get() = 0xcab4c0}, m_highlightedLines = std::vector of length 0, capacity 0, m_lines = {<QList<QString>> = {<QListSpecialMethods<QString>> = {<No data fields>}, {p = {static shared_null = {ref = {atomic = {_q_value = {<std::__atomic_base<int>> = {static _S_alignment = 4, _M_i = -1}, static is_always_lock_free = true}}}, alloc = 0, begin = 0, end = 0, array = {0x0}}, d = 0x7f75db1c90c0 <QListData::shared_null>}, d = 0x7f75db1c90c0 <QListData::shared_null>}}, <No data fields>}, m_cleanedLines = {<QList<QString>> = {<QListSpecialMethods<QString>> = {<No data fields>}, {p = {static shared_null = {ref = {atomic = {_q_value = {<std::__atomic_base<int>> = {static _S_alignment = 4, _M_i = -1}, static is_always_lock_free = true}}}, alloc = 0, begin = 0, end = 0, array = {0x0}}, d = 0x1105b30}, d = 0x1105b30}}, <No data fields>}, m_isUsingAnsi = false, m_tabWidth = 4}

(gdb) p m_highlightedText.textAt(46).d
$4 = (QString::Data *) 0x11092f0
(gdb) p m_highlightedText.textAt(46).d->size
$5 = 0

(gdb) bt 13
#0  HighlightedText::lineAt (this=0x99cc30, index=46) at /github/workspace/src/models/highlightedtext.cpp:356
#1  0x000000000051d29c in SourceCodeModel::data (this=0x99cc10, index=..., role=260) at /github/workspace/src/models/sourcecodemodel.cpp:173
#2  0x00000000004fa251 in QModelIndex::data (arole=<optimized out>, this=0x7ffeaa07d8b0) at /usr/include/QtCore/qabstractitemmodel.h:460
#3  CodeDelegate::paint (this=0xa20500, painter=0x7ffeaa07dbf8, option=..., index=...) at /github/workspace/src/models/codedelegate.cpp:71
#4  0x00007f75dc228118 in QTreeView::drawRow(QPainter*, QStyleOptionViewItem const&, QModelIndex const&) const () from /tmp/hotspot-v1.5.1-41/usr/lib/libQt5Widgets.so.5
#5  0x00007f75dc22bfd5 in QTreeView::drawTree(QPainter*, QRegion const&) const () from /tmp/hotspot-v1.5.1-41/usr/lib/libQt5Widgets.so.5
#6  0x00007f75dc232128 in QTreeView::paintEvent(QPaintEvent*) () from /tmp/hotspot-v1.5.1-41/usr/lib/libQt5Widgets.so.5
#7  0x00007f75dbfa981e in QWidget::event(QEvent*) () from /tmp/hotspot-v1.5.1-41/usr/lib/libQt5Widgets.so.5
#8  0x00007f75dc052d2e in QFrame::event(QEvent*) () from /tmp/hotspot-v1.5.1-41/usr/lib/libQt5Widgets.so.5
#9  0x00007f75db0b91f2 in QCoreApplicationPrivate::sendThroughObjectEventFilters(QObject*, QEvent*) () from /tmp/hotspot-v1.5.1-41/usr/lib/libQt5Core.so.5
#10 0x00007f75dbf6aa4e in QApplicationPrivate::notify_helper(QObject*, QEvent*) () from /tmp/hotspot-v1.5.1-41/usr/lib/libQt5Widgets.so.5
#11 0x00007f75db0b947a in QCoreApplication::notifyInternal2(QObject*, QEvent*) () from /tmp/hotspot-v1.5.1-41/usr/lib/libQt5Core.so.5
#12 0x00007f75dbfa2446 in QWidgetPrivate::sendPaintEvent(QRegion const&) () from /tmp/hotspot-v1.5.1-41/usr/lib/libQt5Widgets.so.5
(More stack frames follow...)

Several other functions can be the target of Dissassemle

@milianw
Copy link
Member

milianw commented Mar 21, 2025

can you create an MWE, i.e. provide a cmake project we can profile and disassemble to trigger it? since you lack the Qt pretty printers, what is m_highlightedLines.size()?

and/or can you try to reproduce this with a debug build with assertions enabled?

@milianw milianw added needs_info not enough info bug labels Mar 21, 2025
@GitMensch
Copy link
Contributor Author

Sadly an MWE will be very complicated, if you can provide me with that debug build, then I can retest (so far I took the appimage + its debuginfos).

(gdb) p m_highlightedLines
$2 = std::vector of length 0, capacity 0

so your question should be answered with "size == 0", no?

milianw added a commit that referenced this issue Mar 22, 2025
Otherwise we might not have any highlighted text yet the model
still assumes we have a bunch of lines, possibly leading to crashes
later on.

Relates-To: #702
@milianw
Copy link
Member

milianw commented Mar 22, 2025

please try a newer appimage, maybe my commit ebdeab1 fixes this

@milianw
Copy link
Member

milianw commented Apr 7, 2025

closing as assumed-fixed. if not, please reopen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug needs_info not enough info
Projects
None yet
Development

No branches or pull requests

2 participants