Show the message box correctly on signal 11 reported.
Reviewed-by: hjk
ba->append(';');
}
-QByteArray Snapshot::gdbStopMessage(uint threadId, bool reportThreadId) const
+QByteArray Snapshot::gdbStopMessage(uint threadId, int signalNumber, bool reportThreadId) const
{
- QByteArray ba = "T05";
+ QByteArray ba = ('T' + trk::hexNumber(signalNumber, 2));
if (reportThreadId) {
ba += "thread:";
ba += trk::hexNumber(threadId, 3);
QDebug operator<<(QDebug d, const MemoryRange &range);
+// Signals to be passed to gdb server as stop reason (2 digit hex)
+enum GdbServerStopReason {
+ gdbServerSignalTrap = 5, // Trap/Breakpoint, etc.
+ gdbServerSignalSegfault = 11 // Segfault
+};
+
namespace Symbian {
enum CodeMode
QByteArray gdbQsThreadInfo() const;
QByteArray gdbQThreadExtraInfo(const QByteArray &cmd) const;
// Format a gdb T05 stop message with thread and register set
- QByteArray gdbStopMessage(uint threadId, bool reportThreadId) const;
+ QByteArray gdbStopMessage(uint threadId, int signalNumber, bool reportThreadId) const;
// Format a log message for memory access with some smartness about registers
QByteArray memoryReadLogMessage(uint addr, uint threadId, bool verbose, const QByteArray &ba) const;
// Gdb command parse helpers: 'salnext'
TcfTrkGdbAdapter::TcfTrkGdbAdapter(GdbEngine *engine) :
AbstractGdbAdapter(engine),
m_running(false),
+ m_stopReason(0),
m_trkDevice(new TcfTrkDevice(this)),
m_gdbAckMode(true),
m_uid(0),
m_snapshot.setThreadState(threadId, reason);
// Update registers first, then report stopped
m_running = false;
+ m_stopReason = reason.contains(QLatin1String("exception"), Qt::CaseInsensitive)
+ || reason.contains(QLatin1String("panic"), Qt::CaseInsensitive) ?
+ gdbServerSignalSegfault : gdbServerSignalTrap;
m_trkDevice->sendRegistersGetMRangeCommand(
TcfTrkCallback(this, &TcfTrkGdbAdapter::handleAndReportReadRegistersAfterStop),
currentThreadContextId(), 0,
} else {
//qDebug() << "Fetching single register";
m_trkDevice->sendRegistersGetMRangeCommand(
- TcfTrkCallback(this, &TcfTrkGdbAdapter::handleAndReportReadRegistersAfterStop),
+ TcfTrkCallback(this, &TcfTrkGdbAdapter::handleAndReportReadRegister),
currentThreadContextId(), registerNumber, 1);
}
}
handleReadRegisters(result);
handleReadRegisters(result);
const bool reportThread = m_session.tid != m_session.mainTid;
- sendGdbServerMessage(m_snapshot.gdbStopMessage(m_session.tid, reportThread), stopMessage());
+ sendGdbServerMessage(m_snapshot.gdbStopMessage(m_session.tid, m_stopReason, reportThread), stopMessage());
}
void TcfTrkGdbAdapter::handleAndReportSetBreakpoint(const TcfTrkCommandResult &result)
QString m_gdbServerName; // 127.0.0.1:(2222+uid)
bool m_running;
+ int m_stopReason;
tcftrk::TcfTrkDevice *m_trkDevice;
QSharedPointer<QIODevice> m_trkIODevice;
# if 1
// We almost always need register values, so get them
// now before informing gdb about the stop.s
- //qDebug() << "Auto-fetching registers";
+ const int signalNumber = reason.contains(QLatin1String("exception"), Qt::CaseInsensitive)
+ || reason.contains(QLatin1String("panic"), Qt::CaseInsensitive) ?
+ gdbServerSignalSegfault : gdbServerSignalTrap;
sendTrkMessage(0x12,
TrkCB(handleAndReportReadRegistersAfterStop),
- Launcher::readRegistersMessage(m_session.pid, m_session.tid));
+ Launcher::readRegistersMessage(m_session.pid, m_session.tid), signalNumber);
# else
// As a source-line step typically consists of
// several instruction steps, better avoid the multiple
{
handleReadRegisters(result);
const bool reportThread = m_session.tid != m_session.mainTid;
- sendGdbServerMessage(m_snapshot.gdbStopMessage(m_session.tid, reportThread),
+ const int signalNumber = result.cookie.isValid() ? result.cookie.toInt() : int(gdbServerSignalTrap);
+ sendGdbServerMessage(m_snapshot.gdbStopMessage(m_session.tid, signalNumber, reportThread),
"Stopped with registers in thread " + QByteArray::number(m_session.tid, 16));
}