URL
https://opencores.org/ocsvn/riscv_vhdl/riscv_vhdl/trunk
Subversion Repositories riscv_vhdl
Compare Revisions
- This comparison shows the changes necessary to convert path
/riscv_vhdl/trunk/debugger/src/gui_plugin/CpuWidgets
- from Rev 2 to Rev 3
- ↔ Reverse comparison
Rev 2 → Rev 3
/AsmArea.cpp
1,442 → 1,442
/** |
* @file |
* @copyright Copyright 2016 GNSS Sensor Ltd. All right reserved. |
* @author Sergey Khabarov - sergeykhbr@gmail.com |
* @brief Disassembler viewer area. |
*/ |
|
#include "AsmArea.h" |
#include "moc_AsmArea.h" |
|
#include <memory> |
#include <string.h> |
#include <QtWidgets/QBoxLayout> |
#include <QtWidgets/QLabel> |
#include <QtWidgets/QHeaderView> |
#include <QtWidgets/QScrollBar> |
|
namespace debugger { |
|
static const uint64_t MAX_BYTES_VIEW = 1 << 12; // 4096 |
|
AsmArea::AsmArea(IGui *gui, QWidget *parent, uint64_t fixaddr) |
: QTableWidget(parent) { |
igui_ = gui; |
cmdRegs_.make_string("reg npc"); |
cmdReadMem_.make_string("disas 0 0"); |
hideLineIdx_ = 0; |
selRowIdx = -1; |
fixaddr_ = fixaddr; |
waitRegNpc_ = false; |
|
clear(); |
QFont font("Courier"); |
font.setStyleHint(QFont::Monospace); |
font.setPointSize(8); |
font.setFixedPitch(true); |
setFont(font); |
setContentsMargins(QMargins(0, 0, 0, 0)); |
QFontMetrics fm(font); |
setMinimumWidth(50 + fm.width(tr( |
" :0011223344556677 11223344 1: addw r0,r1,0xaabbccdd ; commment"))); |
lineHeight_ = fm.height() + 4; |
visibleLinesTotal_ = 0; |
if (isNpcTrackEna()) { |
startAddr_ = 0; |
endAddr_ = 0; |
} else { |
startAddr_ = fixaddr_; |
endAddr_ = fixaddr_; // will be computed in resize() method |
} |
|
setColumnCount(COL_Total); |
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); |
setRowCount(1); |
asmLines_.make_list(0); |
asmLinesOut_.make_list(0); |
npc_ = ~0; |
|
verticalHeader()->setVisible(false); // remove row indexes |
setShowGrid(false); // remove borders |
setSelectionMode(QAbstractItemView::SingleSelection); |
setSelectionBehavior(QAbstractItemView::SelectRows); //select full row |
|
// change selected row color |
QPalette *palette = new QPalette(); |
palette->setColor(QPalette::Highlight, Qt::gray); |
setPalette(*palette); |
Qt::ItemFlags fl; |
for (int i = 0; i < rowCount(); i++) { |
for (int n = 0; n < COL_Total; n++) { |
setItem(i, n, new QTableWidgetItem()); |
fl = item(i, n)->flags(); |
fl &= ~Qt::ItemIsEditable; |
fl &= ~Qt::ItemIsSelectable; |
item(i, n)->setFlags(fl); |
} |
setRowHeight(i, lineHeight_); |
item(i, 0)->setBackgroundColor(Qt::lightGray); |
item(i, 0)->setTextAlignment(Qt::AlignRight | Qt::AlignVCenter); |
} |
|
setHorizontalHeaderLabels( |
QString("addr/line;code;label;mnemonic;comment").split(";")); |
setColumnWidth(0, 10 + fm.width(tr(" :0011223344556677"))); |
setColumnWidth(1, 10 + fm.width(tr("00112233"))); |
setColumnWidth(2, 10 + fm.width(tr("0"))); |
setColumnWidth(3, 10 + fm.width(tr("addw r1,r2,0x112233445566"))); |
setColumnWidth(4, 10 + fm.width(tr("some very long long comment+offset"))); |
|
connect(this, SIGNAL(signalNpcChanged()), |
this, SLOT(slotNpcChanged())); |
connect(this, SIGNAL(signalAsmListChanged()), |
this, SLOT(slotAsmListChanged())); |
connect(this, SIGNAL(cellDoubleClicked(int, int)), |
this, SLOT(slotCellDoubleClicked(int, int))); |
|
RISCV_mutex_init(&mutexAsmGaurd_); |
} |
|
AsmArea::~AsmArea() { |
igui_->removeFromQueue(static_cast<IGuiCmdHandler *>(this)); |
RISCV_mutex_destroy(&mutexAsmGaurd_); |
} |
|
void AsmArea::resizeEvent(QResizeEvent *ev) { |
int h = ev->size().height(); |
if (h < 4 * lineHeight_) { |
h = 4 * lineHeight_; |
} |
visibleLinesTotal_ = h / lineHeight_ + 2; |
|
if (isNpcTrackEna() && npc_ == ~0ull) { |
return; |
} |
|
int line_cnt = static_cast<int>(asmLinesOut_.size()); |
if (visibleLinesTotal_ > line_cnt) { |
char tstr[256]; |
RISCV_sprintf(tstr, sizeof(tstr), "disas 0x%" RV_PRI64 "x %d", |
endAddr_, |
4*(visibleLinesTotal_ - line_cnt)); |
cmdReadMem_.make_string(tstr); |
igui_->registerCommand(static_cast<IGuiCmdHandler *>(this), |
&cmdReadMem_, true); |
} |
|
QWidget::resizeEvent(ev); |
} |
|
void AsmArea::wheelEvent(QWheelEvent * ev) { |
int dlt = ev->delta(); |
int scroll_pos = verticalScrollBar()->value(); |
int scroll_min = verticalScrollBar()->minimum(); |
int scroll_max = verticalScrollBar()->maximum(); |
if (dlt >= 0 && scroll_pos > scroll_min) { |
verticalScrollBar()->setValue(--scroll_pos); |
} else if (dlt < 0 && scroll_pos < scroll_max) { |
verticalScrollBar()->setValue(++scroll_pos); |
} else { |
char tstr[128]; |
unsigned sz = 4 * static_cast<unsigned>(visibleLinesTotal_ / 2); |
if (dlt >= 0) { |
RISCV_sprintf(tstr, sizeof(tstr), "disas 0x%" RV_PRI64 "x %d", |
startAddr_ - sz, sz); |
} else { |
RISCV_sprintf(tstr, sizeof(tstr), "disas 0x%" RV_PRI64 "x %d", |
endAddr_, sz); |
} |
cmdReadMem_.make_string(tstr); |
igui_->registerCommand(static_cast<IGuiCmdHandler *>(this), |
&cmdReadMem_, true); |
} |
QWidget::wheelEvent(ev); |
} |
|
void AsmArea::slotUpdateByTimer() { |
if (waitRegNpc_) { |
return; |
} |
waitRegNpc_ = true; |
igui_->registerCommand(static_cast<IGuiCmdHandler *>(this), |
&cmdRegs_, true); |
} |
|
void AsmArea::handleResponse(AttributeType *req, AttributeType *resp) { |
if (req->is_equal("reg npc")) { |
waitRegNpc_ = false; |
if (!resp->is_nil()) { |
npc_ = resp->to_uint64(); |
emit signalNpcChanged(); |
} |
} else if (strstr(req->to_string(), "br ")) { |
emit signalBreakpointsChanged(); |
} else if (strstr(req->to_string(), "disas") && !resp->is_nil()) { |
addMemBlock(*resp, asmLines_); |
emit signalAsmListChanged(); |
} |
} |
|
bool AsmArea::isNpcTrackEna() { |
return (fixaddr_ == ~0ull); |
} |
|
void AsmArea::slotNpcChanged() { |
int npc_row = getNpcRowIdx(); |
if (npc_row != -1) { |
selectNpcRow(npc_row); |
return; |
} |
if (!isNpcTrackEna()) { |
return; |
} |
|
char tstr[256]; |
RISCV_sprintf(tstr, sizeof(tstr), "disas 0x%" RV_PRI64 "x %d", |
npc_, 4*visibleLinesTotal_); |
cmdReadMem_.make_string(tstr); |
igui_->registerCommand(static_cast<IGuiCmdHandler *>(this), |
&cmdReadMem_, true); |
} |
|
void AsmArea::slotAsmListChanged() { |
RISCV_mutex_lock(&mutexAsmGaurd_); |
asmLinesOut_ = asmLines_; |
RISCV_mutex_unlock(&mutexAsmGaurd_); |
|
adjustRowCount(); |
clearSpans(); |
|
if (asmLinesOut_.size() == 0) { |
return; |
} |
|
bool reinit_start = true; |
for (unsigned i = 0; i < asmLinesOut_.size(); i++) { |
AttributeType &asmLine = asmLinesOut_[i]; |
if (!asmLine.is_list()) { |
continue; |
} |
switch (asmLine[ASM_list_type].to_uint32()) { |
case AsmList_symbol: |
outSymbolLine(static_cast<int>(i), asmLine); |
break; |
case AsmList_disasm: |
endAddr_ = asmLine[ASM_addrline].to_uint64(); |
if (reinit_start) { |
reinit_start = false; |
startAddr_ = endAddr_; |
} |
endAddr_ += asmLine[ASM_codesize].to_uint64(); |
outAsmLine(static_cast<int>(i), asmLine); |
break; |
default:; |
} |
} |
} |
|
void AsmArea::slotRedrawDisasm() { |
char tstr[256]; |
uint64_t sz = endAddr_ - startAddr_; |
if (sz == 0) { |
return; |
} |
if (sz > MAX_BYTES_VIEW) { |
sz = MAX_BYTES_VIEW; |
} |
RISCV_sprintf(tstr, sizeof(tstr), "disas 0x%" RV_PRI64 "x %d", |
startAddr_, sz); |
cmdReadMem_.make_string(tstr); |
igui_->registerCommand(static_cast<IGuiCmdHandler *>(this), |
&cmdReadMem_, true); |
} |
|
void AsmArea::slotCellDoubleClicked(int row, int column) { |
if (row >= static_cast<int>(asmLinesOut_.size())) { |
return; |
} |
AttributeType &asmLine = asmLinesOut_[row]; |
if (!asmLine.is_list() |
|| asmLine[ASM_list_type].to_uint32() != AsmList_disasm) { |
return; |
} |
char tstr[128]; |
bool is_breakpoint = asmLine[ASM_breakpoint].to_bool(); |
uint64_t addr = asmLine[ASM_addrline].to_uint64(); |
|
if (is_breakpoint) { |
RISCV_sprintf(tstr, sizeof(tstr), "br rm 0x%" RV_PRI64 "x", addr); |
} else { |
RISCV_sprintf(tstr, sizeof(tstr), "br add 0x%" RV_PRI64 "x", addr); |
} |
AttributeType brcmd(tstr); |
igui_->registerCommand(static_cast<IGuiCmdHandler *>(this), &brcmd, true); |
} |
|
int AsmArea::getNpcRowIdx() { |
for (unsigned i = 0; i < asmLinesOut_.size(); i++) { |
AttributeType &asmLine = asmLinesOut_[i]; |
if (!asmLine.is_list()) { |
continue; |
} |
if (asmLine[ASM_list_type].to_uint32() != AsmList_disasm) { |
continue; |
} |
if (npc_ == asmLine[ASM_addrline].to_uint64()) { |
return static_cast<int>(i); |
} |
} |
return -1; |
} |
|
void AsmArea::selectNpcRow(int idx) { |
QTableWidgetItem *p; |
if (selRowIdx != -1 && selRowIdx != idx) { |
p = item(selRowIdx, 0); |
p->setFlags(p->flags() & ~Qt::ItemIsSelectable); |
} |
selRowIdx = idx; |
p = item(selRowIdx, 0); |
p->setFlags(p->flags() | Qt::ItemIsSelectable); |
selectRow(selRowIdx); |
} |
|
void AsmArea::adjustRowCount() { |
int asm_cnt = static_cast<int>(asmLinesOut_.size()); |
int row_cnt = rowCount(); |
if (row_cnt < asm_cnt) { |
Qt::ItemFlags fl; |
setRowCount(asm_cnt); |
for (int i = row_cnt; i < asm_cnt; i++) { |
for (int n = 0; n < COL_Total; n++) { |
setItem(i, n, new QTableWidgetItem()); |
fl = item(i, n)->flags(); |
fl &= ~Qt::ItemIsEditable; |
fl &= ~Qt::ItemIsSelectable; |
item(i, n)->setFlags(fl); |
} |
setRowHeight(i, lineHeight_); |
item(i, 0)->setBackgroundColor(Qt::lightGray); |
item(i, 0)->setTextAlignment(Qt::AlignRight | Qt::AlignVCenter); |
} |
} |
if (hideLineIdx_ < asm_cnt) { |
for (int i = hideLineIdx_; i < asm_cnt; i++) { |
showRow(i); |
} |
} |
hideLineIdx_ = asm_cnt; |
for (int i = hideLineIdx_; i < rowCount(); i++) { |
hideRow(i); |
} |
} |
|
void AsmArea::outSymbolLine(int idx, AttributeType &line) { |
QTableWidgetItem *pw; |
uint64_t addr = line[ASM_addrline].to_uint64(); |
setSpan(idx, COL_label, 1, 3); |
|
pw = item(idx, COL_addrline); |
pw->setText(QString("<%1>").arg(addr, 16, 16, QChar('0'))); |
pw->setTextColor(QColor(Qt::darkBlue)); |
|
pw = item(idx, COL_code); |
pw->setBackgroundColor(Qt::lightGray); |
pw->setText(tr("")); |
|
pw = item(idx, COL_label); |
pw->setText(QString(line[ASM_code].to_string())); |
pw->setTextColor(QColor(Qt::darkBlue)); |
|
item(idx, COL_mnemonic)->setText(tr("")); |
item(idx, COL_comment)->setText(tr("")); |
} |
|
void AsmArea::outAsmLine(int idx, AttributeType &line) { |
QTableWidgetItem *pw; |
uint64_t addr = line[ASM_addrline].to_uint64(); |
if (addr == npc_) { |
selectNpcRow(idx); |
} |
|
pw = item(idx, COL_addrline); |
pw->setText(QString("%1").arg(addr, 16, 16, QChar('0'))); |
pw->setTextColor(QColor(Qt::black)); |
pw->setBackgroundColor(Qt::lightGray); |
|
pw = item(idx, COL_code); |
uint32_t instr = line[ASM_code].to_uint32(); |
if (line[ASM_breakpoint].to_bool()) { |
pw->setBackgroundColor(Qt::red); |
pw->setTextColor(Qt::white); |
} else if (pw->backgroundColor() != Qt::lightGray) { |
pw->setBackgroundColor(Qt::lightGray); |
pw->setTextColor(Qt::black); |
} |
pw->setText(QString("%1").arg(instr, 8, 16, QChar('0'))); |
|
pw = item(idx, COL_label); |
pw->setTextColor(Qt::black); |
pw->setText(QString(line[ASM_label].to_string())); |
|
pw = item(idx, COL_mnemonic); |
pw->setText(QString(line[ASM_mnemonic].to_string())); |
|
pw = item(idx, COL_comment); |
pw->setText(QString(line[ASM_comment].to_string())); |
} |
|
void AsmArea::addMemBlock(AttributeType &resp, |
AttributeType &lines) { |
uint64_t asm_addr_start = 0; |
uint64_t asm_addr_end = 0; |
if (!resp.is_list() || !resp.size()) { |
return; |
} |
if (!resp[0u].is_list() || !resp[resp.size() - 1].is_list()) { |
return; |
} |
if (lines.size()) { |
asm_addr_start = lines[0u][ASM_addrline].to_uint64(); |
asm_addr_end = lines[lines.size() - 1][ASM_addrline].to_uint64(); |
} |
uint64_t resp_addr_start = resp[0u][ASM_addrline].to_uint64(); |
uint64_t resp_addr_next = resp[resp.size() - 1][ASM_addrline].to_uint64(); |
resp_addr_next += resp[resp.size() - 1][ASM_codesize].to_uint64(); |
|
RISCV_mutex_lock(&mutexAsmGaurd_); |
if (resp_addr_next == asm_addr_start) { |
// Joint lines at the beginning of current list: |
for (unsigned i = 0; i < resp.size(); i++) { |
lines.insert_to_list(i, &resp[i]); |
} |
} else if (resp_addr_start >= asm_addr_start |
&& resp_addr_start <= asm_addr_end) { |
// Modify lines values: |
unsigned resp_idx = 0; |
for (unsigned i = 0; i < lines.size(); i++) { |
AttributeType &ln = lines[i]; |
if (resp_addr_start == ln[ASM_addrline].to_uint64()) { |
ln = resp[resp_idx++]; |
if (resp_idx < resp.size()) { |
resp_addr_start = resp[resp_idx][ASM_addrline].to_uint64(); |
} else { |
break; |
} |
} |
} |
for (unsigned i = resp_idx; i < resp.size(); i++) { |
lines.add_to_list(&resp[i]); |
} |
} else if (resp_addr_start == asm_addr_end + 4) { // fixme |
// Joint lines to end of the current list: |
for (unsigned i = 0; i < resp.size(); i++) { |
lines.add_to_list(&resp[i]); |
} |
} else { |
lines = resp; |
} |
RISCV_mutex_unlock(&mutexAsmGaurd_); |
} |
|
} // namespace debugger |
/** |
* @file |
* @copyright Copyright 2016 GNSS Sensor Ltd. All right reserved. |
* @author Sergey Khabarov - sergeykhbr@gmail.com |
* @brief Disassembler viewer area. |
*/ |
|
#include "AsmArea.h" |
#include "moc_AsmArea.h" |
|
#include <memory> |
#include <string.h> |
#include <QtWidgets/QBoxLayout> |
#include <QtWidgets/QLabel> |
#include <QtWidgets/QHeaderView> |
#include <QtWidgets/QScrollBar> |
|
namespace debugger { |
|
static const uint64_t MAX_BYTES_VIEW = 1 << 12; // 4096 |
|
AsmArea::AsmArea(IGui *gui, QWidget *parent, uint64_t fixaddr) |
: QTableWidget(parent) { |
igui_ = gui; |
cmdRegs_.make_string("reg npc"); |
cmdReadMem_.make_string("disas 0 0"); |
hideLineIdx_ = 0; |
selRowIdx = -1; |
fixaddr_ = fixaddr; |
waitRegNpc_ = false; |
|
clear(); |
QFont font("Courier"); |
font.setStyleHint(QFont::Monospace); |
font.setPointSize(8); |
font.setFixedPitch(true); |
setFont(font); |
setContentsMargins(QMargins(0, 0, 0, 0)); |
QFontMetrics fm(font); |
setMinimumWidth(50 + fm.width(tr( |
" :0011223344556677 11223344 1: addw r0,r1,0xaabbccdd ; commment"))); |
lineHeight_ = fm.height() + 4; |
visibleLinesTotal_ = 0; |
if (isNpcTrackEna()) { |
startAddr_ = 0; |
endAddr_ = 0; |
} else { |
startAddr_ = fixaddr_; |
endAddr_ = fixaddr_; // will be computed in resize() method |
} |
|
setColumnCount(COL_Total); |
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); |
setRowCount(1); |
asmLines_.make_list(0); |
asmLinesOut_.make_list(0); |
npc_ = ~0; |
|
verticalHeader()->setVisible(false); // remove row indexes |
setShowGrid(false); // remove borders |
setSelectionMode(QAbstractItemView::SingleSelection); |
setSelectionBehavior(QAbstractItemView::SelectRows); //select full row |
|
// change selected row color |
QPalette *palette = new QPalette(); |
palette->setColor(QPalette::Highlight, Qt::gray); |
setPalette(*palette); |
Qt::ItemFlags fl; |
for (int i = 0; i < rowCount(); i++) { |
for (int n = 0; n < COL_Total; n++) { |
setItem(i, n, new QTableWidgetItem()); |
fl = item(i, n)->flags(); |
fl &= ~Qt::ItemIsEditable; |
fl &= ~Qt::ItemIsSelectable; |
item(i, n)->setFlags(fl); |
} |
setRowHeight(i, lineHeight_); |
item(i, 0)->setBackgroundColor(Qt::lightGray); |
item(i, 0)->setTextAlignment(Qt::AlignRight | Qt::AlignVCenter); |
} |
|
setHorizontalHeaderLabels( |
QString("addr/line;code;label;mnemonic;comment").split(";")); |
setColumnWidth(0, 10 + fm.width(tr(" :0011223344556677"))); |
setColumnWidth(1, 10 + fm.width(tr("00112233"))); |
setColumnWidth(2, 10 + fm.width(tr("0"))); |
setColumnWidth(3, 10 + fm.width(tr("addw r1,r2,0x112233445566"))); |
setColumnWidth(4, 10 + fm.width(tr("some very long long comment+offset"))); |
|
connect(this, SIGNAL(signalNpcChanged()), |
this, SLOT(slotNpcChanged())); |
connect(this, SIGNAL(signalAsmListChanged()), |
this, SLOT(slotAsmListChanged())); |
connect(this, SIGNAL(cellDoubleClicked(int, int)), |
this, SLOT(slotCellDoubleClicked(int, int))); |
|
RISCV_mutex_init(&mutexAsmGaurd_); |
} |
|
AsmArea::~AsmArea() { |
igui_->removeFromQueue(static_cast<IGuiCmdHandler *>(this)); |
RISCV_mutex_destroy(&mutexAsmGaurd_); |
} |
|
void AsmArea::resizeEvent(QResizeEvent *ev) { |
int h = ev->size().height(); |
if (h < 4 * lineHeight_) { |
h = 4 * lineHeight_; |
} |
visibleLinesTotal_ = h / lineHeight_ + 2; |
|
if (isNpcTrackEna() && npc_ == ~0ull) { |
return; |
} |
|
int line_cnt = static_cast<int>(asmLinesOut_.size()); |
if (visibleLinesTotal_ > line_cnt) { |
char tstr[256]; |
RISCV_sprintf(tstr, sizeof(tstr), "disas 0x%" RV_PRI64 "x %d", |
endAddr_, |
4*(visibleLinesTotal_ - line_cnt)); |
cmdReadMem_.make_string(tstr); |
igui_->registerCommand(static_cast<IGuiCmdHandler *>(this), |
&cmdReadMem_, true); |
} |
|
QWidget::resizeEvent(ev); |
} |
|
void AsmArea::wheelEvent(QWheelEvent * ev) { |
int dlt = ev->delta(); |
int scroll_pos = verticalScrollBar()->value(); |
int scroll_min = verticalScrollBar()->minimum(); |
int scroll_max = verticalScrollBar()->maximum(); |
if (dlt >= 0 && scroll_pos > scroll_min) { |
verticalScrollBar()->setValue(--scroll_pos); |
} else if (dlt < 0 && scroll_pos < scroll_max) { |
verticalScrollBar()->setValue(++scroll_pos); |
} else { |
char tstr[128]; |
unsigned sz = 4 * static_cast<unsigned>(visibleLinesTotal_ / 2); |
if (dlt >= 0) { |
RISCV_sprintf(tstr, sizeof(tstr), "disas 0x%" RV_PRI64 "x %d", |
startAddr_ - sz, sz); |
} else { |
RISCV_sprintf(tstr, sizeof(tstr), "disas 0x%" RV_PRI64 "x %d", |
endAddr_, sz); |
} |
cmdReadMem_.make_string(tstr); |
igui_->registerCommand(static_cast<IGuiCmdHandler *>(this), |
&cmdReadMem_, true); |
} |
QWidget::wheelEvent(ev); |
} |
|
void AsmArea::slotUpdateByTimer() { |
if (waitRegNpc_) { |
return; |
} |
waitRegNpc_ = true; |
igui_->registerCommand(static_cast<IGuiCmdHandler *>(this), |
&cmdRegs_, true); |
} |
|
void AsmArea::handleResponse(AttributeType *req, AttributeType *resp) { |
if (req->is_equal("reg npc")) { |
waitRegNpc_ = false; |
if (!resp->is_nil()) { |
npc_ = resp->to_uint64(); |
emit signalNpcChanged(); |
} |
} else if (strstr(req->to_string(), "br ")) { |
emit signalBreakpointsChanged(); |
} else if (strstr(req->to_string(), "disas") && !resp->is_nil()) { |
addMemBlock(*resp, asmLines_); |
emit signalAsmListChanged(); |
} |
} |
|
bool AsmArea::isNpcTrackEna() { |
return (fixaddr_ == ~0ull); |
} |
|
void AsmArea::slotNpcChanged() { |
int npc_row = getNpcRowIdx(); |
if (npc_row != -1) { |
selectNpcRow(npc_row); |
return; |
} |
if (!isNpcTrackEna()) { |
return; |
} |
|
char tstr[256]; |
RISCV_sprintf(tstr, sizeof(tstr), "disas 0x%" RV_PRI64 "x %d", |
npc_, 4*visibleLinesTotal_); |
cmdReadMem_.make_string(tstr); |
igui_->registerCommand(static_cast<IGuiCmdHandler *>(this), |
&cmdReadMem_, true); |
} |
|
void AsmArea::slotAsmListChanged() { |
RISCV_mutex_lock(&mutexAsmGaurd_); |
asmLinesOut_ = asmLines_; |
RISCV_mutex_unlock(&mutexAsmGaurd_); |
|
adjustRowCount(); |
clearSpans(); |
|
if (asmLinesOut_.size() == 0) { |
return; |
} |
|
bool reinit_start = true; |
for (unsigned i = 0; i < asmLinesOut_.size(); i++) { |
AttributeType &asmLine = asmLinesOut_[i]; |
if (!asmLine.is_list()) { |
continue; |
} |
switch (asmLine[ASM_list_type].to_uint32()) { |
case AsmList_symbol: |
outSymbolLine(static_cast<int>(i), asmLine); |
break; |
case AsmList_disasm: |
endAddr_ = asmLine[ASM_addrline].to_uint64(); |
if (reinit_start) { |
reinit_start = false; |
startAddr_ = endAddr_; |
} |
endAddr_ += asmLine[ASM_codesize].to_uint64(); |
outAsmLine(static_cast<int>(i), asmLine); |
break; |
default:; |
} |
} |
} |
|
void AsmArea::slotRedrawDisasm() { |
char tstr[256]; |
uint64_t sz = endAddr_ - startAddr_; |
if (sz == 0) { |
return; |
} |
if (sz > MAX_BYTES_VIEW) { |
sz = MAX_BYTES_VIEW; |
} |
RISCV_sprintf(tstr, sizeof(tstr), "disas 0x%" RV_PRI64 "x %d", |
startAddr_, sz); |
cmdReadMem_.make_string(tstr); |
igui_->registerCommand(static_cast<IGuiCmdHandler *>(this), |
&cmdReadMem_, true); |
} |
|
void AsmArea::slotCellDoubleClicked(int row, int column) { |
if (row >= static_cast<int>(asmLinesOut_.size())) { |
return; |
} |
AttributeType &asmLine = asmLinesOut_[row]; |
if (!asmLine.is_list() |
|| asmLine[ASM_list_type].to_uint32() != AsmList_disasm) { |
return; |
} |
char tstr[128]; |
bool is_breakpoint = asmLine[ASM_breakpoint].to_bool(); |
uint64_t addr = asmLine[ASM_addrline].to_uint64(); |
|
if (is_breakpoint) { |
RISCV_sprintf(tstr, sizeof(tstr), "br rm 0x%" RV_PRI64 "x", addr); |
} else { |
RISCV_sprintf(tstr, sizeof(tstr), "br add 0x%" RV_PRI64 "x", addr); |
} |
AttributeType brcmd(tstr); |
igui_->registerCommand(static_cast<IGuiCmdHandler *>(this), &brcmd, true); |
} |
|
int AsmArea::getNpcRowIdx() { |
for (unsigned i = 0; i < asmLinesOut_.size(); i++) { |
AttributeType &asmLine = asmLinesOut_[i]; |
if (!asmLine.is_list()) { |
continue; |
} |
if (asmLine[ASM_list_type].to_uint32() != AsmList_disasm) { |
continue; |
} |
if (npc_ == asmLine[ASM_addrline].to_uint64()) { |
return static_cast<int>(i); |
} |
} |
return -1; |
} |
|
void AsmArea::selectNpcRow(int idx) { |
QTableWidgetItem *p; |
if (selRowIdx != -1 && selRowIdx != idx) { |
p = item(selRowIdx, 0); |
p->setFlags(p->flags() & ~Qt::ItemIsSelectable); |
} |
selRowIdx = idx; |
p = item(selRowIdx, 0); |
p->setFlags(p->flags() | Qt::ItemIsSelectable); |
selectRow(selRowIdx); |
} |
|
void AsmArea::adjustRowCount() { |
int asm_cnt = static_cast<int>(asmLinesOut_.size()); |
int row_cnt = rowCount(); |
if (row_cnt < asm_cnt) { |
Qt::ItemFlags fl; |
setRowCount(asm_cnt); |
for (int i = row_cnt; i < asm_cnt; i++) { |
for (int n = 0; n < COL_Total; n++) { |
setItem(i, n, new QTableWidgetItem()); |
fl = item(i, n)->flags(); |
fl &= ~Qt::ItemIsEditable; |
fl &= ~Qt::ItemIsSelectable; |
item(i, n)->setFlags(fl); |
} |
setRowHeight(i, lineHeight_); |
item(i, 0)->setBackgroundColor(Qt::lightGray); |
item(i, 0)->setTextAlignment(Qt::AlignRight | Qt::AlignVCenter); |
} |
} |
if (hideLineIdx_ < asm_cnt) { |
for (int i = hideLineIdx_; i < asm_cnt; i++) { |
showRow(i); |
} |
} |
hideLineIdx_ = asm_cnt; |
for (int i = hideLineIdx_; i < rowCount(); i++) { |
hideRow(i); |
} |
} |
|
void AsmArea::outSymbolLine(int idx, AttributeType &line) { |
QTableWidgetItem *pw; |
uint64_t addr = line[ASM_addrline].to_uint64(); |
setSpan(idx, COL_label, 1, 3); |
|
pw = item(idx, COL_addrline); |
pw->setText(QString("<%1>").arg(addr, 16, 16, QChar('0'))); |
pw->setTextColor(QColor(Qt::darkBlue)); |
|
pw = item(idx, COL_code); |
pw->setBackgroundColor(Qt::lightGray); |
pw->setText(tr("")); |
|
pw = item(idx, COL_label); |
pw->setText(QString(line[ASM_code].to_string())); |
pw->setTextColor(QColor(Qt::darkBlue)); |
|
item(idx, COL_mnemonic)->setText(tr("")); |
item(idx, COL_comment)->setText(tr("")); |
} |
|
void AsmArea::outAsmLine(int idx, AttributeType &line) { |
QTableWidgetItem *pw; |
uint64_t addr = line[ASM_addrline].to_uint64(); |
if (addr == npc_) { |
selectNpcRow(idx); |
} |
|
pw = item(idx, COL_addrline); |
pw->setText(QString("%1").arg(addr, 16, 16, QChar('0'))); |
pw->setTextColor(QColor(Qt::black)); |
pw->setBackgroundColor(Qt::lightGray); |
|
pw = item(idx, COL_code); |
uint32_t instr = line[ASM_code].to_uint32(); |
if (line[ASM_breakpoint].to_bool()) { |
pw->setBackgroundColor(Qt::red); |
pw->setTextColor(Qt::white); |
} else if (pw->backgroundColor() != Qt::lightGray) { |
pw->setBackgroundColor(Qt::lightGray); |
pw->setTextColor(Qt::black); |
} |
pw->setText(QString("%1").arg(instr, 8, 16, QChar('0'))); |
|
pw = item(idx, COL_label); |
pw->setTextColor(Qt::black); |
pw->setText(QString(line[ASM_label].to_string())); |
|
pw = item(idx, COL_mnemonic); |
pw->setText(QString(line[ASM_mnemonic].to_string())); |
|
pw = item(idx, COL_comment); |
pw->setText(QString(line[ASM_comment].to_string())); |
} |
|
void AsmArea::addMemBlock(AttributeType &resp, |
AttributeType &lines) { |
uint64_t asm_addr_start = 0; |
uint64_t asm_addr_end = 0; |
if (!resp.is_list() || !resp.size()) { |
return; |
} |
if (!resp[0u].is_list() || !resp[resp.size() - 1].is_list()) { |
return; |
} |
if (lines.size()) { |
asm_addr_start = lines[0u][ASM_addrline].to_uint64(); |
asm_addr_end = lines[lines.size() - 1][ASM_addrline].to_uint64(); |
} |
uint64_t resp_addr_start = resp[0u][ASM_addrline].to_uint64(); |
uint64_t resp_addr_next = resp[resp.size() - 1][ASM_addrline].to_uint64(); |
resp_addr_next += resp[resp.size() - 1][ASM_codesize].to_uint64(); |
|
RISCV_mutex_lock(&mutexAsmGaurd_); |
if (resp_addr_next == asm_addr_start) { |
// Joint lines at the beginning of current list: |
for (unsigned i = 0; i < resp.size(); i++) { |
lines.insert_to_list(i, &resp[i]); |
} |
} else if (resp_addr_start >= asm_addr_start |
&& resp_addr_start <= asm_addr_end) { |
// Modify lines values: |
unsigned resp_idx = 0; |
for (unsigned i = 0; i < lines.size(); i++) { |
AttributeType &ln = lines[i]; |
if (resp_addr_start == ln[ASM_addrline].to_uint64()) { |
ln = resp[resp_idx++]; |
if (resp_idx < resp.size()) { |
resp_addr_start = resp[resp_idx][ASM_addrline].to_uint64(); |
} else { |
break; |
} |
} |
} |
for (unsigned i = resp_idx; i < resp.size(); i++) { |
lines.add_to_list(&resp[i]); |
} |
} else if (resp_addr_start == asm_addr_end + 4) { // fixme |
// Joint lines to end of the current list: |
for (unsigned i = 0; i < resp.size(); i++) { |
lines.add_to_list(&resp[i]); |
} |
} else { |
lines = resp; |
} |
RISCV_mutex_unlock(&mutexAsmGaurd_); |
} |
|
} // namespace debugger |
/AsmArea.h
1,87 → 1,87
/** |
* @file |
* @copyright Copyright 2016 GNSS Sensor Ltd. All right reserved. |
* @author Sergey Khabarov - sergeykhbr@gmail.com |
* @brief Disassembler viewer area. |
*/ |
|
#pragma once |
|
#include "api_core.h" // MUST BE BEFORE QtWidgets.h or any other Qt header. |
#include "attribute.h" |
#include "igui.h" |
#include "iservice.h" |
#include "coreservices/isocinfo.h" |
#include "coreservices/isrccode.h" |
|
#include <QtWidgets/QWidget> |
#include <QtWidgets/QTableWidget> |
#include <QtGui/QResizeEvent> |
|
namespace debugger { |
|
class AsmArea : public QTableWidget, |
public IGuiCmdHandler { |
Q_OBJECT |
public: |
explicit AsmArea(IGui *gui, QWidget *parent, uint64_t fixaddr); |
virtual ~AsmArea(); |
|
/** IGuiCmdHandler */ |
virtual void handleResponse(AttributeType *req, AttributeType *resp); |
|
signals: |
void signalNpcChanged(); |
void signalAsmListChanged(); |
void signalBreakpointsChanged(); |
|
public slots: |
void slotNpcChanged(); |
void slotAsmListChanged(); |
void slotUpdateByTimer(); |
void slotRedrawDisasm(); |
void slotCellDoubleClicked(int row, int column); |
|
protected: |
void resizeEvent(QResizeEvent *ev) Q_DECL_OVERRIDE; |
void wheelEvent(QWheelEvent * ev) Q_DECL_OVERRIDE; |
|
private: |
bool isNpcTrackEna(); |
int getNpcRowIdx(); |
void selectNpcRow(int idx); |
void adjustRowCount(); |
void outSymbolLine(int idx, AttributeType &data); |
void outAsmLine(int idx, AttributeType &data); |
void addMemBlock(AttributeType &resp, AttributeType &lines); |
|
private: |
enum EColumnNames { |
COL_addrline, |
COL_code, |
COL_label, |
COL_mnemonic, |
COL_comment, |
COL_Total |
}; |
|
AttributeType cmdReadMem_; |
AttributeType cmdRegs_; |
AttributeType asmLines_; |
AttributeType asmLinesOut_; |
QString name_; |
IGui *igui_; |
|
uint64_t fixaddr_; |
int selRowIdx; |
int hideLineIdx_; |
int lineHeight_; |
mutex_def mutexAsmGaurd_; |
uint64_t npc_; |
int visibleLinesTotal_; |
uint64_t startAddr_; |
uint64_t endAddr_; |
bool waitRegNpc_; |
}; |
|
} // namespace debugger |
/** |
* @file |
* @copyright Copyright 2016 GNSS Sensor Ltd. All right reserved. |
* @author Sergey Khabarov - sergeykhbr@gmail.com |
* @brief Disassembler viewer area. |
*/ |
|
#pragma once |
|
#include "api_core.h" // MUST BE BEFORE QtWidgets.h or any other Qt header. |
#include "attribute.h" |
#include "igui.h" |
#include "iservice.h" |
#include "coreservices/isocinfo.h" |
#include "coreservices/isrccode.h" |
|
#include <QtWidgets/QWidget> |
#include <QtWidgets/QTableWidget> |
#include <QtGui/QResizeEvent> |
|
namespace debugger { |
|
class AsmArea : public QTableWidget, |
public IGuiCmdHandler { |
Q_OBJECT |
public: |
explicit AsmArea(IGui *gui, QWidget *parent, uint64_t fixaddr); |
virtual ~AsmArea(); |
|
/** IGuiCmdHandler */ |
virtual void handleResponse(AttributeType *req, AttributeType *resp); |
|
signals: |
void signalNpcChanged(); |
void signalAsmListChanged(); |
void signalBreakpointsChanged(); |
|
public slots: |
void slotNpcChanged(); |
void slotAsmListChanged(); |
void slotUpdateByTimer(); |
void slotRedrawDisasm(); |
void slotCellDoubleClicked(int row, int column); |
|
protected: |
void resizeEvent(QResizeEvent *ev) Q_DECL_OVERRIDE; |
void wheelEvent(QWheelEvent * ev) Q_DECL_OVERRIDE; |
|
private: |
bool isNpcTrackEna(); |
int getNpcRowIdx(); |
void selectNpcRow(int idx); |
void adjustRowCount(); |
void outSymbolLine(int idx, AttributeType &data); |
void outAsmLine(int idx, AttributeType &data); |
void addMemBlock(AttributeType &resp, AttributeType &lines); |
|
private: |
enum EColumnNames { |
COL_addrline, |
COL_code, |
COL_label, |
COL_mnemonic, |
COL_comment, |
COL_Total |
}; |
|
AttributeType cmdReadMem_; |
AttributeType cmdRegs_; |
AttributeType asmLines_; |
AttributeType asmLinesOut_; |
QString name_; |
IGui *igui_; |
|
uint64_t fixaddr_; |
int selRowIdx; |
int hideLineIdx_; |
int lineHeight_; |
mutex_def mutexAsmGaurd_; |
uint64_t npc_; |
int visibleLinesTotal_; |
uint64_t startAddr_; |
uint64_t endAddr_; |
bool waitRegNpc_; |
}; |
|
} // namespace debugger |
/AsmControl.cpp
1,60 → 1,60
/** |
* @file |
* @copyright Copyright 2016 GNSS Sensor Ltd. All right reserved. |
* @author Sergey Khabarov - sergeykhbr@gmail.com |
* @brief Disassembler control panel. |
*/ |
|
#include "AsmControl.h" |
#include "moc_AsmControl.h" |
|
#include <memory> |
#include <string.h> |
#include <QtWidgets/QBoxLayout> |
#include <QtWidgets/QLabel> |
#include <QtWidgets/QPushButton> |
|
namespace debugger { |
|
AsmControl::AsmControl(QWidget *parent) |
: QWidget(parent) { |
QFont font = QFont("Courier"); |
font.setStyleHint(QFont::Monospace); |
font.setPointSize(8); |
font.setFixedPitch(true); |
setFont(font); |
QFontMetrics fm(font); |
|
paletteModified_.setColor(QPalette::Base, Qt::yellow); |
paletteModified_.setColor(QPalette::Text, Qt::black); |
|
paletteDefault_.setColor(QPalette::Text, Qt::black); |
paletteDefault_.setColor(QPalette::Base, Qt::white); |
|
|
QGridLayout *gridLayout = new QGridLayout(this); |
setLayout(gridLayout); |
|
|
QLabel *lbl = new QLabel("Source view:"); |
gridLayout->addWidget(lbl, 0, 0, Qt::AlignRight); |
|
|
cmd_.make_list(2); |
} |
|
void AsmControl::slotModified() { |
} |
|
void AsmControl::slotUpdate() { |
if (!isChanged()) { |
return; |
} |
} |
|
bool AsmControl::isChanged() { |
return true; |
} |
|
|
} // namespace debugger |
/** |
* @file |
* @copyright Copyright 2016 GNSS Sensor Ltd. All right reserved. |
* @author Sergey Khabarov - sergeykhbr@gmail.com |
* @brief Disassembler control panel. |
*/ |
|
#include "AsmControl.h" |
#include "moc_AsmControl.h" |
|
#include <memory> |
#include <string.h> |
#include <QtWidgets/QBoxLayout> |
#include <QtWidgets/QLabel> |
#include <QtWidgets/QPushButton> |
|
namespace debugger { |
|
AsmControl::AsmControl(QWidget *parent) |
: QWidget(parent) { |
QFont font = QFont("Courier"); |
font.setStyleHint(QFont::Monospace); |
font.setPointSize(8); |
font.setFixedPitch(true); |
setFont(font); |
QFontMetrics fm(font); |
|
paletteModified_.setColor(QPalette::Base, Qt::yellow); |
paletteModified_.setColor(QPalette::Text, Qt::black); |
|
paletteDefault_.setColor(QPalette::Text, Qt::black); |
paletteDefault_.setColor(QPalette::Base, Qt::white); |
|
|
QGridLayout *gridLayout = new QGridLayout(this); |
setLayout(gridLayout); |
|
|
QLabel *lbl = new QLabel("Source view:"); |
gridLayout->addWidget(lbl, 0, 0, Qt::AlignRight); |
|
|
cmd_.make_list(2); |
} |
|
void AsmControl::slotModified() { |
} |
|
void AsmControl::slotUpdate() { |
if (!isChanged()) { |
return; |
} |
} |
|
bool AsmControl::isChanged() { |
return true; |
} |
|
|
} // namespace debugger |
/AsmControl.h
1,43 → 1,43
/** |
* @file |
* @copyright Copyright 2016 GNSS Sensor Ltd. All right reserved. |
* @author Sergey Khabarov - sergeykhbr@gmail.com |
* @brief Disassembler control panel. |
*/ |
|
#pragma once |
|
#include "api_core.h" // MUST BE BEFORE QtWidgets.h or any other Qt header. |
#include "attribute.h" |
#include "igui.h" |
|
#include <QtWidgets/QWidget> |
#include <QtWidgets/QLineEdit> |
|
|
namespace debugger { |
|
class AsmControl : public QWidget { |
Q_OBJECT |
public: |
explicit AsmControl(QWidget *parent); |
|
signals: |
void signalAddressChanged(AttributeType *cmd); |
|
public slots: |
void slotModified(); |
void slotUpdate(); |
|
private: |
bool isChanged(); |
|
private: |
QLineEdit *editAddr_; |
QLineEdit *editBytes_; |
QPalette paletteDefault_; |
QPalette paletteModified_; |
AttributeType cmd_; |
}; |
|
} // namespace debugger |
/** |
* @file |
* @copyright Copyright 2016 GNSS Sensor Ltd. All right reserved. |
* @author Sergey Khabarov - sergeykhbr@gmail.com |
* @brief Disassembler control panel. |
*/ |
|
#pragma once |
|
#include "api_core.h" // MUST BE BEFORE QtWidgets.h or any other Qt header. |
#include "attribute.h" |
#include "igui.h" |
|
#include <QtWidgets/QWidget> |
#include <QtWidgets/QLineEdit> |
|
|
namespace debugger { |
|
class AsmControl : public QWidget { |
Q_OBJECT |
public: |
explicit AsmControl(QWidget *parent); |
|
signals: |
void signalAddressChanged(AttributeType *cmd); |
|
public slots: |
void slotModified(); |
void slotUpdate(); |
|
private: |
bool isChanged(); |
|
private: |
QLineEdit *editAddr_; |
QLineEdit *editBytes_; |
QPalette paletteDefault_; |
QPalette paletteModified_; |
AttributeType cmd_; |
}; |
|
} // namespace debugger |
/AsmViewWidget.cpp
1,45 → 1,45
/** |
* @file |
* @copyright Copyright 2016 GNSS Sensor Ltd. All right reserved. |
* @author Sergey Khabarov - sergeykhbr@gmail.com |
* @brief Disassembler viewer form. |
*/ |
|
#include "AsmArea.h" |
#include "AsmControl.h" |
#include "AsmViewWidget.h" |
#include "moc_AsmViewWidget.h" |
|
#include <memory> |
|
namespace debugger { |
|
AsmViewWidget::AsmViewWidget(IGui *igui, QWidget *parent, uint64_t fixaddr) |
: QWidget(parent) { |
igui_ = igui; |
|
gridLayout = new QGridLayout(this); |
gridLayout->setSpacing(4); |
gridLayout->setHorizontalSpacing(10); |
gridLayout->setVerticalSpacing(0); |
gridLayout->setContentsMargins(4, 4, 4, 4); |
setLayout(gridLayout); |
|
AsmControl *pctrl = new AsmControl(this); |
|
AsmArea *parea = new AsmArea(igui, this, fixaddr); |
gridLayout->addWidget(pctrl , 0, 0); |
gridLayout->addWidget(parea, 1, 0); |
gridLayout->setRowStretch(1, 10); |
|
connect(this, SIGNAL(signalUpdateByTimer()), |
parea, SLOT(slotUpdateByTimer())); |
|
connect(parea, SIGNAL(signalBreakpointsChanged()), |
this, SLOT(slotBreakpointsChanged())); |
|
connect(this, SIGNAL(signalRedrawDisasm()), |
parea, SLOT(slotRedrawDisasm())); |
} |
|
} // namespace debugger |
/** |
* @file |
* @copyright Copyright 2016 GNSS Sensor Ltd. All right reserved. |
* @author Sergey Khabarov - sergeykhbr@gmail.com |
* @brief Disassembler viewer form. |
*/ |
|
#include "AsmArea.h" |
#include "AsmControl.h" |
#include "AsmViewWidget.h" |
#include "moc_AsmViewWidget.h" |
|
#include <memory> |
|
namespace debugger { |
|
AsmViewWidget::AsmViewWidget(IGui *igui, QWidget *parent, uint64_t fixaddr) |
: QWidget(parent) { |
igui_ = igui; |
|
gridLayout = new QGridLayout(this); |
gridLayout->setSpacing(4); |
gridLayout->setHorizontalSpacing(10); |
gridLayout->setVerticalSpacing(0); |
gridLayout->setContentsMargins(4, 4, 4, 4); |
setLayout(gridLayout); |
|
AsmControl *pctrl = new AsmControl(this); |
|
AsmArea *parea = new AsmArea(igui, this, fixaddr); |
gridLayout->addWidget(pctrl , 0, 0); |
gridLayout->addWidget(parea, 1, 0); |
gridLayout->setRowStretch(1, 10); |
|
connect(this, SIGNAL(signalUpdateByTimer()), |
parea, SLOT(slotUpdateByTimer())); |
|
connect(parea, SIGNAL(signalBreakpointsChanged()), |
this, SLOT(slotBreakpointsChanged())); |
|
connect(this, SIGNAL(signalRedrawDisasm()), |
parea, SLOT(slotRedrawDisasm())); |
} |
|
} // namespace debugger |
/AsmViewWidget.h
1,94 → 1,94
/** |
* @file |
* @copyright Copyright 2016 GNSS Sensor Ltd. All right reserved. |
* @author Sergey Khabarov - sergeykhbr@gmail.com |
* @brief Disassembler viewer form. |
*/ |
|
#pragma once |
|
#include "api_core.h" // MUST BE BEFORE QtWidgets.h or any other Qt header. |
#include "attribute.h" |
#include "igui.h" |
|
#include <QtWidgets/QMdiArea> |
#include <QtWidgets/QMdiSubWindow> |
#include <QtWidgets/QGridLayout> |
#include <QtWidgets/QAction> |
#include <QtCore/QEvent> |
#include <QtGui/qevent.h> |
|
namespace debugger { |
|
class AsmViewWidget : public QWidget { |
Q_OBJECT |
public: |
AsmViewWidget(IGui *igui, QWidget *parent, uint64_t fixaddr); |
|
signals: |
void signalUpdateByTimer(); |
void signalBreakpointsChanged(); |
void signalRedrawDisasm(); |
|
private slots: |
void slotUpdateByTimer() { |
emit signalUpdateByTimer(); |
} |
|
void slotBreakpointsChanged() { |
emit signalBreakpointsChanged(); |
} |
|
void slotRedrawDisasm() { |
emit signalRedrawDisasm(); |
} |
|
private: |
AttributeType listMem_; |
QGridLayout *gridLayout; |
|
IGui *igui_; |
}; |
|
|
class AsmQMdiSubWindow : public QMdiSubWindow { |
Q_OBJECT |
public: |
AsmQMdiSubWindow(IGui *igui, QMdiArea *area, QWidget *parent = 0, |
QAction *act = 0, uint64_t fixaddr = ~0ull) |
: QMdiSubWindow(parent) { |
setAttribute(Qt::WA_DeleteOnClose); |
action_ = act; |
area_ = area; |
setWindowTitle(tr("Disassembler")); |
QWidget *pnew = new AsmViewWidget(igui, this, fixaddr); |
setWindowIcon(QIcon(tr(":/images/asm_96x96.png"))); |
if (act) { |
act->setChecked(true); |
connect(parent, SIGNAL(signalUpdateByTimer()), |
pnew, SLOT(slotUpdateByTimer())); |
} |
|
connect(pnew, SIGNAL(signalBreakpointsChanged()), |
parent, SLOT(slotBreakpointsChanged())); |
connect(parent, SIGNAL(signalRedrawDisasm()), |
pnew, SLOT(slotRedrawDisasm())); |
setWidget(pnew); |
area_->addSubWindow(this); |
show(); |
} |
|
protected: |
void closeEvent(QCloseEvent *event_) Q_DECL_OVERRIDE { |
if (action_) { |
action_->setChecked(false); |
} |
area_->removeSubWindow(this); |
event_->accept(); |
} |
private: |
QAction *action_; |
QMdiArea *area_; |
}; |
|
} // namespace debugger |
/** |
* @file |
* @copyright Copyright 2016 GNSS Sensor Ltd. All right reserved. |
* @author Sergey Khabarov - sergeykhbr@gmail.com |
* @brief Disassembler viewer form. |
*/ |
|
#pragma once |
|
#include "api_core.h" // MUST BE BEFORE QtWidgets.h or any other Qt header. |
#include "attribute.h" |
#include "igui.h" |
|
#include <QtWidgets/QMdiArea> |
#include <QtWidgets/QMdiSubWindow> |
#include <QtWidgets/QGridLayout> |
#include <QtWidgets/QAction> |
#include <QtCore/QEvent> |
#include <QtGui/qevent.h> |
|
namespace debugger { |
|
class AsmViewWidget : public QWidget { |
Q_OBJECT |
public: |
AsmViewWidget(IGui *igui, QWidget *parent, uint64_t fixaddr); |
|
signals: |
void signalUpdateByTimer(); |
void signalBreakpointsChanged(); |
void signalRedrawDisasm(); |
|
private slots: |
void slotUpdateByTimer() { |
emit signalUpdateByTimer(); |
} |
|
void slotBreakpointsChanged() { |
emit signalBreakpointsChanged(); |
} |
|
void slotRedrawDisasm() { |
emit signalRedrawDisasm(); |
} |
|
private: |
AttributeType listMem_; |
QGridLayout *gridLayout; |
|
IGui *igui_; |
}; |
|
|
class AsmQMdiSubWindow : public QMdiSubWindow { |
Q_OBJECT |
public: |
AsmQMdiSubWindow(IGui *igui, QMdiArea *area, QWidget *parent = 0, |
QAction *act = 0, uint64_t fixaddr = ~0ull) |
: QMdiSubWindow(parent) { |
setAttribute(Qt::WA_DeleteOnClose); |
action_ = act; |
area_ = area; |
setWindowTitle(tr("Disassembler")); |
QWidget *pnew = new AsmViewWidget(igui, this, fixaddr); |
setWindowIcon(QIcon(tr(":/images/asm_96x96.png"))); |
if (act) { |
act->setChecked(true); |
connect(parent, SIGNAL(signalUpdateByTimer()), |
pnew, SLOT(slotUpdateByTimer())); |
} |
|
connect(pnew, SIGNAL(signalBreakpointsChanged()), |
parent, SLOT(slotBreakpointsChanged())); |
connect(parent, SIGNAL(signalRedrawDisasm()), |
pnew, SLOT(slotRedrawDisasm())); |
setWidget(pnew); |
area_->addSubWindow(this); |
show(); |
} |
|
protected: |
void closeEvent(QCloseEvent *event_) Q_DECL_OVERRIDE { |
if (action_) { |
action_->setChecked(false); |
} |
area_->removeSubWindow(this); |
event_->accept(); |
} |
private: |
QAction *action_; |
QMdiArea *area_; |
}; |
|
} // namespace debugger |
/MemArea.cpp
1,138 → 1,138
/** |
* @file |
* @copyright Copyright 2016 GNSS Sensor Ltd. All right reserved. |
* @author Sergey Khabarov - sergeykhbr@gmail.com |
* @brief Memory Editor area. |
*/ |
|
#include "MemArea.h" |
#include "moc_MemArea.h" |
|
#include <memory> |
#include <string.h> |
#include <QtWidgets/QBoxLayout> |
#include <QtWidgets/QLabel> |
|
namespace debugger { |
|
MemArea::MemArea(IGui *gui, QWidget *parent, uint64_t addr, uint64_t sz) |
: QPlainTextEdit(parent) { |
igui_ = gui; |
reqAddr_ = addr; |
reqBytes_ = sz; |
cmdRead_.make_string("read 0x80000000 20"); |
data_.make_data(0); |
tmpBuf_.make_data(1024); |
dataText_.make_string(""); |
waitingResponse_ = false; |
|
clear(); |
QFont font("Courier"); |
font.setStyleHint(QFont::Monospace); |
font.setPointSize(8); |
font.setFixedPitch(true); |
setFont(font); |
QFontMetrics fm(font); |
setMinimumWidth(20 + fm.width(tr("[0011223344556677]: 11 22 33 44 55 66 77 88 "))); |
|
ensureCursorVisible(); |
|
connect(this, SIGNAL(signalUpdateData()), this, SLOT(slotUpdateData())); |
slotUpdateByTimer(); |
} |
|
MemArea::~MemArea() { |
igui_->removeFromQueue(static_cast<IGuiCmdHandler *>(this)); |
} |
|
void MemArea::slotAddressChanged(AttributeType *cmd) { |
reqAddr_ = (*cmd)[0u].to_uint64(); |
reqBytes_ = static_cast<unsigned>((*cmd)[1].to_int()); |
} |
|
void MemArea::slotUpdateByTimer() { |
char tstr[128]; |
if (waitingResponse_) { |
waitingResponse_ = true; |
} |
RISCV_sprintf(tstr, sizeof(tstr), "read 0x%08" RV_PRI64 "x %d", |
reqAddr_, reqBytes_); |
cmdRead_.make_string(tstr); |
|
reqAddrZ_ = reqAddr_; |
reqBytesZ_ = reqBytes_; |
igui_->registerCommand(static_cast<IGuiCmdHandler *>(this), |
&cmdRead_, true); |
} |
|
void MemArea::slotUpdateData() { |
moveCursor(QTextCursor::End); |
moveCursor(QTextCursor::Start, QTextCursor::KeepAnchor); |
QTextCursor cursor = textCursor(); |
cursor.insertText(tr(dataText_.to_string())); |
update(); |
} |
|
void MemArea::handleResponse(AttributeType *req, AttributeType *resp) { |
bool changed = false; |
waitingResponse_ = false; |
if (resp->is_nil()) { |
return; |
} |
if (resp->size() != data_.size()) { |
changed = true; |
} else { |
for (unsigned i = 0; i < resp->size(); i++) { |
if ((*resp)(i) != data_(i)) { |
changed = true; |
break; |
} |
} |
} |
if (!changed) { |
return; |
} |
|
data_ = *resp; |
to_string(reqAddrZ_, data_.size(), &dataText_); |
emit signalUpdateData(); |
} |
|
void MemArea::to_string(uint64_t addr, unsigned bytes, AttributeType *out) { |
const uint64_t MSK64 = 0x7ull; |
uint64_t addr_start, addr_end, inv_i; |
addr_start = addr & ~MSK64; |
addr_end = (addr + bytes + 7) & ~MSK64; |
|
/** Each 8 bytes of data requires 44 bytes in string [addr]: .. .. |
Let it be 64 bytes per 8 bytes of data |
*/ |
if (tmpBuf_.size() < 8 * data_.size()) { |
tmpBuf_.make_data(8 * data_.size()); |
} |
int strsz = 0; |
|
int bufsz = tmpBuf_.size(); |
char *strbuf = reinterpret_cast<char *>(tmpBuf_.data()); |
for (uint64_t i = addr_start; i < addr_end; i++) { |
if ((i & MSK64) == 0) { |
// Output address: |
strsz += RISCV_sprintf(&strbuf[strsz], bufsz - strsz, |
"[%016" RV_PRI64 "x]: ", i); |
} |
inv_i = (i & ~MSK64) | (MSK64 - (i & MSK64)); |
if ((addr <= inv_i) && (inv_i < (addr + bytes))) { |
strsz += RISCV_sprintf(&strbuf[strsz], bufsz - strsz, |
" %02x", data_(inv_i - addr)); |
} else { |
strsz += RISCV_sprintf(&strbuf[strsz], bufsz - strsz, " .."); |
} |
if ((i & MSK64) == MSK64) { |
strsz += RISCV_sprintf(&strbuf[strsz], bufsz - strsz, "\n"); |
} |
} |
out->make_string(strbuf); |
} |
|
|
} // namespace debugger |
/** |
* @file |
* @copyright Copyright 2016 GNSS Sensor Ltd. All right reserved. |
* @author Sergey Khabarov - sergeykhbr@gmail.com |
* @brief Memory Editor area. |
*/ |
|
#include "MemArea.h" |
#include "moc_MemArea.h" |
|
#include <memory> |
#include <string.h> |
#include <QtWidgets/QBoxLayout> |
#include <QtWidgets/QLabel> |
|
namespace debugger { |
|
MemArea::MemArea(IGui *gui, QWidget *parent, uint64_t addr, uint64_t sz) |
: QPlainTextEdit(parent) { |
igui_ = gui; |
reqAddr_ = addr; |
reqBytes_ = sz; |
cmdRead_.make_string("read 0x80000000 20"); |
data_.make_data(0); |
tmpBuf_.make_data(1024); |
dataText_.make_string(""); |
waitingResponse_ = false; |
|
clear(); |
QFont font("Courier"); |
font.setStyleHint(QFont::Monospace); |
font.setPointSize(8); |
font.setFixedPitch(true); |
setFont(font); |
QFontMetrics fm(font); |
setMinimumWidth(20 + fm.width(tr("[0011223344556677]: 11 22 33 44 55 66 77 88 "))); |
|
ensureCursorVisible(); |
|
connect(this, SIGNAL(signalUpdateData()), this, SLOT(slotUpdateData())); |
slotUpdateByTimer(); |
} |
|
MemArea::~MemArea() { |
igui_->removeFromQueue(static_cast<IGuiCmdHandler *>(this)); |
} |
|
void MemArea::slotAddressChanged(AttributeType *cmd) { |
reqAddr_ = (*cmd)[0u].to_uint64(); |
reqBytes_ = static_cast<unsigned>((*cmd)[1].to_int()); |
} |
|
void MemArea::slotUpdateByTimer() { |
char tstr[128]; |
if (waitingResponse_) { |
waitingResponse_ = true; |
} |
RISCV_sprintf(tstr, sizeof(tstr), "read 0x%08" RV_PRI64 "x %d", |
reqAddr_, reqBytes_); |
cmdRead_.make_string(tstr); |
|
reqAddrZ_ = reqAddr_; |
reqBytesZ_ = reqBytes_; |
igui_->registerCommand(static_cast<IGuiCmdHandler *>(this), |
&cmdRead_, true); |
} |
|
void MemArea::slotUpdateData() { |
moveCursor(QTextCursor::End); |
moveCursor(QTextCursor::Start, QTextCursor::KeepAnchor); |
QTextCursor cursor = textCursor(); |
cursor.insertText(tr(dataText_.to_string())); |
update(); |
} |
|
void MemArea::handleResponse(AttributeType *req, AttributeType *resp) { |
bool changed = false; |
waitingResponse_ = false; |
if (resp->is_nil()) { |
return; |
} |
if (resp->size() != data_.size()) { |
changed = true; |
} else { |
for (unsigned i = 0; i < resp->size(); i++) { |
if ((*resp)(i) != data_(i)) { |
changed = true; |
break; |
} |
} |
} |
if (!changed) { |
return; |
} |
|
data_ = *resp; |
to_string(reqAddrZ_, data_.size(), &dataText_); |
emit signalUpdateData(); |
} |
|
void MemArea::to_string(uint64_t addr, unsigned bytes, AttributeType *out) { |
const uint64_t MSK64 = 0x7ull; |
uint64_t addr_start, addr_end, inv_i; |
addr_start = addr & ~MSK64; |
addr_end = (addr + bytes + 7) & ~MSK64; |
|
/** Each 8 bytes of data requires 44 bytes in string [addr]: .. .. |
Let it be 64 bytes per 8 bytes of data |
*/ |
if (tmpBuf_.size() < 8 * data_.size()) { |
tmpBuf_.make_data(8 * data_.size()); |
} |
int strsz = 0; |
|
int bufsz = tmpBuf_.size(); |
char *strbuf = reinterpret_cast<char *>(tmpBuf_.data()); |
for (uint64_t i = addr_start; i < addr_end; i++) { |
if ((i & MSK64) == 0) { |
// Output address: |
strsz += RISCV_sprintf(&strbuf[strsz], bufsz - strsz, |
"[%016" RV_PRI64 "x]: ", i); |
} |
inv_i = (i & ~MSK64) | (MSK64 - (i & MSK64)); |
if ((addr <= inv_i) && (inv_i < (addr + bytes))) { |
strsz += RISCV_sprintf(&strbuf[strsz], bufsz - strsz, |
" %02x", data_(inv_i - addr)); |
} else { |
strsz += RISCV_sprintf(&strbuf[strsz], bufsz - strsz, " .."); |
} |
if ((i & MSK64) == MSK64) { |
strsz += RISCV_sprintf(&strbuf[strsz], bufsz - strsz, "\n"); |
} |
} |
out->make_string(strbuf); |
} |
|
|
} // namespace debugger |
/MemArea.h
1,57 → 1,57
/** |
* @file |
* @copyright Copyright 2016 GNSS Sensor Ltd. All right reserved. |
* @author Sergey Khabarov - sergeykhbr@gmail.com |
* @brief Memory Editor area. |
*/ |
|
#pragma once |
|
#include "api_core.h" // MUST BE BEFORE QtWidgets.h or any other Qt header. |
#include "attribute.h" |
#include "igui.h" |
#include "coreservices/isocinfo.h" |
|
#include <QtWidgets/QWidget> |
#include <QtWidgets/QPlainTextEdit> |
|
namespace debugger { |
|
class MemArea : public QPlainTextEdit, |
public IGuiCmdHandler { |
Q_OBJECT |
public: |
explicit MemArea(IGui *gui, QWidget *parent, uint64_t addr, uint64_t sz); |
virtual ~MemArea(); |
|
/** IGuiCmdHandler */ |
virtual void handleResponse(AttributeType *req, AttributeType *resp); |
|
signals: |
void signalUpdateData(); |
|
public slots: |
void slotAddressChanged(AttributeType *cmd); |
void slotUpdateByTimer(); |
void slotUpdateData(); |
|
private: |
void to_string(uint64_t addr, unsigned bytes, AttributeType *out); |
|
private: |
AttributeType cmdRead_; |
QString name_; |
IGui *igui_; |
|
AttributeType data_; |
AttributeType tmpBuf_; |
AttributeType dataText_; |
|
uint64_t reqAddr_; |
unsigned reqBytes_; |
uint64_t reqAddrZ_; |
unsigned reqBytesZ_; |
bool waitingResponse_; |
}; |
|
} // namespace debugger |
/** |
* @file |
* @copyright Copyright 2016 GNSS Sensor Ltd. All right reserved. |
* @author Sergey Khabarov - sergeykhbr@gmail.com |
* @brief Memory Editor area. |
*/ |
|
#pragma once |
|
#include "api_core.h" // MUST BE BEFORE QtWidgets.h or any other Qt header. |
#include "attribute.h" |
#include "igui.h" |
#include "coreservices/isocinfo.h" |
|
#include <QtWidgets/QWidget> |
#include <QtWidgets/QPlainTextEdit> |
|
namespace debugger { |
|
class MemArea : public QPlainTextEdit, |
public IGuiCmdHandler { |
Q_OBJECT |
public: |
explicit MemArea(IGui *gui, QWidget *parent, uint64_t addr, uint64_t sz); |
virtual ~MemArea(); |
|
/** IGuiCmdHandler */ |
virtual void handleResponse(AttributeType *req, AttributeType *resp); |
|
signals: |
void signalUpdateData(); |
|
public slots: |
void slotAddressChanged(AttributeType *cmd); |
void slotUpdateByTimer(); |
void slotUpdateData(); |
|
private: |
void to_string(uint64_t addr, unsigned bytes, AttributeType *out); |
|
private: |
AttributeType cmdRead_; |
QString name_; |
IGui *igui_; |
|
AttributeType data_; |
AttributeType tmpBuf_; |
AttributeType dataText_; |
|
uint64_t reqAddr_; |
unsigned reqBytes_; |
uint64_t reqAddrZ_; |
unsigned reqBytesZ_; |
bool waitingResponse_; |
}; |
|
} // namespace debugger |
/MemControl.cpp
1,97 → 1,97
/** |
* @file |
* @copyright Copyright 2016 GNSS Sensor Ltd. All right reserved. |
* @author Sergey Khabarov - sergeykhbr@gmail.com |
* @brief Memory Editor control panel. |
*/ |
|
#include "MemControl.h" |
#include "moc_MemControl.h" |
|
#include <memory> |
#include <string.h> |
#include <QtWidgets/QBoxLayout> |
#include <QtWidgets/QLabel> |
#include <QtWidgets/QPushButton> |
|
namespace debugger { |
|
MemControl::MemControl(QWidget *parent, uint64_t addr, uint64_t sz) |
: QWidget(parent) { |
QFont font = QFont("Courier"); |
font.setStyleHint(QFont::Monospace); |
font.setPointSize(8); |
font.setFixedPitch(true); |
setFont(font); |
QFontMetrics fm(font); |
|
paletteModified_.setColor(QPalette::Base, Qt::yellow); |
paletteModified_.setColor(QPalette::Text, Qt::black); |
|
paletteDefault_.setColor(QPalette::Text, Qt::black); |
paletteDefault_.setColor(QPalette::Base, Qt::white); |
|
|
QGridLayout *gridLayout = new QGridLayout(this); |
setLayout(gridLayout); |
|
|
QLabel *lbl = new QLabel("Addr,HEX:"); |
gridLayout->addWidget(lbl, 0, 0, Qt::AlignRight); |
|
editAddr_ = new QLineEdit(this); |
editAddr_->setText(QString("%1").arg(addr, 16, 16, QChar('0'))); |
editAddr_->setFixedWidth(8 + fm.width(editAddr_->text())); |
editAddr_->setPalette(paletteDefault_); |
gridLayout->addWidget(editAddr_, 0, 1, Qt::AlignLeft); |
|
QLabel *lbl2 = new QLabel("Size,B:"); |
gridLayout->addWidget(lbl2, 0, 2, Qt::AlignRight); |
|
editBytes_ = new QLineEdit(this); |
editBytes_->setText(QString("%1").arg(sz, 0, 10)); |
editBytes_->setFixedWidth(8 + fm.width("000000")); |
editBytes_->setPalette(paletteDefault_); |
gridLayout->addWidget(editBytes_, 0, 3, Qt::AlignLeft); |
|
QPushButton *btnUpdate = new QPushButton(tr("&Update")); |
btnUpdate->setFlat(false); |
btnUpdate->setCheckable(false); |
gridLayout->addWidget(btnUpdate, 0, 4, Qt::AlignLeft); |
gridLayout->setColumnStretch(4, 10); |
|
connect(editAddr_, SIGNAL(textChanged(const QString &)), |
this, SLOT(slotModified())); |
connect(editBytes_, SIGNAL(textChanged(const QString &)), |
this, SLOT(slotModified())); |
connect(btnUpdate, SIGNAL(released()), this, SLOT(slotUpdate())); |
|
cmd_.make_list(2); |
} |
|
void MemControl::slotModified() { |
editAddr_->setPalette(paletteModified_); |
editBytes_->setPalette(paletteModified_); |
} |
|
void MemControl::slotUpdate() { |
editAddr_->setPalette(paletteDefault_); |
editBytes_->setPalette(paletteDefault_); |
|
if (!isChanged()) { |
return; |
} |
uint64_t adr = editAddr_->text().toLongLong(0, 16); |
uint64_t sz = editBytes_->text().toLongLong(0, 10); |
cmd_[0u].make_uint64(adr); |
cmd_[1].make_uint64(sz); |
|
emit signalAddressChanged(&cmd_); |
} |
|
bool MemControl::isChanged() { |
return true; |
} |
|
|
} // namespace debugger |
/** |
* @file |
* @copyright Copyright 2016 GNSS Sensor Ltd. All right reserved. |
* @author Sergey Khabarov - sergeykhbr@gmail.com |
* @brief Memory Editor control panel. |
*/ |
|
#include "MemControl.h" |
#include "moc_MemControl.h" |
|
#include <memory> |
#include <string.h> |
#include <QtWidgets/QBoxLayout> |
#include <QtWidgets/QLabel> |
#include <QtWidgets/QPushButton> |
|
namespace debugger { |
|
MemControl::MemControl(QWidget *parent, uint64_t addr, uint64_t sz) |
: QWidget(parent) { |
QFont font = QFont("Courier"); |
font.setStyleHint(QFont::Monospace); |
font.setPointSize(8); |
font.setFixedPitch(true); |
setFont(font); |
QFontMetrics fm(font); |
|
paletteModified_.setColor(QPalette::Base, Qt::yellow); |
paletteModified_.setColor(QPalette::Text, Qt::black); |
|
paletteDefault_.setColor(QPalette::Text, Qt::black); |
paletteDefault_.setColor(QPalette::Base, Qt::white); |
|
|
QGridLayout *gridLayout = new QGridLayout(this); |
setLayout(gridLayout); |
|
|
QLabel *lbl = new QLabel("Addr,HEX:"); |
gridLayout->addWidget(lbl, 0, 0, Qt::AlignRight); |
|
editAddr_ = new QLineEdit(this); |
editAddr_->setText(QString("%1").arg(addr, 16, 16, QChar('0'))); |
editAddr_->setFixedWidth(8 + fm.width(editAddr_->text())); |
editAddr_->setPalette(paletteDefault_); |
gridLayout->addWidget(editAddr_, 0, 1, Qt::AlignLeft); |
|
QLabel *lbl2 = new QLabel("Size,B:"); |
gridLayout->addWidget(lbl2, 0, 2, Qt::AlignRight); |
|
editBytes_ = new QLineEdit(this); |
editBytes_->setText(QString("%1").arg(sz, 0, 10)); |
editBytes_->setFixedWidth(8 + fm.width("000000")); |
editBytes_->setPalette(paletteDefault_); |
gridLayout->addWidget(editBytes_, 0, 3, Qt::AlignLeft); |
|
QPushButton *btnUpdate = new QPushButton(tr("&Update")); |
btnUpdate->setFlat(false); |
btnUpdate->setCheckable(false); |
gridLayout->addWidget(btnUpdate, 0, 4, Qt::AlignLeft); |
gridLayout->setColumnStretch(4, 10); |
|
connect(editAddr_, SIGNAL(textChanged(const QString &)), |
this, SLOT(slotModified())); |
connect(editBytes_, SIGNAL(textChanged(const QString &)), |
this, SLOT(slotModified())); |
connect(btnUpdate, SIGNAL(released()), this, SLOT(slotUpdate())); |
|
cmd_.make_list(2); |
} |
|
void MemControl::slotModified() { |
editAddr_->setPalette(paletteModified_); |
editBytes_->setPalette(paletteModified_); |
} |
|
void MemControl::slotUpdate() { |
editAddr_->setPalette(paletteDefault_); |
editBytes_->setPalette(paletteDefault_); |
|
if (!isChanged()) { |
return; |
} |
uint64_t adr = editAddr_->text().toLongLong(0, 16); |
uint64_t sz = editBytes_->text().toLongLong(0, 10); |
cmd_[0u].make_uint64(adr); |
cmd_[1].make_uint64(sz); |
|
emit signalAddressChanged(&cmd_); |
} |
|
bool MemControl::isChanged() { |
return true; |
} |
|
|
} // namespace debugger |
/MemControl.h
1,43 → 1,43
/** |
* @file |
* @copyright Copyright 2016 GNSS Sensor Ltd. All right reserved. |
* @author Sergey Khabarov - sergeykhbr@gmail.com |
* @brief Memory Editor control panel. |
*/ |
|
#pragma once |
|
#include "api_core.h" // MUST BE BEFORE QtWidgets.h or any other Qt header. |
#include "attribute.h" |
#include "igui.h" |
|
#include <QtWidgets/QWidget> |
#include <QtWidgets/QLineEdit> |
|
|
namespace debugger { |
|
class MemControl : public QWidget { |
Q_OBJECT |
public: |
explicit MemControl(QWidget *parent, uint64_t addr, uint64_t sz); |
|
signals: |
void signalAddressChanged(AttributeType *cmd); |
|
public slots: |
void slotModified(); |
void slotUpdate(); |
|
private: |
bool isChanged(); |
|
private: |
QLineEdit *editAddr_; |
QLineEdit *editBytes_; |
QPalette paletteDefault_; |
QPalette paletteModified_; |
AttributeType cmd_; |
}; |
|
} // namespace debugger |
/** |
* @file |
* @copyright Copyright 2016 GNSS Sensor Ltd. All right reserved. |
* @author Sergey Khabarov - sergeykhbr@gmail.com |
* @brief Memory Editor control panel. |
*/ |
|
#pragma once |
|
#include "api_core.h" // MUST BE BEFORE QtWidgets.h or any other Qt header. |
#include "attribute.h" |
#include "igui.h" |
|
#include <QtWidgets/QWidget> |
#include <QtWidgets/QLineEdit> |
|
|
namespace debugger { |
|
class MemControl : public QWidget { |
Q_OBJECT |
public: |
explicit MemControl(QWidget *parent, uint64_t addr, uint64_t sz); |
|
signals: |
void signalAddressChanged(AttributeType *cmd); |
|
public slots: |
void slotModified(); |
void slotUpdate(); |
|
private: |
bool isChanged(); |
|
private: |
QLineEdit *editAddr_; |
QLineEdit *editBytes_; |
QPalette paletteDefault_; |
QPalette paletteModified_; |
AttributeType cmd_; |
}; |
|
} // namespace debugger |
/MemViewWidget.cpp
1,50 → 1,50
/** |
* @file |
* @copyright Copyright 2016 GNSS Sensor Ltd. All right reserved. |
* @author Sergey Khabarov - sergeykhbr@gmail.com |
* @brief Memory editor form. |
*/ |
|
#include "MemArea.h" |
#include "MemControl.h" |
#include "MemViewWidget.h" |
#include "moc_MemViewWidget.h" |
|
#include <memory> |
|
namespace debugger { |
|
MemViewWidget::MemViewWidget(IGui *igui, QWidget *parent, |
uint64_t addr, uint64_t sz) : QWidget(parent) { |
igui_ = igui; |
|
gridLayout = new QGridLayout(this); |
gridLayout->setSpacing(4); |
gridLayout->setHorizontalSpacing(10); |
gridLayout->setVerticalSpacing(0); |
gridLayout->setContentsMargins(4, 4, 4, 4); |
setLayout(gridLayout); |
|
MemControl *pctrl = new MemControl(this, addr, sz); |
|
MemArea *parea = new MemArea(igui, this, addr, sz); |
gridLayout->addWidget(pctrl , 0, 0); |
gridLayout->addWidget(parea, 1, 0); |
gridLayout->setRowStretch(1, 10); |
|
connect(this, SIGNAL(signalUpdateByTimer()), |
parea, SLOT(slotUpdateByTimer())); |
|
connect(pctrl, SIGNAL(signalAddressChanged(AttributeType *)), |
parea, SLOT(slotAddressChanged(AttributeType *))); |
} |
|
|
void MemViewWidget::slotUpdateByTimer() { |
if (!isVisible()) { |
return; |
} |
emit signalUpdateByTimer(); |
} |
|
} // namespace debugger |
/** |
* @file |
* @copyright Copyright 2016 GNSS Sensor Ltd. All right reserved. |
* @author Sergey Khabarov - sergeykhbr@gmail.com |
* @brief Memory editor form. |
*/ |
|
#include "MemArea.h" |
#include "MemControl.h" |
#include "MemViewWidget.h" |
#include "moc_MemViewWidget.h" |
|
#include <memory> |
|
namespace debugger { |
|
MemViewWidget::MemViewWidget(IGui *igui, QWidget *parent, |
uint64_t addr, uint64_t sz) : QWidget(parent) { |
igui_ = igui; |
|
gridLayout = new QGridLayout(this); |
gridLayout->setSpacing(4); |
gridLayout->setHorizontalSpacing(10); |
gridLayout->setVerticalSpacing(0); |
gridLayout->setContentsMargins(4, 4, 4, 4); |
setLayout(gridLayout); |
|
MemControl *pctrl = new MemControl(this, addr, sz); |
|
MemArea *parea = new MemArea(igui, this, addr, sz); |
gridLayout->addWidget(pctrl , 0, 0); |
gridLayout->addWidget(parea, 1, 0); |
gridLayout->setRowStretch(1, 10); |
|
connect(this, SIGNAL(signalUpdateByTimer()), |
parea, SLOT(slotUpdateByTimer())); |
|
connect(pctrl, SIGNAL(signalAddressChanged(AttributeType *)), |
parea, SLOT(slotAddressChanged(AttributeType *))); |
} |
|
|
void MemViewWidget::slotUpdateByTimer() { |
if (!isVisible()) { |
return; |
} |
emit signalUpdateByTimer(); |
} |
|
} // namespace debugger |
/MemViewWidget.h
1,78 → 1,78
/** |
* @file |
* @copyright Copyright 2016 GNSS Sensor Ltd. All right reserved. |
* @author Sergey Khabarov - sergeykhbr@gmail.com |
* @brief Memory editor form. |
*/ |
|
#pragma once |
|
#include "api_core.h" // MUST BE BEFORE QtWidgets.h or any other Qt header. |
#include "attribute.h" |
#include "igui.h" |
|
#include <QtWidgets/QMdiArea> |
#include <QtWidgets/QMdiSubWindow> |
#include <QtWidgets/QGridLayout> |
#include <QtWidgets/QAction> |
#include <QtCore/QEvent> |
|
namespace debugger { |
|
class MemViewWidget : public QWidget { |
Q_OBJECT |
public: |
MemViewWidget(IGui *igui, QWidget *parent, uint64_t addr, uint64_t sz); |
|
signals: |
void signalUpdateByTimer(); |
|
private slots: |
void slotUpdateByTimer(); |
|
private: |
AttributeType listMem_; |
QGridLayout *gridLayout; |
|
IGui *igui_; |
}; |
|
class MemQMdiSubWindow : public QMdiSubWindow { |
Q_OBJECT |
public: |
MemQMdiSubWindow(IGui *igui, QMdiArea *area, QWidget *parent, |
uint64_t addr, uint64_t sz, QAction *act = 0) |
: QMdiSubWindow(parent) { |
setAttribute(Qt::WA_DeleteOnClose); |
action_ = act; |
area_ = area; |
|
setWindowTitle(tr("Memory")); |
QWidget *pnew = new MemViewWidget(igui, this, addr, sz); |
setWindowIcon(QIcon(tr(":/images/mem_96x96.png"))); |
if (act) { |
act->setChecked(true); |
connect(parent, SIGNAL(signalUpdateByTimer()), |
pnew, SLOT(slotUpdateByTimer())); |
} |
setWidget(pnew); |
area_->addSubWindow(this); |
show(); |
} |
|
|
protected: |
void closeEvent(QCloseEvent *event_) Q_DECL_OVERRIDE { |
if (action_) { |
action_->setChecked(false); |
} |
area_->removeSubWindow(this); |
event_->accept(); |
} |
private: |
QAction *action_; |
QMdiArea *area_; |
}; |
|
|
} // namespace debugger |
/** |
* @file |
* @copyright Copyright 2016 GNSS Sensor Ltd. All right reserved. |
* @author Sergey Khabarov - sergeykhbr@gmail.com |
* @brief Memory editor form. |
*/ |
|
#pragma once |
|
#include "api_core.h" // MUST BE BEFORE QtWidgets.h or any other Qt header. |
#include "attribute.h" |
#include "igui.h" |
|
#include <QtWidgets/QMdiArea> |
#include <QtWidgets/QMdiSubWindow> |
#include <QtWidgets/QGridLayout> |
#include <QtWidgets/QAction> |
#include <QtCore/QEvent> |
|
namespace debugger { |
|
class MemViewWidget : public QWidget { |
Q_OBJECT |
public: |
MemViewWidget(IGui *igui, QWidget *parent, uint64_t addr, uint64_t sz); |
|
signals: |
void signalUpdateByTimer(); |
|
private slots: |
void slotUpdateByTimer(); |
|
private: |
AttributeType listMem_; |
QGridLayout *gridLayout; |
|
IGui *igui_; |
}; |
|
class MemQMdiSubWindow : public QMdiSubWindow { |
Q_OBJECT |
public: |
MemQMdiSubWindow(IGui *igui, QMdiArea *area, QWidget *parent, |
uint64_t addr, uint64_t sz, QAction *act = 0) |
: QMdiSubWindow(parent) { |
setAttribute(Qt::WA_DeleteOnClose); |
action_ = act; |
area_ = area; |
|
setWindowTitle(tr("Memory")); |
QWidget *pnew = new MemViewWidget(igui, this, addr, sz); |
setWindowIcon(QIcon(tr(":/images/mem_96x96.png"))); |
if (act) { |
act->setChecked(true); |
connect(parent, SIGNAL(signalUpdateByTimer()), |
pnew, SLOT(slotUpdateByTimer())); |
} |
setWidget(pnew); |
area_->addSubWindow(this); |
show(); |
} |
|
|
protected: |
void closeEvent(QCloseEvent *event_) Q_DECL_OVERRIDE { |
if (action_) { |
action_->setChecked(false); |
} |
area_->removeSubWindow(this); |
event_->accept(); |
} |
private: |
QAction *action_; |
QMdiArea *area_; |
}; |
|
|
} // namespace debugger |
/RegWidget.cpp
1,110 → 1,110
/** |
* @file |
* @copyright Copyright 2016 GNSS Sensor Ltd. All right reserved. |
* @author Sergey Khabarov - sergeykhbr@gmail.com |
* @brief CPU' register editor. |
*/ |
|
#include "RegWidget.h" |
#include "moc_RegWidget.h" |
|
#include <memory> |
#include <string.h> |
#include <QtWidgets/QBoxLayout> |
#include <QtWidgets/QLabel> |
|
namespace debugger { |
|
RegWidget::RegWidget(const char *name, QWidget *parent) |
: QWidget(parent) { |
value_ = 0; |
|
regName_.make_string(name); |
name_ = QString(name); |
while (name_.size() < 3) { |
name_ += tr(" "); |
} |
|
std::string t1 = "reg " + std::string(name); |
cmdRead_.make_string(t1.c_str()); |
|
QFont font = QFont("Courier"); |
font.setStyleHint(QFont::Monospace); |
font.setPointSize(8); |
font.setFixedPitch(true); |
setFont(font); |
QFontMetrics fm(font); |
|
QHBoxLayout *pLayout = new QHBoxLayout; |
pLayout->setContentsMargins(4, 1, 4, 1); |
setLayout(pLayout); |
|
QLabel *label = new QLabel(this); |
QSizePolicy labelSizePolicy(QSizePolicy::Preferred, |
QSizePolicy::Preferred); |
labelSizePolicy.setHorizontalStretch(0); |
labelSizePolicy.setVerticalStretch(0); |
labelSizePolicy.setHeightForWidth(label->sizePolicy().hasHeightForWidth()); |
label->setSizePolicy(labelSizePolicy); |
label->setText(name_); |
label->setAlignment(Qt::AlignRight | Qt::AlignTrailing | Qt::AlignVCenter); |
pLayout->addWidget(label); |
|
edit_ = new QLineEdit(this); |
pLayout->addWidget(edit_); |
respValue_ = value_ = 0xfeedfaceull; |
|
char tstr[64]; |
RISCV_sprintf(tstr, sizeof(tstr), "%016" RV_PRI64 "x", value_); |
QString text(tstr); |
edit_->setText(text); |
edit_->setMaxLength(19); |
edit_->setFixedWidth(fm.width(text) + 8); |
edit_->setFixedHeight(fm.height() + 2); |
|
setMinimumWidth(edit_->width() + fm.width(name_) + 16); |
setMinimumHeight(edit_->height()); |
|
connect(edit_, SIGNAL(editingFinished()), |
this, SLOT(slotEditingFinished())); |
} |
|
void RegWidget::slotHandleResponse(AttributeType *resp) { |
if (!resp->is_dict()) { |
return; |
} |
if (!resp->has_key(regName_.to_string())) { |
return; |
} |
respValue_ = (*resp)[regName_.to_string()].to_uint64(); |
if (value_ != respValue_) { |
char tstr[64]; |
value_ = respValue_; |
RISCV_sprintf(tstr, sizeof(tstr), "%016" RV_PRI64 "x", value_); |
QString text(tr(tstr)); |
edit_->setText(text); |
} |
} |
|
void RegWidget::slotEditingFinished() { |
wchar_t wcsConv[128]; |
char mbsConv[128]; |
int sz = edit_->text().toWCharArray(wcsConv); |
uint64_t new_val; |
wcstombs(mbsConv, wcsConv, sz); |
mbsConv[sz] = '\0'; |
|
new_val = strtoull(mbsConv, 0, 16); |
|
if (new_val != value_) { |
char tstr[128]; |
RISCV_sprintf(tstr, sizeof(tstr), "reg %s 0x%s", |
regName_.to_string(), mbsConv); |
cmdWrite_.make_string(tstr); |
|
emit signalChanged(&cmdWrite_); |
setFocus(); |
} |
} |
|
} // namespace debugger |
/** |
* @file |
* @copyright Copyright 2016 GNSS Sensor Ltd. All right reserved. |
* @author Sergey Khabarov - sergeykhbr@gmail.com |
* @brief CPU' register editor. |
*/ |
|
#include "RegWidget.h" |
#include "moc_RegWidget.h" |
|
#include <memory> |
#include <string.h> |
#include <QtWidgets/QBoxLayout> |
#include <QtWidgets/QLabel> |
|
namespace debugger { |
|
RegWidget::RegWidget(const char *name, QWidget *parent) |
: QWidget(parent) { |
value_ = 0; |
|
regName_.make_string(name); |
name_ = QString(name); |
while (name_.size() < 3) { |
name_ += tr(" "); |
} |
|
std::string t1 = "reg " + std::string(name); |
cmdRead_.make_string(t1.c_str()); |
|
QFont font = QFont("Courier"); |
font.setStyleHint(QFont::Monospace); |
font.setPointSize(8); |
font.setFixedPitch(true); |
setFont(font); |
QFontMetrics fm(font); |
|
QHBoxLayout *pLayout = new QHBoxLayout; |
pLayout->setContentsMargins(4, 1, 4, 1); |
setLayout(pLayout); |
|
QLabel *label = new QLabel(this); |
QSizePolicy labelSizePolicy(QSizePolicy::Preferred, |
QSizePolicy::Preferred); |
labelSizePolicy.setHorizontalStretch(0); |
labelSizePolicy.setVerticalStretch(0); |
labelSizePolicy.setHeightForWidth(label->sizePolicy().hasHeightForWidth()); |
label->setSizePolicy(labelSizePolicy); |
label->setText(name_); |
label->setAlignment(Qt::AlignRight | Qt::AlignTrailing | Qt::AlignVCenter); |
pLayout->addWidget(label); |
|
edit_ = new QLineEdit(this); |
pLayout->addWidget(edit_); |
respValue_ = value_ = 0xfeedfaceull; |
|
char tstr[64]; |
RISCV_sprintf(tstr, sizeof(tstr), "%016" RV_PRI64 "x", value_); |
QString text(tstr); |
edit_->setText(text); |
edit_->setMaxLength(19); |
edit_->setFixedWidth(fm.width(text) + 8); |
edit_->setFixedHeight(fm.height() + 2); |
|
setMinimumWidth(edit_->width() + fm.width(name_) + 16); |
setMinimumHeight(edit_->height()); |
|
connect(edit_, SIGNAL(editingFinished()), |
this, SLOT(slotEditingFinished())); |
} |
|
void RegWidget::slotHandleResponse(AttributeType *resp) { |
if (!resp->is_dict()) { |
return; |
} |
if (!resp->has_key(regName_.to_string())) { |
return; |
} |
respValue_ = (*resp)[regName_.to_string()].to_uint64(); |
if (value_ != respValue_) { |
char tstr[64]; |
value_ = respValue_; |
RISCV_sprintf(tstr, sizeof(tstr), "%016" RV_PRI64 "x", value_); |
QString text(tr(tstr)); |
edit_->setText(text); |
} |
} |
|
void RegWidget::slotEditingFinished() { |
wchar_t wcsConv[128]; |
char mbsConv[128]; |
int sz = edit_->text().toWCharArray(wcsConv); |
uint64_t new_val; |
wcstombs(mbsConv, wcsConv, sz); |
mbsConv[sz] = '\0'; |
|
new_val = strtoull(mbsConv, 0, 16); |
|
if (new_val != value_) { |
char tstr[128]; |
RISCV_sprintf(tstr, sizeof(tstr), "reg %s 0x%s", |
regName_.to_string(), mbsConv); |
cmdWrite_.make_string(tstr); |
|
emit signalChanged(&cmdWrite_); |
setFocus(); |
} |
} |
|
} // namespace debugger |
/RegWidget.h
1,39 → 1,39
/** |
* @file |
* @copyright Copyright 2016 GNSS Sensor Ltd. All right reserved. |
* @author Sergey Khabarov - sergeykhbr@gmail.com |
* @brief CPU' register editor. |
*/ |
|
#pragma once |
|
#include "api_core.h" // MUST BE BEFORE QtWidgets.h or any other Qt header. |
#include "attribute.h" |
|
#include <QtWidgets/QWidget> |
#include <QtWidgets/QLineEdit> |
|
namespace debugger { |
|
class RegWidget : public QWidget { |
Q_OBJECT |
public: |
explicit RegWidget(const char *name, QWidget *parent); |
|
signals: |
void signalChanged(AttributeType *req); |
private slots: |
void slotHandleResponse(AttributeType *resp); |
void slotEditingFinished(); |
|
private: |
AttributeType regName_; |
AttributeType cmdRead_; |
AttributeType cmdWrite_; |
QString name_; |
QLineEdit *edit_; |
uint64_t value_; |
uint64_t respValue_; |
}; |
|
} // namespace debugger |
/** |
* @file |
* @copyright Copyright 2016 GNSS Sensor Ltd. All right reserved. |
* @author Sergey Khabarov - sergeykhbr@gmail.com |
* @brief CPU' register editor. |
*/ |
|
#pragma once |
|
#include "api_core.h" // MUST BE BEFORE QtWidgets.h or any other Qt header. |
#include "attribute.h" |
|
#include <QtWidgets/QWidget> |
#include <QtWidgets/QLineEdit> |
|
namespace debugger { |
|
class RegWidget : public QWidget { |
Q_OBJECT |
public: |
explicit RegWidget(const char *name, QWidget *parent); |
|
signals: |
void signalChanged(AttributeType *req); |
private slots: |
void slotHandleResponse(AttributeType *resp); |
void slotEditingFinished(); |
|
private: |
AttributeType regName_; |
AttributeType cmdRead_; |
AttributeType cmdWrite_; |
QString name_; |
QLineEdit *edit_; |
uint64_t value_; |
uint64_t respValue_; |
}; |
|
} // namespace debugger |
/RegsViewWidget.cpp
1,97 → 1,97
/** |
* @file |
* @copyright Copyright 2016 GNSS Sensor Ltd. All right reserved. |
* @author Sergey Khabarov - sergeykhbr@gmail.com |
* @brief Single CPU register form. |
*/ |
|
#include "RegWidget.h" |
#include "RegsViewWidget.h" |
#include "moc_RegsViewWidget.h" |
|
#include <memory> |
|
namespace debugger { |
|
/** Layout of register by name */ |
static const char *REG_NAMES_LAYOUT[] = { |
"ra", "s0", "a0", |
"sp", "s1", "a1", |
"gp", "s2", "a2", |
"tp", "s3", "a3", |
"" , "s4", "a4", |
"t0", "s5", "a5", |
"t1", "s6", "a6", |
"t2", "s7", "a7", |
"t3", "s8", "", |
"t4", "s9", "", |
"t5", "s10", "pc", |
"t6", "s11", "npc", |
"break" |
}; |
|
RegsViewWidget::RegsViewWidget(IGui *igui, QWidget *parent) |
: QWidget(parent) { |
igui_ = igui; |
|
gridLayout = new QGridLayout(this); |
gridLayout->setSpacing(4); |
gridLayout->setHorizontalSpacing(10); |
gridLayout->setVerticalSpacing(0); |
gridLayout->setContentsMargins(4, 4, 4, 4); |
setLayout(gridLayout); |
cmdRegs_.make_string("regs"); |
waitingResp_ = false; |
|
int n = 0; |
while (strcmp(REG_NAMES_LAYOUT[n], "break")) { |
if (REG_NAMES_LAYOUT[n][0] == '\0') { |
n++; |
continue; |
} |
addRegWidget(n, REG_NAMES_LAYOUT[n]); |
n++; |
} |
} |
|
RegsViewWidget::~RegsViewWidget() { |
igui_->removeFromQueue(static_cast<IGuiCmdHandler *>(this)); |
} |
|
void RegsViewWidget::handleResponse(AttributeType *req, AttributeType *resp) { |
resp_ = *resp; |
emit signalHandleResponse(&resp_); |
waitingResp_ = false; |
} |
|
void RegsViewWidget::slotUpdateByTimer() { |
if (!isVisible()) { |
return; |
} |
if (waitingResp_) { |
return; |
} |
igui_->registerCommand(static_cast<IGuiCmdHandler *>(this), |
&cmdRegs_, true); |
waitingResp_ = true; |
} |
|
void RegsViewWidget::slotRegChanged(AttributeType *wrcmd) { |
igui_->registerCommand(0, wrcmd, true); |
} |
|
void RegsViewWidget::addRegWidget(int idx, const char *name) { |
int line = idx / 3; |
int col = idx - 3 * line; |
|
QWidget *pnew = new RegWidget(name, this); |
gridLayout->addWidget(pnew, line + 1, col); |
|
connect(this, SIGNAL(signalHandleResponse(AttributeType *)), |
pnew, SLOT(slotHandleResponse(AttributeType *))); |
|
connect(pnew, SIGNAL(signalChanged(AttributeType *)), |
this, SLOT(slotRegChanged(AttributeType *))); |
} |
|
} // namespace debugger |
/** |
* @file |
* @copyright Copyright 2016 GNSS Sensor Ltd. All right reserved. |
* @author Sergey Khabarov - sergeykhbr@gmail.com |
* @brief Single CPU register form. |
*/ |
|
#include "RegWidget.h" |
#include "RegsViewWidget.h" |
#include "moc_RegsViewWidget.h" |
|
#include <memory> |
|
namespace debugger { |
|
/** Layout of register by name */ |
static const char *REG_NAMES_LAYOUT[] = { |
"ra", "s0", "a0", |
"sp", "s1", "a1", |
"gp", "s2", "a2", |
"tp", "s3", "a3", |
"" , "s4", "a4", |
"t0", "s5", "a5", |
"t1", "s6", "a6", |
"t2", "s7", "a7", |
"t3", "s8", "", |
"t4", "s9", "", |
"t5", "s10", "pc", |
"t6", "s11", "npc", |
"break" |
}; |
|
RegsViewWidget::RegsViewWidget(IGui *igui, QWidget *parent) |
: QWidget(parent) { |
igui_ = igui; |
|
gridLayout = new QGridLayout(this); |
gridLayout->setSpacing(4); |
gridLayout->setHorizontalSpacing(10); |
gridLayout->setVerticalSpacing(0); |
gridLayout->setContentsMargins(4, 4, 4, 4); |
setLayout(gridLayout); |
cmdRegs_.make_string("regs"); |
waitingResp_ = false; |
|
int n = 0; |
while (strcmp(REG_NAMES_LAYOUT[n], "break")) { |
if (REG_NAMES_LAYOUT[n][0] == '\0') { |
n++; |
continue; |
} |
addRegWidget(n, REG_NAMES_LAYOUT[n]); |
n++; |
} |
} |
|
RegsViewWidget::~RegsViewWidget() { |
igui_->removeFromQueue(static_cast<IGuiCmdHandler *>(this)); |
} |
|
void RegsViewWidget::handleResponse(AttributeType *req, AttributeType *resp) { |
resp_ = *resp; |
emit signalHandleResponse(&resp_); |
waitingResp_ = false; |
} |
|
void RegsViewWidget::slotUpdateByTimer() { |
if (!isVisible()) { |
return; |
} |
if (waitingResp_) { |
return; |
} |
igui_->registerCommand(static_cast<IGuiCmdHandler *>(this), |
&cmdRegs_, true); |
waitingResp_ = true; |
} |
|
void RegsViewWidget::slotRegChanged(AttributeType *wrcmd) { |
igui_->registerCommand(0, wrcmd, true); |
} |
|
void RegsViewWidget::addRegWidget(int idx, const char *name) { |
int line = idx / 3; |
int col = idx - 3 * line; |
|
QWidget *pnew = new RegWidget(name, this); |
gridLayout->addWidget(pnew, line + 1, col); |
|
connect(this, SIGNAL(signalHandleResponse(AttributeType *)), |
pnew, SLOT(slotHandleResponse(AttributeType *))); |
|
connect(pnew, SIGNAL(signalChanged(AttributeType *)), |
this, SLOT(slotRegChanged(AttributeType *))); |
} |
|
} // namespace debugger |
/RegsViewWidget.h
1,91 → 1,91
/** |
* @file |
* @copyright Copyright 2016 GNSS Sensor Ltd. All right reserved. |
* @author Sergey Khabarov - sergeykhbr@gmail.com |
* @brief Single CPU register form. |
*/ |
|
#pragma once |
|
#include "api_core.h" // MUST BE BEFORE QtWidgets.h or any other Qt header. |
#include "attribute.h" |
#include "igui.h" |
|
#include <QtWidgets/QWidget> |
#include <QtWidgets/QMdiArea> |
#include <QtWidgets/QMdiSubWindow> |
#include <QtWidgets/QGridLayout> |
#include <QtWidgets/QAction> |
#include <QtCore/QEvent> |
#include <QtGui/qevent.h> |
|
namespace debugger { |
|
class RegsViewWidget : public QWidget, |
public IGuiCmdHandler { |
Q_OBJECT |
public: |
RegsViewWidget(IGui *igui, QWidget *parent = 0); |
virtual ~RegsViewWidget(); |
|
/** IGuiCmdHandler */ |
virtual void handleResponse(AttributeType *req, AttributeType *resp); |
|
signals: |
void signalHandleResponse(AttributeType *resp); |
|
private slots: |
void slotUpdateByTimer(); |
void slotRegChanged(AttributeType *wrcmd); |
|
private: |
void addRegWidget(int idx, const char *name); |
|
private: |
AttributeType cmdRegs_; |
AttributeType listRegs_; |
AttributeType resp_; |
QGridLayout *gridLayout; |
|
IGui *igui_; |
bool waitingResp_; |
}; |
|
class RegsQMdiSubWindow : public QMdiSubWindow { |
Q_OBJECT |
public: |
RegsQMdiSubWindow(IGui *igui, QMdiArea *area, QWidget *parent, |
QAction *act = 0) |
: QMdiSubWindow(parent) { |
setAttribute(Qt::WA_DeleteOnClose); |
action_ = act; |
area_ = area; |
|
setWindowTitle(tr("Registers")); |
setWindowIcon(QIcon(tr(":/images/cpu_96x96.png"))); |
QWidget *pnew = new RegsViewWidget(igui, this); |
if (act) { |
act->setChecked(true); |
} |
connect(parent, SIGNAL(signalUpdateByTimer()), |
pnew, SLOT(slotUpdateByTimer())); |
|
setWidget(pnew); |
area_->addSubWindow(this); |
show(); |
} |
|
protected: |
void closeEvent(QCloseEvent *event_) Q_DECL_OVERRIDE { |
if (action_) { |
action_->setChecked(false); |
} |
area_->removeSubWindow(this); |
event_->accept(); |
} |
private: |
QAction *action_; |
QMdiArea *area_; |
}; |
|
} // namespace debugger |
/** |
* @file |
* @copyright Copyright 2016 GNSS Sensor Ltd. All right reserved. |
* @author Sergey Khabarov - sergeykhbr@gmail.com |
* @brief Single CPU register form. |
*/ |
|
#pragma once |
|
#include "api_core.h" // MUST BE BEFORE QtWidgets.h or any other Qt header. |
#include "attribute.h" |
#include "igui.h" |
|
#include <QtWidgets/QWidget> |
#include <QtWidgets/QMdiArea> |
#include <QtWidgets/QMdiSubWindow> |
#include <QtWidgets/QGridLayout> |
#include <QtWidgets/QAction> |
#include <QtCore/QEvent> |
#include <QtGui/qevent.h> |
|
namespace debugger { |
|
class RegsViewWidget : public QWidget, |
public IGuiCmdHandler { |
Q_OBJECT |
public: |
RegsViewWidget(IGui *igui, QWidget *parent = 0); |
virtual ~RegsViewWidget(); |
|
/** IGuiCmdHandler */ |
virtual void handleResponse(AttributeType *req, AttributeType *resp); |
|
signals: |
void signalHandleResponse(AttributeType *resp); |
|
private slots: |
void slotUpdateByTimer(); |
void slotRegChanged(AttributeType *wrcmd); |
|
private: |
void addRegWidget(int idx, const char *name); |
|
private: |
AttributeType cmdRegs_; |
AttributeType listRegs_; |
AttributeType resp_; |
QGridLayout *gridLayout; |
|
IGui *igui_; |
bool waitingResp_; |
}; |
|
class RegsQMdiSubWindow : public QMdiSubWindow { |
Q_OBJECT |
public: |
RegsQMdiSubWindow(IGui *igui, QMdiArea *area, QWidget *parent, |
QAction *act = 0) |
: QMdiSubWindow(parent) { |
setAttribute(Qt::WA_DeleteOnClose); |
action_ = act; |
area_ = area; |
|
setWindowTitle(tr("Registers")); |
setWindowIcon(QIcon(tr(":/images/cpu_96x96.png"))); |
QWidget *pnew = new RegsViewWidget(igui, this); |
if (act) { |
act->setChecked(true); |
} |
connect(parent, SIGNAL(signalUpdateByTimer()), |
pnew, SLOT(slotUpdateByTimer())); |
|
setWidget(pnew); |
area_->addSubWindow(this); |
show(); |
} |
|
protected: |
void closeEvent(QCloseEvent *event_) Q_DECL_OVERRIDE { |
if (action_) { |
action_->setChecked(false); |
} |
area_->removeSubWindow(this); |
event_->accept(); |
} |
private: |
QAction *action_; |
QMdiArea *area_; |
}; |
|
} // namespace debugger |
/StackTraceArea.cpp
1,177 → 1,177
/** |
* @file |
* @copyright Copyright 2017 GNSS Sensor Ltd. All right reserved. |
* @author Sergey Khabarov - sergeykhbr@gmail.com |
* @brief Stack Trace main area. |
*/ |
|
/** |
* @file |
* @copyright Copyright 2017 GNSS Sensor Ltd. All right reserved. |
* @author Sergey Khabarov - sergeykhbr@gmail.com |
* @brief Stack Trace main area. |
*/ |
|
#include "coreservices/ielfreader.h" |
#include "StackTraceArea.h" |
#include "moc_StackTraceArea.h" |
|
#include <memory> |
#include <string.h> |
#include <QtWidgets/QBoxLayout> |
#include <QtWidgets/QLabel> |
#include <QtWidgets/QHeaderView> |
#include <QtWidgets/QScrollBar> |
|
namespace debugger { |
|
StackTraceArea::StackTraceArea(IGui *gui, QWidget *parent) |
: QTableWidget(parent) { |
igui_ = gui; |
|
clear(); |
QFont font("Courier"); |
font.setStyleHint(QFont::Monospace); |
font.setPointSize(8); |
font.setFixedPitch(true); |
setFont(font); |
setContentsMargins(QMargins(0, 0, 0, 0)); |
QFontMetrics fm(font); |
setMinimumWidth(50 + fm.width(tr( |
"0x0001040 (some_symbol_name+0x40) 0x0001040 (some_symbol_name+0x40)"))); |
lineHeight_ = fm.height() + 4; |
hideLineIdx_ = 0; |
symbolList_.make_nil(); |
|
setColumnCount(COL_Total); |
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); |
setListSize(1); |
|
verticalHeader()->setVisible(false); // remove row indexes |
setShowGrid(false); // remove borders |
setSelectionMode(QAbstractItemView::SingleSelection); |
setSelectionBehavior(QAbstractItemView::SelectRows); //select full row |
|
// change selected row color |
QPalette *palette = new QPalette(); |
palette->setColor(QPalette::Highlight, Qt::gray); |
setPalette(*palette); |
|
setHorizontalHeaderLabels( |
QString("call;at address").split(";")); |
setColumnWidth(COL_at_addr, |
10 + fm.width(tr("0x0001040 (some_symbol_name+0x40)"))); |
setColumnWidth(COL_call_addr, |
10 + fm.width(tr("0x0001040 (some_symbol_name+0x40)"))); |
|
connect(this, SIGNAL(signalHandleResponse()), |
this, SLOT(slotHandleResponse())); |
|
connect(this, SIGNAL(cellDoubleClicked(int, int)), |
this, SLOT(slotCellDoubleClicked(int, int))); |
} |
|
StackTraceArea::~StackTraceArea() { |
igui_->removeFromQueue(static_cast<IGuiCmdHandler *>(this)); |
} |
|
void StackTraceArea::slotUpdateByTimer() { |
AttributeType cmdStack("stack"); |
igui_->registerCommand(static_cast<IGuiCmdHandler *>(this), |
&cmdStack, true); |
} |
|
void StackTraceArea::setListSize(int sz) { |
if (sz > rowCount()) { |
for (int i = hideLineIdx_; i < rowCount(); i++) { |
showRow(i); |
} |
hideLineIdx_ = sz; |
|
Qt::ItemFlags fl; |
int rowcnt_cur = rowCount(); |
setRowCount(sz); |
for (int i = rowcnt_cur; i < rowCount(); i++) { |
for (int n = 0; n < COL_Total; n++) { |
setItem(i, n, new QTableWidgetItem()); |
fl = item(i, n)->flags(); |
fl &= ~Qt::ItemIsEditable; |
//fl &= ~Qt::ItemIsSelectable; |
item(i, n)->setFlags(fl); |
} |
setRowHeight(i, lineHeight_); |
} |
} else { |
for (int i = hideLineIdx_; i < sz; i++) { |
showRow(i); |
} |
hideLineIdx_ = sz; |
for (int i = sz; i < rowCount(); i++) { |
hideRow(i); |
} |
} |
} |
|
void StackTraceArea::handleResponse(AttributeType *req, |
AttributeType *resp) { |
if (strstr(req->to_string(), "stack") == 0) { |
return; |
} |
if (!symbolList_.is_nil()) { |
return; |
} |
symbolList_ = *resp; |
emit signalHandleResponse(); |
} |
|
void StackTraceArea::slotHandleResponse() { |
if (!symbolList_.is_list()) { |
return; |
} |
QTableWidgetItem *pw; |
uint64_t addr; |
int list_sz = static_cast<int>(symbolList_.size()); |
setListSize(list_sz); |
symbolAddr_.make_list(list_sz); |
|
for (int i = 0; i < list_sz; i++) { |
AttributeType &symb = symbolList_[i]; |
AttributeType &saddr = symbolAddr_[i]; |
saddr.make_list(2); |
|
// [from, ['symb_name',symb_offset], to, ['symb_name',symb_offset]] |
addr = symb[2].to_uint64(); |
saddr[COL_call_addr].make_uint64(addr); |
pw = item(i, COL_call_addr); |
pw->setText(makeSymbolQString(addr, symb[3])); |
|
addr = symb[0u].to_uint64(); |
saddr[COL_at_addr].make_uint64(addr); |
pw = item(i, COL_at_addr); |
pw->setText(makeSymbolQString(addr, symb[1])); |
} |
symbolList_.make_nil(); |
} |
|
QString StackTraceArea::makeSymbolQString(uint64_t addr, AttributeType &info) { |
QString ret = QString("%1 ").arg(addr, 8, 16, QChar('0')); |
if (!info.is_list() || info.size() != 2) { |
return ret; |
} |
if (!info[0u].is_string() || info[0u].size() == 0) { |
return ret; |
} |
ret += "("; |
ret += QString(tr(info[0u].to_string())); |
uint64_t offset = info[1].to_uint64(); |
if (offset) { |
ret += QString("+%1h").arg(offset, 0, 16); |
} |
ret += ")"; |
return ret; |
} |
|
void StackTraceArea::slotCellDoubleClicked(int row, int column) { |
uint64_t addr; |
if (row >= static_cast<int>(symbolAddr_.size())) { |
return; |
} |
addr = symbolAddr_[row][column].to_uint64(); |
|
emit signalShowFunction(addr, 0); |
} |
|
} // namespace debugger |
#include "StackTraceArea.h" |
#include "moc_StackTraceArea.h" |
|
#include <memory> |
#include <string.h> |
#include <QtWidgets/QBoxLayout> |
#include <QtWidgets/QLabel> |
#include <QtWidgets/QHeaderView> |
#include <QtWidgets/QScrollBar> |
|
namespace debugger { |
|
StackTraceArea::StackTraceArea(IGui *gui, QWidget *parent) |
: QTableWidget(parent) { |
igui_ = gui; |
|
clear(); |
QFont font("Courier"); |
font.setStyleHint(QFont::Monospace); |
font.setPointSize(8); |
font.setFixedPitch(true); |
setFont(font); |
setContentsMargins(QMargins(0, 0, 0, 0)); |
QFontMetrics fm(font); |
setMinimumWidth(50 + fm.width(tr( |
"0x0001040 (some_symbol_name+0x40) 0x0001040 (some_symbol_name+0x40)"))); |
lineHeight_ = fm.height() + 4; |
hideLineIdx_ = 0; |
symbolList_.make_nil(); |
|
setColumnCount(COL_Total); |
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); |
setListSize(1); |
|
verticalHeader()->setVisible(false); // remove row indexes |
setShowGrid(false); // remove borders |
setSelectionMode(QAbstractItemView::SingleSelection); |
setSelectionBehavior(QAbstractItemView::SelectRows); //select full row |
|
// change selected row color |
QPalette *palette = new QPalette(); |
palette->setColor(QPalette::Highlight, Qt::gray); |
setPalette(*palette); |
|
setHorizontalHeaderLabels( |
QString("call;at address").split(";")); |
setColumnWidth(COL_at_addr, |
10 + fm.width(tr("0x0001040 (some_symbol_name+0x40)"))); |
setColumnWidth(COL_call_addr, |
10 + fm.width(tr("0x0001040 (some_symbol_name+0x40)"))); |
|
connect(this, SIGNAL(signalHandleResponse()), |
this, SLOT(slotHandleResponse())); |
|
connect(this, SIGNAL(cellDoubleClicked(int, int)), |
this, SLOT(slotCellDoubleClicked(int, int))); |
} |
|
StackTraceArea::~StackTraceArea() { |
igui_->removeFromQueue(static_cast<IGuiCmdHandler *>(this)); |
} |
|
void StackTraceArea::slotUpdateByTimer() { |
AttributeType cmdStack("stack"); |
igui_->registerCommand(static_cast<IGuiCmdHandler *>(this), |
&cmdStack, true); |
} |
|
void StackTraceArea::setListSize(int sz) { |
if (sz > rowCount()) { |
for (int i = hideLineIdx_; i < rowCount(); i++) { |
showRow(i); |
} |
hideLineIdx_ = sz; |
|
Qt::ItemFlags fl; |
int rowcnt_cur = rowCount(); |
setRowCount(sz); |
for (int i = rowcnt_cur; i < rowCount(); i++) { |
for (int n = 0; n < COL_Total; n++) { |
setItem(i, n, new QTableWidgetItem()); |
fl = item(i, n)->flags(); |
fl &= ~Qt::ItemIsEditable; |
//fl &= ~Qt::ItemIsSelectable; |
item(i, n)->setFlags(fl); |
} |
setRowHeight(i, lineHeight_); |
} |
} else { |
for (int i = hideLineIdx_; i < sz; i++) { |
showRow(i); |
} |
hideLineIdx_ = sz; |
for (int i = sz; i < rowCount(); i++) { |
hideRow(i); |
} |
} |
} |
|
void StackTraceArea::handleResponse(AttributeType *req, |
AttributeType *resp) { |
if (strstr(req->to_string(), "stack") == 0) { |
return; |
} |
if (!symbolList_.is_nil()) { |
return; |
} |
symbolList_ = *resp; |
emit signalHandleResponse(); |
} |
|
void StackTraceArea::slotHandleResponse() { |
if (!symbolList_.is_list()) { |
return; |
} |
QTableWidgetItem *pw; |
uint64_t addr; |
int list_sz = static_cast<int>(symbolList_.size()); |
setListSize(list_sz); |
symbolAddr_.make_list(list_sz); |
|
for (int i = 0; i < list_sz; i++) { |
AttributeType &symb = symbolList_[i]; |
AttributeType &saddr = symbolAddr_[i]; |
saddr.make_list(2); |
|
// [from, ['symb_name',symb_offset], to, ['symb_name',symb_offset]] |
addr = symb[2].to_uint64(); |
saddr[COL_call_addr].make_uint64(addr); |
pw = item(i, COL_call_addr); |
pw->setText(makeSymbolQString(addr, symb[3])); |
|
addr = symb[0u].to_uint64(); |
saddr[COL_at_addr].make_uint64(addr); |
pw = item(i, COL_at_addr); |
pw->setText(makeSymbolQString(addr, symb[1])); |
} |
symbolList_.make_nil(); |
} |
|
QString StackTraceArea::makeSymbolQString(uint64_t addr, AttributeType &info) { |
QString ret = QString("%1 ").arg(addr, 8, 16, QChar('0')); |
if (!info.is_list() || info.size() != 2) { |
return ret; |
} |
if (!info[0u].is_string() || info[0u].size() == 0) { |
return ret; |
} |
ret += "("; |
ret += QString(tr(info[0u].to_string())); |
uint64_t offset = info[1].to_uint64(); |
if (offset) { |
ret += QString("+%1h").arg(offset, 0, 16); |
} |
ret += ")"; |
return ret; |
} |
|
void StackTraceArea::slotCellDoubleClicked(int row, int column) { |
uint64_t addr; |
if (row >= static_cast<int>(symbolAddr_.size())) { |
return; |
} |
addr = symbolAddr_[row][column].to_uint64(); |
|
emit signalShowFunction(addr, 0); |
} |
|
} // namespace debugger |
/StackTraceArea.h
1,59 → 1,59
/** |
* @file |
* @copyright Copyright 2017 GNSS Sensor Ltd. All right reserved. |
* @author Sergey Khabarov - sergeykhbr@gmail.com |
* @brief Stack Trace main area. |
*/ |
|
#pragma once |
|
#include "api_core.h" // MUST BE BEFORE QtWidgets.h or any other Qt header. |
#include "attribute.h" |
#include "igui.h" |
#include "iservice.h" |
#include "coreservices/isocinfo.h" |
#include "coreservices/isrccode.h" |
|
#include <QtWidgets/QWidget> |
#include <QtWidgets/QTableWidget> |
|
namespace debugger { |
|
class StackTraceArea : public QTableWidget, |
public IGuiCmdHandler { |
Q_OBJECT |
public: |
explicit StackTraceArea(IGui *gui, QWidget *parent); |
virtual ~StackTraceArea(); |
|
/** IGuiCmdHandler */ |
virtual void handleResponse(AttributeType *req, AttributeType *resp); |
|
public slots: |
void slotUpdateByTimer(); |
void slotHandleResponse(); |
void slotCellDoubleClicked(int row, int column); |
|
signals: |
void signalHandleResponse(); |
void signalShowFunction(uint64_t addr, uint64_t sz); |
|
private: |
void setListSize(int sz); |
QString makeSymbolQString(uint64_t addr, AttributeType &info); |
|
private: |
enum EColumnNames { |
COL_call_addr, |
COL_at_addr, |
COL_Total |
}; |
|
AttributeType symbolList_; |
AttributeType symbolAddr_; |
IGui *igui_; |
int lineHeight_; |
int hideLineIdx_; |
}; |
|
} // namespace debugger |
/** |
* @file |
* @copyright Copyright 2017 GNSS Sensor Ltd. All right reserved. |
* @author Sergey Khabarov - sergeykhbr@gmail.com |
* @brief Stack Trace main area. |
*/ |
|
#pragma once |
|
#include "api_core.h" // MUST BE BEFORE QtWidgets.h or any other Qt header. |
#include "attribute.h" |
#include "igui.h" |
#include "iservice.h" |
#include "coreservices/isocinfo.h" |
#include "coreservices/isrccode.h" |
|
#include <QtWidgets/QWidget> |
#include <QtWidgets/QTableWidget> |
|
namespace debugger { |
|
class StackTraceArea : public QTableWidget, |
public IGuiCmdHandler { |
Q_OBJECT |
public: |
explicit StackTraceArea(IGui *gui, QWidget *parent); |
virtual ~StackTraceArea(); |
|
/** IGuiCmdHandler */ |
virtual void handleResponse(AttributeType *req, AttributeType *resp); |
|
public slots: |
void slotUpdateByTimer(); |
void slotHandleResponse(); |
void slotCellDoubleClicked(int row, int column); |
|
signals: |
void signalHandleResponse(); |
void signalShowFunction(uint64_t addr, uint64_t sz); |
|
private: |
void setListSize(int sz); |
QString makeSymbolQString(uint64_t addr, AttributeType &info); |
|
private: |
enum EColumnNames { |
COL_call_addr, |
COL_at_addr, |
COL_Total |
}; |
|
AttributeType symbolList_; |
AttributeType symbolAddr_; |
IGui *igui_; |
int lineHeight_; |
int hideLineIdx_; |
}; |
|
} // namespace debugger |
/StackTraceWidget.cpp
1,38 → 1,38
/** |
* @file |
* @copyright Copyright 2017 GNSS Sensor Ltd. All right reserved. |
* @author Sergey Khabarov - sergeykhbr@gmail.com |
* @brief Stack trace viewer form. |
*/ |
|
#include "StackTraceArea.h" |
#include "StackTraceWidget.h" |
#include "moc_StackTraceWidget.h" |
|
#include <memory> |
|
namespace debugger { |
|
StackTraceWidget::StackTraceWidget(IGui *igui, QWidget *parent) |
: QWidget(parent) { |
igui_ = igui; |
|
gridLayout = new QGridLayout(this); |
gridLayout->setSpacing(4); |
gridLayout->setHorizontalSpacing(10); |
gridLayout->setVerticalSpacing(0); |
gridLayout->setContentsMargins(4, 4, 4, 4); |
setLayout(gridLayout); |
|
StackTraceArea *parea = new StackTraceArea(igui, this); |
gridLayout->addWidget(parea, 0, 0); |
gridLayout->setRowStretch(0, 10); |
|
connect(this, SIGNAL(signalUpdateByTimer()), |
parea, SLOT(slotUpdateByTimer())); |
|
connect(parea, SIGNAL(signalShowFunction(uint64_t, uint64_t)), |
this, SLOT(slotShowFunction(uint64_t, uint64_t))); |
} |
|
} // namespace debugger |
/** |
* @file |
* @copyright Copyright 2017 GNSS Sensor Ltd. All right reserved. |
* @author Sergey Khabarov - sergeykhbr@gmail.com |
* @brief Stack trace viewer form. |
*/ |
|
#include "StackTraceArea.h" |
#include "StackTraceWidget.h" |
#include "moc_StackTraceWidget.h" |
|
#include <memory> |
|
namespace debugger { |
|
StackTraceWidget::StackTraceWidget(IGui *igui, QWidget *parent) |
: QWidget(parent) { |
igui_ = igui; |
|
gridLayout = new QGridLayout(this); |
gridLayout->setSpacing(4); |
gridLayout->setHorizontalSpacing(10); |
gridLayout->setVerticalSpacing(0); |
gridLayout->setContentsMargins(4, 4, 4, 4); |
setLayout(gridLayout); |
|
StackTraceArea *parea = new StackTraceArea(igui, this); |
gridLayout->addWidget(parea, 0, 0); |
gridLayout->setRowStretch(0, 10); |
|
connect(this, SIGNAL(signalUpdateByTimer()), |
parea, SLOT(slotUpdateByTimer())); |
|
connect(parea, SIGNAL(signalShowFunction(uint64_t, uint64_t)), |
this, SLOT(slotShowFunction(uint64_t, uint64_t))); |
} |
|
} // namespace debugger |
/StackTraceWidget.h
1,85 → 1,85
/** |
* @file |
* @copyright Copyright 2017 GNSS Sensor Ltd. All right reserved. |
* @author Sergey Khabarov - sergeykhbr@gmail.com |
* @brief Stack trace viewer form. |
*/ |
|
#pragma once |
|
#include "api_core.h" // MUST BE BEFORE QtWidgets.h or any other Qt header. |
#include "attribute.h" |
#include "igui.h" |
|
#include <QtWidgets/QMdiArea> |
#include <QtWidgets/QMdiSubWindow> |
#include <QtWidgets/QGridLayout> |
#include <QtWidgets/QAction> |
#include <QtGui/qevent.h> |
|
namespace debugger { |
|
class StackTraceWidget : public QWidget { |
Q_OBJECT |
public: |
StackTraceWidget(IGui *igui, QWidget *parent); |
|
signals: |
void signalUpdateByTimer(); |
void signalShowFunction(uint64_t addr, uint64_t sz); |
|
private slots: |
void slotUpdateByTimer() { |
emit signalUpdateByTimer(); |
} |
void slotShowFunction(uint64_t addr, uint64_t sz) { |
emit signalShowFunction(addr, sz); |
} |
|
private: |
QGridLayout *gridLayout; |
IGui *igui_; |
}; |
|
|
class StackTraceQMdiSubWindow : public QMdiSubWindow { |
Q_OBJECT |
public: |
StackTraceQMdiSubWindow(IGui *igui, QMdiArea *area, QWidget *parent, |
QAction *act = 0) |
: QMdiSubWindow(parent) { |
area_ = area; |
action_ = act; |
setWindowTitle(tr("Stack Trace")); |
setWindowIcon(QIcon(tr(":/images/stack_96x96.png"))); |
|
StackTraceWidget *pnew = new StackTraceWidget(igui, this); |
setWidget(pnew); |
if (act) { |
act->setChecked(true); |
} |
connect(parent, SIGNAL(signalUpdateByTimer()), |
pnew, SLOT(slotUpdateByTimer())); |
|
connect(pnew, SIGNAL(signalShowFunction(uint64_t, uint64_t)), |
parent, SLOT(slotOpenDisasm(uint64_t, uint64_t))); |
|
area_->addSubWindow(this); |
setAttribute(Qt::WA_DeleteOnClose); |
show(); |
} |
|
protected: |
void closeEvent(QCloseEvent *event_) Q_DECL_OVERRIDE { |
if (action_) { |
action_->setChecked(false); |
} |
area_->removeSubWindow(this); |
event_->accept(); |
} |
private: |
QAction *action_; |
QMdiArea *area_; |
}; |
|
} // namespace debugger |
/** |
* @file |
* @copyright Copyright 2017 GNSS Sensor Ltd. All right reserved. |
* @author Sergey Khabarov - sergeykhbr@gmail.com |
* @brief Stack trace viewer form. |
*/ |
|
#pragma once |
|
#include "api_core.h" // MUST BE BEFORE QtWidgets.h or any other Qt header. |
#include "attribute.h" |
#include "igui.h" |
|
#include <QtWidgets/QMdiArea> |
#include <QtWidgets/QMdiSubWindow> |
#include <QtWidgets/QGridLayout> |
#include <QtWidgets/QAction> |
#include <QtGui/qevent.h> |
|
namespace debugger { |
|
class StackTraceWidget : public QWidget { |
Q_OBJECT |
public: |
StackTraceWidget(IGui *igui, QWidget *parent); |
|
signals: |
void signalUpdateByTimer(); |
void signalShowFunction(uint64_t addr, uint64_t sz); |
|
private slots: |
void slotUpdateByTimer() { |
emit signalUpdateByTimer(); |
} |
void slotShowFunction(uint64_t addr, uint64_t sz) { |
emit signalShowFunction(addr, sz); |
} |
|
private: |
QGridLayout *gridLayout; |
IGui *igui_; |
}; |
|
|
class StackTraceQMdiSubWindow : public QMdiSubWindow { |
Q_OBJECT |
public: |
StackTraceQMdiSubWindow(IGui *igui, QMdiArea *area, QWidget *parent, |
QAction *act = 0) |
: QMdiSubWindow(parent) { |
area_ = area; |
action_ = act; |
setWindowTitle(tr("Stack Trace")); |
setWindowIcon(QIcon(tr(":/images/stack_96x96.png"))); |
|
StackTraceWidget *pnew = new StackTraceWidget(igui, this); |
setWidget(pnew); |
if (act) { |
act->setChecked(true); |
} |
connect(parent, SIGNAL(signalUpdateByTimer()), |
pnew, SLOT(slotUpdateByTimer())); |
|
connect(pnew, SIGNAL(signalShowFunction(uint64_t, uint64_t)), |
parent, SLOT(slotOpenDisasm(uint64_t, uint64_t))); |
|
area_->addSubWindow(this); |
setAttribute(Qt::WA_DeleteOnClose); |
show(); |
} |
|
protected: |
void closeEvent(QCloseEvent *event_) Q_DECL_OVERRIDE { |
if (action_) { |
action_->setChecked(false); |
} |
area_->removeSubWindow(this); |
event_->accept(); |
} |
private: |
QAction *action_; |
QMdiArea *area_; |
}; |
|
} // namespace debugger |
/SymbolBrowserArea.cpp
1,172 → 1,172
/** |
* @file |
* @copyright Copyright 2017 GNSS Sensor Ltd. All right reserved. |
* @author Sergey Khabarov - sergeykhbr@gmail.com |
* @brief Symbol Browser main area. |
*/ |
|
/** |
* @file |
* @copyright Copyright 2017 GNSS Sensor Ltd. All right reserved. |
* @author Sergey Khabarov - sergeykhbr@gmail.com |
* @brief Symbol Browser main area. |
*/ |
|
#include "coreservices/ielfreader.h" |
#include "SymbolBrowserArea.h" |
#include "moc_SymbolBrowserArea.h" |
|
#include <memory> |
#include <string.h> |
#include <QtWidgets/QBoxLayout> |
#include <QtWidgets/QLabel> |
#include <QtWidgets/QHeaderView> |
#include <QtWidgets/QScrollBar> |
|
namespace debugger { |
|
SymbolBrowserArea::SymbolBrowserArea(IGui *gui, QWidget *parent) |
: QTableWidget(parent) { |
igui_ = gui; |
|
clear(); |
QFont font("Courier"); |
font.setStyleHint(QFont::Monospace); |
font.setPointSize(8); |
font.setFixedPitch(true); |
setFont(font); |
setContentsMargins(QMargins(0, 0, 0, 0)); |
QFontMetrics fm(font); |
setMinimumWidth(50 + fm.width(tr( |
"some_test_function (void ()) P:aabbccdd--aabbffff"))); |
lineHeight_ = fm.height() + 4; |
hideLineIdx_ = 0; |
|
setColumnCount(COL_Total); |
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); |
setListSize(1); |
|
verticalHeader()->setVisible(false); // remove row indexes |
setShowGrid(false); // remove borders |
setSelectionMode(QAbstractItemView::SingleSelection); |
setSelectionBehavior(QAbstractItemView::SelectRows); //select full row |
|
// change selected row color |
QPalette *palette = new QPalette(); |
palette->setColor(QPalette::Highlight, Qt::gray); |
setPalette(*palette); |
|
setHorizontalHeaderLabels( |
QString("symbol;type;address").split(";")); |
setColumnWidth(COL_symbol, 10 + fm.width(tr("some_test_function "))); |
setColumnWidth(COL_type, 10 + fm.width(tr("(void ()) "))); |
setColumnWidth(COL_address, 10 + fm.width(tr("P:0x00001000--0x00001040"))); |
|
connect(this, SIGNAL(cellDoubleClicked(int, int)), |
this, SLOT(slotCellDoubleClicked(int, int))); |
|
connect(this, SIGNAL(signalHandleResponse()), |
this, SLOT(slotHandleResponse())); |
|
AttributeType tcmd("symb"); |
igui_->registerCommand(static_cast<IGuiCmdHandler *>(this), |
&tcmd, true); |
} |
|
SymbolBrowserArea::~SymbolBrowserArea() { |
igui_->removeFromQueue(static_cast<IGuiCmdHandler *>(this)); |
} |
|
void SymbolBrowserArea::setListSize(int sz) { |
if (sz > rowCount()) { |
for (int i = hideLineIdx_; i < rowCount(); i++) { |
showRow(i); |
} |
hideLineIdx_ = sz; |
|
Qt::ItemFlags fl; |
int rowcnt_cur = rowCount(); |
setRowCount(sz); |
for (int i = rowcnt_cur; i < rowCount(); i++) { |
for (int n = 0; n < COL_Total; n++) { |
setItem(i, n, new QTableWidgetItem()); |
fl = item(i, n)->flags(); |
fl &= ~Qt::ItemIsEditable; |
//fl &= ~Qt::ItemIsSelectable; |
item(i, n)->setFlags(fl); |
} |
setRowHeight(i, lineHeight_); |
} |
} else { |
for (int i = hideLineIdx_; i < sz; i++) { |
showRow(i); |
} |
hideLineIdx_ = sz; |
for (int i = sz; i < rowCount(); i++) { |
hideRow(i); |
} |
} |
} |
|
void SymbolBrowserArea::handleResponse(AttributeType *req, |
AttributeType *resp) { |
if (strstr(req->to_string(), "symb") == 0) { |
return; |
} |
symbolList_ = *resp; |
emit signalHandleResponse(); |
} |
|
void SymbolBrowserArea::slotHandleResponse() { |
if (!symbolList_.is_list()) { |
return; |
} |
QTableWidgetItem *pw; |
Qt::ItemFlags fl; |
char tstr[256]; |
uint64_t addr; |
int list_sz = static_cast<int>(symbolList_.size()); |
setListSize(list_sz); |
|
for (int i = 0; i < list_sz; i++) { |
AttributeType &symb = symbolList_[i]; |
|
pw = item(i, COL_symbol); |
pw->setText(QString(symb[Symbol_Name].to_string())); |
|
pw = item(i, COL_type); |
if (symb[Symbol_Type].to_uint64() & SYMBOL_TYPE_FUNCTION) { |
pw->setText(tr("function")); |
} else if (symb[Symbol_Type].to_uint64() & SYMBOL_TYPE_DATA) { |
pw->setText(tr("data")); |
} else { |
} |
|
pw = item(i, COL_address); |
addr = symb[Symbol_Addr].to_uint64(); |
RISCV_sprintf(tstr, sizeof(tstr), |
"%08" RV_PRI64 "x--%08" RV_PRI64 "x", |
addr, addr + symb[Symbol_Size].to_uint64()); |
pw->setText(QString(tstr)); |
} |
} |
|
void SymbolBrowserArea::slotFilterChanged(const QString &flt) { |
AttributeType tcmd; |
QByteArray flt_buf; |
flt_buf.append("symb " + flt); |
tcmd.make_string(flt_buf.data()); |
igui_->registerCommand(static_cast<IGuiCmdHandler *>(this), |
&tcmd, true); |
} |
|
void SymbolBrowserArea::slotCellDoubleClicked(int row, int column) { |
if (row >= static_cast<int>(symbolList_.size())) { |
return; |
} |
|
AttributeType &symb = symbolList_[row]; |
uint64_t addr = symb[Symbol_Addr].to_uint64(); |
uint64_t sz = symb[Symbol_Size].to_uint64(); |
|
if (symb[Symbol_Type].to_uint64() & SYMBOL_TYPE_FUNCTION) { |
emit signalShowFunction(addr, sz); |
} else { |
emit signalShowData(addr, sz); |
} |
} |
|
} // namespace debugger |
#include "SymbolBrowserArea.h" |
#include "moc_SymbolBrowserArea.h" |
|
#include <memory> |
#include <string.h> |
#include <QtWidgets/QBoxLayout> |
#include <QtWidgets/QLabel> |
#include <QtWidgets/QHeaderView> |
#include <QtWidgets/QScrollBar> |
|
namespace debugger { |
|
SymbolBrowserArea::SymbolBrowserArea(IGui *gui, QWidget *parent) |
: QTableWidget(parent) { |
igui_ = gui; |
|
clear(); |
QFont font("Courier"); |
font.setStyleHint(QFont::Monospace); |
font.setPointSize(8); |
font.setFixedPitch(true); |
setFont(font); |
setContentsMargins(QMargins(0, 0, 0, 0)); |
QFontMetrics fm(font); |
setMinimumWidth(50 + fm.width(tr( |
"some_test_function (void ()) P:aabbccdd--aabbffff"))); |
lineHeight_ = fm.height() + 4; |
hideLineIdx_ = 0; |
|
setColumnCount(COL_Total); |
setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding); |
setListSize(1); |
|
verticalHeader()->setVisible(false); // remove row indexes |
setShowGrid(false); // remove borders |
setSelectionMode(QAbstractItemView::SingleSelection); |
setSelectionBehavior(QAbstractItemView::SelectRows); //select full row |
|
// change selected row color |
QPalette *palette = new QPalette(); |
palette->setColor(QPalette::Highlight, Qt::gray); |
setPalette(*palette); |
|
setHorizontalHeaderLabels( |
QString("symbol;type;address").split(";")); |
setColumnWidth(COL_symbol, 10 + fm.width(tr("some_test_function "))); |
setColumnWidth(COL_type, 10 + fm.width(tr("(void ()) "))); |
setColumnWidth(COL_address, 10 + fm.width(tr("P:0x00001000--0x00001040"))); |
|
connect(this, SIGNAL(cellDoubleClicked(int, int)), |
this, SLOT(slotCellDoubleClicked(int, int))); |
|
connect(this, SIGNAL(signalHandleResponse()), |
this, SLOT(slotHandleResponse())); |
|
AttributeType tcmd("symb"); |
igui_->registerCommand(static_cast<IGuiCmdHandler *>(this), |
&tcmd, true); |
} |
|
SymbolBrowserArea::~SymbolBrowserArea() { |
igui_->removeFromQueue(static_cast<IGuiCmdHandler *>(this)); |
} |
|
void SymbolBrowserArea::setListSize(int sz) { |
if (sz > rowCount()) { |
for (int i = hideLineIdx_; i < rowCount(); i++) { |
showRow(i); |
} |
hideLineIdx_ = sz; |
|
Qt::ItemFlags fl; |
int rowcnt_cur = rowCount(); |
setRowCount(sz); |
for (int i = rowcnt_cur; i < rowCount(); i++) { |
for (int n = 0; n < COL_Total; n++) { |
setItem(i, n, new QTableWidgetItem()); |
fl = item(i, n)->flags(); |
fl &= ~Qt::ItemIsEditable; |
//fl &= ~Qt::ItemIsSelectable; |
item(i, n)->setFlags(fl); |
} |
setRowHeight(i, lineHeight_); |
} |
} else { |
for (int i = hideLineIdx_; i < sz; i++) { |
showRow(i); |
} |
hideLineIdx_ = sz; |
for (int i = sz; i < rowCount(); i++) { |
hideRow(i); |
} |
} |
} |
|
void SymbolBrowserArea::handleResponse(AttributeType *req, |
AttributeType *resp) { |
if (strstr(req->to_string(), "symb") == 0) { |
return; |
} |
symbolList_ = *resp; |
emit signalHandleResponse(); |
} |
|
void SymbolBrowserArea::slotHandleResponse() { |
if (!symbolList_.is_list()) { |
return; |
} |
QTableWidgetItem *pw; |
Qt::ItemFlags fl; |
char tstr[256]; |
uint64_t addr; |
int list_sz = static_cast<int>(symbolList_.size()); |
setListSize(list_sz); |
|
for (int i = 0; i < list_sz; i++) { |
AttributeType &symb = symbolList_[i]; |
|
pw = item(i, COL_symbol); |
pw->setText(QString(symb[Symbol_Name].to_string())); |
|
pw = item(i, COL_type); |
if (symb[Symbol_Type].to_uint64() & SYMBOL_TYPE_FUNCTION) { |
pw->setText(tr("function")); |
} else if (symb[Symbol_Type].to_uint64() & SYMBOL_TYPE_DATA) { |
pw->setText(tr("data")); |
} else { |
} |
|
pw = item(i, COL_address); |
addr = symb[Symbol_Addr].to_uint64(); |
RISCV_sprintf(tstr, sizeof(tstr), |
"%08" RV_PRI64 "x--%08" RV_PRI64 "x", |
addr, addr + symb[Symbol_Size].to_uint64()); |
pw->setText(QString(tstr)); |
} |
} |
|
void SymbolBrowserArea::slotFilterChanged(const QString &flt) { |
AttributeType tcmd; |
QByteArray flt_buf; |
flt_buf.append("symb " + flt); |
tcmd.make_string(flt_buf.data()); |
igui_->registerCommand(static_cast<IGuiCmdHandler *>(this), |
&tcmd, true); |
} |
|
void SymbolBrowserArea::slotCellDoubleClicked(int row, int column) { |
if (row >= static_cast<int>(symbolList_.size())) { |
return; |
} |
|
AttributeType &symb = symbolList_[row]; |
uint64_t addr = symb[Symbol_Addr].to_uint64(); |
uint64_t sz = symb[Symbol_Size].to_uint64(); |
|
if (symb[Symbol_Type].to_uint64() & SYMBOL_TYPE_FUNCTION) { |
emit signalShowFunction(addr, sz); |
} else { |
emit signalShowData(addr, sz); |
} |
} |
|
} // namespace debugger |
/SymbolBrowserArea.h
1,60 → 1,60
/** |
* @file |
* @copyright Copyright 2017 GNSS Sensor Ltd. All right reserved. |
* @author Sergey Khabarov - sergeykhbr@gmail.com |
* @brief Symbol Browser main area. |
*/ |
|
#pragma once |
|
#include "api_core.h" // MUST BE BEFORE QtWidgets.h or any other Qt header. |
#include "attribute.h" |
#include "igui.h" |
#include "iservice.h" |
#include "coreservices/isocinfo.h" |
#include "coreservices/isrccode.h" |
|
#include <QtWidgets/QWidget> |
#include <QtWidgets/QTableWidget> |
|
namespace debugger { |
|
class SymbolBrowserArea : public QTableWidget, |
public IGuiCmdHandler { |
Q_OBJECT |
public: |
explicit SymbolBrowserArea(IGui *gui, QWidget *parent); |
virtual ~SymbolBrowserArea(); |
|
/** IGuiCmdHandler */ |
virtual void handleResponse(AttributeType *req, AttributeType *resp); |
|
public slots: |
void slotCellDoubleClicked(int row, int column); |
void slotFilterChanged(const QString &flt); |
void slotHandleResponse(); |
|
signals: |
void signalHandleResponse(); |
void signalShowFunction(uint64_t addr, uint64_t sz); |
void signalShowData(uint64_t addr, uint64_t sz); |
|
private: |
void setListSize(int sz); |
|
private: |
enum EColumnNames { |
COL_symbol, |
COL_type, |
COL_address, |
COL_Total |
}; |
|
AttributeType symbolList_; |
AttributeType symbolFilter_; |
IGui *igui_; |
int lineHeight_; |
int hideLineIdx_; |
}; |
|
} // namespace debugger |
/** |
* @file |
* @copyright Copyright 2017 GNSS Sensor Ltd. All right reserved. |
* @author Sergey Khabarov - sergeykhbr@gmail.com |
* @brief Symbol Browser main area. |
*/ |
|
#pragma once |
|
#include "api_core.h" // MUST BE BEFORE QtWidgets.h or any other Qt header. |
#include "attribute.h" |
#include "igui.h" |
#include "iservice.h" |
#include "coreservices/isocinfo.h" |
#include "coreservices/isrccode.h" |
|
#include <QtWidgets/QWidget> |
#include <QtWidgets/QTableWidget> |
|
namespace debugger { |
|
class SymbolBrowserArea : public QTableWidget, |
public IGuiCmdHandler { |
Q_OBJECT |
public: |
explicit SymbolBrowserArea(IGui *gui, QWidget *parent); |
virtual ~SymbolBrowserArea(); |
|
/** IGuiCmdHandler */ |
virtual void handleResponse(AttributeType *req, AttributeType *resp); |
|
public slots: |
void slotCellDoubleClicked(int row, int column); |
void slotFilterChanged(const QString &flt); |
void slotHandleResponse(); |
|
signals: |
void signalHandleResponse(); |
void signalShowFunction(uint64_t addr, uint64_t sz); |
void signalShowData(uint64_t addr, uint64_t sz); |
|
private: |
void setListSize(int sz); |
|
private: |
enum EColumnNames { |
COL_symbol, |
COL_type, |
COL_address, |
COL_Total |
}; |
|
AttributeType symbolList_; |
AttributeType symbolFilter_; |
IGui *igui_; |
int lineHeight_; |
int hideLineIdx_; |
}; |
|
} // namespace debugger |
/SymbolBrowserControl.cpp
1,56 → 1,56
/** |
* @file |
* @copyright Copyright 2017 GNSS Sensor Ltd. All right reserved. |
* @author Sergey Khabarov - sergeykhbr@gmail.com |
* @brief Symbol Browser control panel. |
*/ |
|
#include "SymbolBrowserControl.h" |
#include "moc_SymbolBrowserControl.h" |
|
#include <memory> |
#include <string.h> |
#include <QtWidgets/QBoxLayout> |
#include <QtWidgets/QLabel> |
#include <QtWidgets/QPushButton> |
|
namespace debugger { |
|
SymbolBrowserControl::SymbolBrowserControl(QWidget *parent) |
: QWidget(parent) { |
QFont font = QFont("Courier"); |
font.setStyleHint(QFont::Monospace); |
font.setPointSize(8); |
font.setFixedPitch(true); |
setFont(font); |
QFontMetrics fm(font); |
|
paletteDefault_.setColor(QPalette::Text, Qt::black); |
paletteDefault_.setColor(QPalette::Base, Qt::white); |
|
|
QGridLayout *gridLayout = new QGridLayout(this); |
setLayout(gridLayout); |
|
|
QLabel *lbl = new QLabel("Filter:"); |
gridLayout->addWidget(lbl, 0, 0, Qt::AlignRight); |
|
editFilter_ = new QLineEdit(this); |
editFilter_->setText(tr("*")); |
editFilter_->setFixedWidth(fm.width(tr("*some_test_func*"))); |
editFilter_->setPalette(paletteDefault_); |
gridLayout->addWidget(editFilter_, 0, 1, Qt::AlignLeft); |
gridLayout->setColumnStretch(1, 10); |
|
connect(editFilter_, SIGNAL(returnPressed()), |
this, SLOT(slotFilterEditingFinished())); |
} |
|
void SymbolBrowserControl::slotFilterEditingFinished() { |
emit signalFilterChanged(editFilter_->text()); |
} |
|
|
|
} // namespace debugger |
/** |
* @file |
* @copyright Copyright 2017 GNSS Sensor Ltd. All right reserved. |
* @author Sergey Khabarov - sergeykhbr@gmail.com |
* @brief Symbol Browser control panel. |
*/ |
|
#include "SymbolBrowserControl.h" |
#include "moc_SymbolBrowserControl.h" |
|
#include <memory> |
#include <string.h> |
#include <QtWidgets/QBoxLayout> |
#include <QtWidgets/QLabel> |
#include <QtWidgets/QPushButton> |
|
namespace debugger { |
|
SymbolBrowserControl::SymbolBrowserControl(QWidget *parent) |
: QWidget(parent) { |
QFont font = QFont("Courier"); |
font.setStyleHint(QFont::Monospace); |
font.setPointSize(8); |
font.setFixedPitch(true); |
setFont(font); |
QFontMetrics fm(font); |
|
paletteDefault_.setColor(QPalette::Text, Qt::black); |
paletteDefault_.setColor(QPalette::Base, Qt::white); |
|
|
QGridLayout *gridLayout = new QGridLayout(this); |
setLayout(gridLayout); |
|
|
QLabel *lbl = new QLabel("Filter:"); |
gridLayout->addWidget(lbl, 0, 0, Qt::AlignRight); |
|
editFilter_ = new QLineEdit(this); |
editFilter_->setText(tr("*")); |
editFilter_->setFixedWidth(fm.width(tr("*some_test_func*"))); |
editFilter_->setPalette(paletteDefault_); |
gridLayout->addWidget(editFilter_, 0, 1, Qt::AlignLeft); |
gridLayout->setColumnStretch(1, 10); |
|
connect(editFilter_, SIGNAL(returnPressed()), |
this, SLOT(slotFilterEditingFinished())); |
} |
|
void SymbolBrowserControl::slotFilterEditingFinished() { |
emit signalFilterChanged(editFilter_->text()); |
} |
|
|
|
} // namespace debugger |
/SymbolBrowserControl.h
1,36 → 1,36
/** |
* @file |
* @copyright Copyright 2017 GNSS Sensor Ltd. All right reserved. |
* @author Sergey Khabarov - sergeykhbr@gmail.com |
* @brief Symbol Browser control panel. |
*/ |
|
#pragma once |
|
#include "api_core.h" // MUST BE BEFORE QtWidgets.h or any other Qt header. |
#include "attribute.h" |
#include "igui.h" |
|
#include <QtWidgets/QWidget> |
#include <QtWidgets/QLineEdit> |
|
|
namespace debugger { |
|
class SymbolBrowserControl : public QWidget { |
Q_OBJECT |
public: |
explicit SymbolBrowserControl(QWidget *parent); |
|
signals: |
void signalFilterChanged(const QString &flt); |
|
public slots: |
void slotFilterEditingFinished(); |
|
private: |
QLineEdit *editFilter_; |
QPalette paletteDefault_; |
}; |
|
} // namespace debugger |
/** |
* @file |
* @copyright Copyright 2017 GNSS Sensor Ltd. All right reserved. |
* @author Sergey Khabarov - sergeykhbr@gmail.com |
* @brief Symbol Browser control panel. |
*/ |
|
#pragma once |
|
#include "api_core.h" // MUST BE BEFORE QtWidgets.h or any other Qt header. |
#include "attribute.h" |
#include "igui.h" |
|
#include <QtWidgets/QWidget> |
#include <QtWidgets/QLineEdit> |
|
|
namespace debugger { |
|
class SymbolBrowserControl : public QWidget { |
Q_OBJECT |
public: |
explicit SymbolBrowserControl(QWidget *parent); |
|
signals: |
void signalFilterChanged(const QString &flt); |
|
public slots: |
void slotFilterEditingFinished(); |
|
private: |
QLineEdit *editFilter_; |
QPalette paletteDefault_; |
}; |
|
} // namespace debugger |
/SymbolBrowserWidget.cpp
1,45 → 1,45
/** |
* @file |
* @copyright Copyright 2016 GNSS Sensor Ltd. All right reserved. |
* @author Sergey Khabarov - sergeykhbr@gmail.com |
* @brief Disassembler viewer form. |
*/ |
|
#include "SymbolBrowserArea.h" |
#include "SymbolBrowserControl.h" |
#include "SymbolBrowserWidget.h" |
#include "moc_SymbolBrowserWidget.h" |
|
#include <memory> |
|
namespace debugger { |
|
SymbolBrowserWidget::SymbolBrowserWidget(IGui *igui, QWidget *parent) |
: QWidget(parent) { |
igui_ = igui; |
|
gridLayout = new QGridLayout(this); |
gridLayout->setSpacing(4); |
gridLayout->setHorizontalSpacing(10); |
gridLayout->setVerticalSpacing(0); |
gridLayout->setContentsMargins(4, 4, 4, 4); |
setLayout(gridLayout); |
|
SymbolBrowserControl *pctrl = new SymbolBrowserControl(this); |
|
SymbolBrowserArea *parea = new SymbolBrowserArea(igui, this); |
gridLayout->addWidget(pctrl , 0, 0); |
gridLayout->addWidget(parea, 1, 0); |
gridLayout->setRowStretch(1, 10); |
|
connect(pctrl, SIGNAL(signalFilterChanged(const QString &)), |
parea, SLOT(slotFilterChanged(const QString &))); |
|
connect(parea, SIGNAL(signalShowFunction(uint64_t, uint64_t)), |
this, SLOT(slotShowFunction(uint64_t, uint64_t))); |
|
connect(parea, SIGNAL(signalShowData(uint64_t, uint64_t)), |
this, SLOT(slotShowData(uint64_t, uint64_t))); |
} |
|
} // namespace debugger |
/** |
* @file |
* @copyright Copyright 2016 GNSS Sensor Ltd. All right reserved. |
* @author Sergey Khabarov - sergeykhbr@gmail.com |
* @brief Disassembler viewer form. |
*/ |
|
#include "SymbolBrowserArea.h" |
#include "SymbolBrowserControl.h" |
#include "SymbolBrowserWidget.h" |
#include "moc_SymbolBrowserWidget.h" |
|
#include <memory> |
|
namespace debugger { |
|
SymbolBrowserWidget::SymbolBrowserWidget(IGui *igui, QWidget *parent) |
: QWidget(parent) { |
igui_ = igui; |
|
gridLayout = new QGridLayout(this); |
gridLayout->setSpacing(4); |
gridLayout->setHorizontalSpacing(10); |
gridLayout->setVerticalSpacing(0); |
gridLayout->setContentsMargins(4, 4, 4, 4); |
setLayout(gridLayout); |
|
SymbolBrowserControl *pctrl = new SymbolBrowserControl(this); |
|
SymbolBrowserArea *parea = new SymbolBrowserArea(igui, this); |
gridLayout->addWidget(pctrl , 0, 0); |
gridLayout->addWidget(parea, 1, 0); |
gridLayout->setRowStretch(1, 10); |
|
connect(pctrl, SIGNAL(signalFilterChanged(const QString &)), |
parea, SLOT(slotFilterChanged(const QString &))); |
|
connect(parea, SIGNAL(signalShowFunction(uint64_t, uint64_t)), |
this, SLOT(slotShowFunction(uint64_t, uint64_t))); |
|
connect(parea, SIGNAL(signalShowData(uint64_t, uint64_t)), |
this, SLOT(slotShowData(uint64_t, uint64_t))); |
} |
|
} // namespace debugger |
/SymbolBrowserWidget.h
1,78 → 1,78
/** |
* @file |
* @copyright Copyright 2016 GNSS Sensor Ltd. All right reserved. |
* @author Sergey Khabarov - sergeykhbr@gmail.com |
* @brief Disassembler viewer form. |
*/ |
|
#pragma once |
|
#include "api_core.h" // MUST BE BEFORE QtWidgets.h or any other Qt header. |
#include "attribute.h" |
#include "igui.h" |
|
#include <QtWidgets/QMdiArea> |
#include <QtWidgets/QMdiSubWindow> |
#include <QtWidgets/QGridLayout> |
#include <QtWidgets/QAction> |
#include <QtGui/qevent.h> |
|
namespace debugger { |
|
class SymbolBrowserWidget : public QWidget { |
Q_OBJECT |
public: |
SymbolBrowserWidget(IGui *igui, QWidget *parent); |
|
public slots: |
void slotShowFunction(uint64_t addr, uint64_t sz) { |
emit signalShowFunction(addr, sz); |
} |
void slotShowData(uint64_t addr, uint64_t sz) { |
emit signalShowData(addr, sz); |
} |
|
signals: |
void signalShowFunction(uint64_t addr, uint64_t sz); |
void signalShowData(uint64_t addr, uint64_t sz); |
|
private: |
QGridLayout *gridLayout; |
IGui *igui_; |
}; |
|
|
class SymbolBrowserQMdiSubWindow : public QMdiSubWindow { |
Q_OBJECT |
public: |
SymbolBrowserQMdiSubWindow(IGui *igui, QMdiArea *area, QWidget *parent = 0) |
: QMdiSubWindow(parent) { |
area_ = area; |
setWindowTitle(tr("Symbol Browser")); |
setWindowIcon(QIcon(tr(":/images/info_96x96.png"))); |
|
SymbolBrowserWidget *pWidget = new SymbolBrowserWidget(igui, this); |
setWidget(pWidget); |
connect(pWidget, SIGNAL(signalShowFunction(uint64_t, uint64_t)), |
parent, SLOT(slotOpenDisasm(uint64_t, uint64_t))); |
connect(pWidget, SIGNAL(signalShowData(uint64_t, uint64_t)), |
parent, SLOT(slotOpenMemory(uint64_t, uint64_t))); |
|
area_->addSubWindow(this); |
setAttribute(Qt::WA_DeleteOnClose); |
show(); |
} |
|
|
protected: |
void closeEvent(QCloseEvent *event_) Q_DECL_OVERRIDE { |
area_->removeSubWindow(this); |
event_->accept(); |
} |
private: |
QMdiArea *area_; |
}; |
|
|
|
} // namespace debugger |
/** |
* @file |
* @copyright Copyright 2016 GNSS Sensor Ltd. All right reserved. |
* @author Sergey Khabarov - sergeykhbr@gmail.com |
* @brief Disassembler viewer form. |
*/ |
|
#pragma once |
|
#include "api_core.h" // MUST BE BEFORE QtWidgets.h or any other Qt header. |
#include "attribute.h" |
#include "igui.h" |
|
#include <QtWidgets/QMdiArea> |
#include <QtWidgets/QMdiSubWindow> |
#include <QtWidgets/QGridLayout> |
#include <QtWidgets/QAction> |
#include <QtGui/qevent.h> |
|
namespace debugger { |
|
class SymbolBrowserWidget : public QWidget { |
Q_OBJECT |
public: |
SymbolBrowserWidget(IGui *igui, QWidget *parent); |
|
public slots: |
void slotShowFunction(uint64_t addr, uint64_t sz) { |
emit signalShowFunction(addr, sz); |
} |
void slotShowData(uint64_t addr, uint64_t sz) { |
emit signalShowData(addr, sz); |
} |
|
signals: |
void signalShowFunction(uint64_t addr, uint64_t sz); |
void signalShowData(uint64_t addr, uint64_t sz); |
|
private: |
QGridLayout *gridLayout; |
IGui *igui_; |
}; |
|
|
class SymbolBrowserQMdiSubWindow : public QMdiSubWindow { |
Q_OBJECT |
public: |
SymbolBrowserQMdiSubWindow(IGui *igui, QMdiArea *area, QWidget *parent = 0) |
: QMdiSubWindow(parent) { |
area_ = area; |
setWindowTitle(tr("Symbol Browser")); |
setWindowIcon(QIcon(tr(":/images/info_96x96.png"))); |
|
SymbolBrowserWidget *pWidget = new SymbolBrowserWidget(igui, this); |
setWidget(pWidget); |
connect(pWidget, SIGNAL(signalShowFunction(uint64_t, uint64_t)), |
parent, SLOT(slotOpenDisasm(uint64_t, uint64_t))); |
connect(pWidget, SIGNAL(signalShowData(uint64_t, uint64_t)), |
parent, SLOT(slotOpenMemory(uint64_t, uint64_t))); |
|
area_->addSubWindow(this); |
setAttribute(Qt::WA_DeleteOnClose); |
show(); |
} |
|
|
protected: |
void closeEvent(QCloseEvent *event_) Q_DECL_OVERRIDE { |
area_->removeSubWindow(this); |
event_->accept(); |
} |
private: |
QMdiArea *area_; |
}; |
|
|
|
} // namespace debugger |
/moc_AsmArea.h
1,7 → 1,7
/**************************************************************************** |
** Meta object code from reading C++ file 'AsmArea.h' |
** |
** Created by: The Qt Meta Object Compiler version 67 (Qt 5.7.0) |
** Created by: The Qt Meta Object Compiler version 67 (Qt 5.8.0) |
** |
** WARNING! All changes made in this file will be lost! |
*****************************************************************************/ |
11,12 → 11,14
#if !defined(Q_MOC_OUTPUT_REVISION) |
#error "The header file 'AsmArea.h' doesn't include <QObject>." |
#elif Q_MOC_OUTPUT_REVISION != 67 |
#error "This file was generated using the moc from 5.7.0. It" |
#error "This file was generated using the moc from 5.8.0. It" |
#error "cannot be used with the include files from this version of Qt." |
#error "(The moc has changed too much.)" |
#endif |
|
QT_BEGIN_MOC_NAMESPACE |
QT_WARNING_PUSH |
QT_WARNING_DISABLE_DEPRECATED |
struct qt_meta_stringdata_debugger__AsmArea_t { |
QByteArrayData data[12]; |
char stringdata0[184]; |
188,4 → 190,5
{ |
QMetaObject::activate(this, &staticMetaObject, 2, Q_NULLPTR); |
} |
QT_WARNING_POP |
QT_END_MOC_NAMESPACE |
/moc_AsmControl.h
1,7 → 1,7
/**************************************************************************** |
** Meta object code from reading C++ file 'AsmControl.h' |
** |
** Created by: The Qt Meta Object Compiler version 67 (Qt 5.7.0) |
** Created by: The Qt Meta Object Compiler version 67 (Qt 5.8.0) |
** |
** WARNING! All changes made in this file will be lost! |
*****************************************************************************/ |
11,12 → 11,14
#if !defined(Q_MOC_OUTPUT_REVISION) |
#error "The header file 'AsmControl.h' doesn't include <QObject>." |
#elif Q_MOC_OUTPUT_REVISION != 67 |
#error "This file was generated using the moc from 5.7.0. It" |
#error "This file was generated using the moc from 5.8.0. It" |
#error "cannot be used with the include files from this version of Qt." |
#error "(The moc has changed too much.)" |
#endif |
|
QT_BEGIN_MOC_NAMESPACE |
QT_WARNING_PUSH |
QT_WARNING_DISABLE_DEPRECATED |
struct qt_meta_stringdata_debugger__AsmControl_t { |
QByteArrayData data[7]; |
char stringdata0[86]; |
139,4 → 141,5
void *_a[] = { Q_NULLPTR, const_cast<void*>(reinterpret_cast<const void*>(&_t1)) }; |
QMetaObject::activate(this, &staticMetaObject, 0, _a); |
} |
QT_WARNING_POP |
QT_END_MOC_NAMESPACE |
/moc_AsmViewWidget.h
1,7 → 1,7
/**************************************************************************** |
** Meta object code from reading C++ file 'AsmViewWidget.h' |
** |
** Created by: The Qt Meta Object Compiler version 67 (Qt 5.7.0) |
** Created by: The Qt Meta Object Compiler version 67 (Qt 5.8.0) |
** |
** WARNING! All changes made in this file will be lost! |
*****************************************************************************/ |
11,12 → 11,14
#if !defined(Q_MOC_OUTPUT_REVISION) |
#error "The header file 'AsmViewWidget.h' doesn't include <QObject>." |
#elif Q_MOC_OUTPUT_REVISION != 67 |
#error "This file was generated using the moc from 5.7.0. It" |
#error "This file was generated using the moc from 5.8.0. It" |
#error "cannot be used with the include files from this version of Qt." |
#error "(The moc has changed too much.)" |
#endif |
|
QT_BEGIN_MOC_NAMESPACE |
QT_WARNING_PUSH |
QT_WARNING_DISABLE_DEPRECATED |
struct qt_meta_stringdata_debugger__AsmViewWidget_t { |
QByteArrayData data[8]; |
char stringdata0[147]; |
244,4 → 246,5
return _id; |
return _id; |
} |
QT_WARNING_POP |
QT_END_MOC_NAMESPACE |
/moc_MemArea.h
1,7 → 1,7
/**************************************************************************** |
** Meta object code from reading C++ file 'MemArea.h' |
** |
** Created by: The Qt Meta Object Compiler version 67 (Qt 5.7.0) |
** Created by: The Qt Meta Object Compiler version 67 (Qt 5.8.0) |
** |
** WARNING! All changes made in this file will be lost! |
*****************************************************************************/ |
11,12 → 11,14
#if !defined(Q_MOC_OUTPUT_REVISION) |
#error "The header file 'MemArea.h' doesn't include <QObject>." |
#elif Q_MOC_OUTPUT_REVISION != 67 |
#error "This file was generated using the moc from 5.7.0. It" |
#error "This file was generated using the moc from 5.8.0. It" |
#error "cannot be used with the include files from this version of Qt." |
#error "(The moc has changed too much.)" |
#endif |
|
QT_BEGIN_MOC_NAMESPACE |
QT_WARNING_PUSH |
QT_WARNING_DISABLE_DEPRECATED |
struct qt_meta_stringdata_debugger__MemArea_t { |
QByteArrayData data[8]; |
char stringdata0[107]; |
144,4 → 146,5
{ |
QMetaObject::activate(this, &staticMetaObject, 0, Q_NULLPTR); |
} |
QT_WARNING_POP |
QT_END_MOC_NAMESPACE |
/moc_MemControl.h
1,7 → 1,7
/**************************************************************************** |
** Meta object code from reading C++ file 'MemControl.h' |
** |
** Created by: The Qt Meta Object Compiler version 67 (Qt 5.7.0) |
** Created by: The Qt Meta Object Compiler version 67 (Qt 5.8.0) |
** |
** WARNING! All changes made in this file will be lost! |
*****************************************************************************/ |
11,12 → 11,14
#if !defined(Q_MOC_OUTPUT_REVISION) |
#error "The header file 'MemControl.h' doesn't include <QObject>." |
#elif Q_MOC_OUTPUT_REVISION != 67 |
#error "This file was generated using the moc from 5.7.0. It" |
#error "This file was generated using the moc from 5.8.0. It" |
#error "cannot be used with the include files from this version of Qt." |
#error "(The moc has changed too much.)" |
#endif |
|
QT_BEGIN_MOC_NAMESPACE |
QT_WARNING_PUSH |
QT_WARNING_DISABLE_DEPRECATED |
struct qt_meta_stringdata_debugger__MemControl_t { |
QByteArrayData data[7]; |
char stringdata0[86]; |
139,4 → 141,5
void *_a[] = { Q_NULLPTR, const_cast<void*>(reinterpret_cast<const void*>(&_t1)) }; |
QMetaObject::activate(this, &staticMetaObject, 0, _a); |
} |
QT_WARNING_POP |
QT_END_MOC_NAMESPACE |
/moc_MemViewWidget.h
1,7 → 1,7
/**************************************************************************** |
** Meta object code from reading C++ file 'MemViewWidget.h' |
** |
** Created by: The Qt Meta Object Compiler version 67 (Qt 5.7.0) |
** Created by: The Qt Meta Object Compiler version 67 (Qt 5.8.0) |
** |
** WARNING! All changes made in this file will be lost! |
*****************************************************************************/ |
11,12 → 11,14
#if !defined(Q_MOC_OUTPUT_REVISION) |
#error "The header file 'MemViewWidget.h' doesn't include <QObject>." |
#elif Q_MOC_OUTPUT_REVISION != 67 |
#error "This file was generated using the moc from 5.7.0. It" |
#error "This file was generated using the moc from 5.8.0. It" |
#error "cannot be used with the include files from this version of Qt." |
#error "(The moc has changed too much.)" |
#endif |
|
QT_BEGIN_MOC_NAMESPACE |
QT_WARNING_PUSH |
QT_WARNING_DISABLE_DEPRECATED |
struct qt_meta_stringdata_debugger__MemViewWidget_t { |
QByteArrayData data[4]; |
char stringdata0[63]; |
200,4 → 202,5
return _id; |
return _id; |
} |
QT_WARNING_POP |
QT_END_MOC_NAMESPACE |
/moc_RegWidget.h
1,7 → 1,7
/**************************************************************************** |
** Meta object code from reading C++ file 'RegWidget.h' |
** |
** Created by: The Qt Meta Object Compiler version 67 (Qt 5.7.0) |
** Created by: The Qt Meta Object Compiler version 67 (Qt 5.8.0) |
** |
** WARNING! All changes made in this file will be lost! |
*****************************************************************************/ |
11,12 → 11,14
#if !defined(Q_MOC_OUTPUT_REVISION) |
#error "The header file 'RegWidget.h' doesn't include <QObject>." |
#elif Q_MOC_OUTPUT_REVISION != 67 |
#error "This file was generated using the moc from 5.7.0. It" |
#error "This file was generated using the moc from 5.8.0. It" |
#error "cannot be used with the include files from this version of Qt." |
#error "(The moc has changed too much.)" |
#endif |
|
QT_BEGIN_MOC_NAMESPACE |
QT_WARNING_PUSH |
QT_WARNING_DISABLE_DEPRECATED |
struct qt_meta_stringdata_debugger__RegWidget_t { |
QByteArrayData data[8]; |
char stringdata0[98]; |
140,4 → 142,5
void *_a[] = { Q_NULLPTR, const_cast<void*>(reinterpret_cast<const void*>(&_t1)) }; |
QMetaObject::activate(this, &staticMetaObject, 0, _a); |
} |
QT_WARNING_POP |
QT_END_MOC_NAMESPACE |
/moc_RegsViewWidget.h
1,7 → 1,7
/**************************************************************************** |
** Meta object code from reading C++ file 'RegsViewWidget.h' |
** |
** Created by: The Qt Meta Object Compiler version 67 (Qt 5.7.0) |
** Created by: The Qt Meta Object Compiler version 67 (Qt 5.8.0) |
** |
** WARNING! All changes made in this file will be lost! |
*****************************************************************************/ |
11,12 → 11,14
#if !defined(Q_MOC_OUTPUT_REVISION) |
#error "The header file 'RegsViewWidget.h' doesn't include <QObject>." |
#elif Q_MOC_OUTPUT_REVISION != 67 |
#error "This file was generated using the moc from 5.7.0. It" |
#error "This file was generated using the moc from 5.8.0. It" |
#error "cannot be used with the include files from this version of Qt." |
#error "(The moc has changed too much.)" |
#endif |
|
QT_BEGIN_MOC_NAMESPACE |
QT_WARNING_PUSH |
QT_WARNING_DISABLE_DEPRECATED |
struct qt_meta_stringdata_debugger__RegsViewWidget_t { |
QByteArrayData data[8]; |
char stringdata0[106]; |
210,4 → 212,5
return _id; |
return _id; |
} |
QT_WARNING_POP |
QT_END_MOC_NAMESPACE |
/moc_StackTraceArea.h
1,7 → 1,7
/**************************************************************************** |
** Meta object code from reading C++ file 'StackTraceArea.h' |
** |
** Created by: The Qt Meta Object Compiler version 67 (Qt 5.7.0) |
** Created by: The Qt Meta Object Compiler version 67 (Qt 5.8.0) |
** |
** WARNING! All changes made in this file will be lost! |
*****************************************************************************/ |
11,12 → 11,14
#if !defined(Q_MOC_OUTPUT_REVISION) |
#error "The header file 'StackTraceArea.h' doesn't include <QObject>." |
#elif Q_MOC_OUTPUT_REVISION != 67 |
#error "This file was generated using the moc from 5.7.0. It" |
#error "This file was generated using the moc from 5.8.0. It" |
#error "cannot be used with the include files from this version of Qt." |
#error "(The moc has changed too much.)" |
#endif |
|
QT_BEGIN_MOC_NAMESPACE |
QT_WARNING_PUSH |
QT_WARNING_DISABLE_DEPRECATED |
struct qt_meta_stringdata_debugger__StackTraceArea_t { |
QByteArrayData data[12]; |
char stringdata0[153]; |
166,4 → 168,5
void *_a[] = { Q_NULLPTR, const_cast<void*>(reinterpret_cast<const void*>(&_t1)), const_cast<void*>(reinterpret_cast<const void*>(&_t2)) }; |
QMetaObject::activate(this, &staticMetaObject, 1, _a); |
} |
QT_WARNING_POP |
QT_END_MOC_NAMESPACE |
/moc_StackTraceWidget.h
1,7 → 1,7
/**************************************************************************** |
** Meta object code from reading C++ file 'StackTraceWidget.h' |
** |
** Created by: The Qt Meta Object Compiler version 67 (Qt 5.7.0) |
** Created by: The Qt Meta Object Compiler version 67 (Qt 5.8.0) |
** |
** WARNING! All changes made in this file will be lost! |
*****************************************************************************/ |
11,12 → 11,14
#if !defined(Q_MOC_OUTPUT_REVISION) |
#error "The header file 'StackTraceWidget.h' doesn't include <QObject>." |
#elif Q_MOC_OUTPUT_REVISION != 67 |
#error "This file was generated using the moc from 5.7.0. It" |
#error "This file was generated using the moc from 5.8.0. It" |
#error "cannot be used with the include files from this version of Qt." |
#error "(The moc has changed too much.)" |
#endif |
|
QT_BEGIN_MOC_NAMESPACE |
QT_WARNING_PUSH |
QT_WARNING_DISABLE_DEPRECATED |
struct qt_meta_stringdata_debugger__StackTraceWidget_t { |
QByteArrayData data[9]; |
char stringdata0[119]; |
226,4 → 228,5
return _id; |
return _id; |
} |
QT_WARNING_POP |
QT_END_MOC_NAMESPACE |
/moc_SymbolBrowserArea.h
1,7 → 1,7
/**************************************************************************** |
** Meta object code from reading C++ file 'SymbolBrowserArea.h' |
** |
** Created by: The Qt Meta Object Compiler version 67 (Qt 5.7.0) |
** Created by: The Qt Meta Object Compiler version 67 (Qt 5.8.0) |
** |
** WARNING! All changes made in this file will be lost! |
*****************************************************************************/ |
11,12 → 11,14
#if !defined(Q_MOC_OUTPUT_REVISION) |
#error "The header file 'SymbolBrowserArea.h' doesn't include <QObject>." |
#elif Q_MOC_OUTPUT_REVISION != 67 |
#error "This file was generated using the moc from 5.7.0. It" |
#error "This file was generated using the moc from 5.8.0. It" |
#error "cannot be used with the include files from this version of Qt." |
#error "(The moc has changed too much.)" |
#endif |
|
QT_BEGIN_MOC_NAMESPACE |
QT_WARNING_PUSH |
QT_WARNING_DISABLE_DEPRECATED |
struct qt_meta_stringdata_debugger__SymbolBrowserArea_t { |
QByteArrayData data[14]; |
char stringdata0[175]; |
186,4 → 188,5
void *_a[] = { Q_NULLPTR, const_cast<void*>(reinterpret_cast<const void*>(&_t1)), const_cast<void*>(reinterpret_cast<const void*>(&_t2)) }; |
QMetaObject::activate(this, &staticMetaObject, 2, _a); |
} |
QT_WARNING_POP |
QT_END_MOC_NAMESPACE |
/moc_SymbolBrowserControl.h
1,7 → 1,7
/**************************************************************************** |
** Meta object code from reading C++ file 'SymbolBrowserControl.h' |
** |
** Created by: The Qt Meta Object Compiler version 67 (Qt 5.7.0) |
** Created by: The Qt Meta Object Compiler version 67 (Qt 5.8.0) |
** |
** WARNING! All changes made in this file will be lost! |
*****************************************************************************/ |
11,12 → 11,14
#if !defined(Q_MOC_OUTPUT_REVISION) |
#error "The header file 'SymbolBrowserControl.h' doesn't include <QObject>." |
#elif Q_MOC_OUTPUT_REVISION != 67 |
#error "This file was generated using the moc from 5.7.0. It" |
#error "This file was generated using the moc from 5.8.0. It" |
#error "cannot be used with the include files from this version of Qt." |
#error "(The moc has changed too much.)" |
#endif |
|
QT_BEGIN_MOC_NAMESPACE |
QT_WARNING_PUSH |
QT_WARNING_DISABLE_DEPRECATED |
struct qt_meta_stringdata_debugger__SymbolBrowserControl_t { |
QByteArrayData data[5]; |
char stringdata0[82]; |
134,4 → 136,5
void *_a[] = { Q_NULLPTR, const_cast<void*>(reinterpret_cast<const void*>(&_t1)) }; |
QMetaObject::activate(this, &staticMetaObject, 0, _a); |
} |
QT_WARNING_POP |
QT_END_MOC_NAMESPACE |
/moc_SymbolBrowserWidget.h
1,7 → 1,7
/**************************************************************************** |
** Meta object code from reading C++ file 'SymbolBrowserWidget.h' |
** |
** Created by: The Qt Meta Object Compiler version 67 (Qt 5.7.0) |
** Created by: The Qt Meta Object Compiler version 67 (Qt 5.8.0) |
** |
** WARNING! All changes made in this file will be lost! |
*****************************************************************************/ |
11,12 → 11,14
#if !defined(Q_MOC_OUTPUT_REVISION) |
#error "The header file 'SymbolBrowserWidget.h' doesn't include <QObject>." |
#elif Q_MOC_OUTPUT_REVISION != 67 |
#error "This file was generated using the moc from 5.7.0. It" |
#error "This file was generated using the moc from 5.8.0. It" |
#error "cannot be used with the include files from this version of Qt." |
#error "(The moc has changed too much.)" |
#endif |
|
QT_BEGIN_MOC_NAMESPACE |
QT_WARNING_PUSH |
QT_WARNING_DISABLE_DEPRECATED |
struct qt_meta_stringdata_debugger__SymbolBrowserWidget_t { |
QByteArrayData data[9]; |
char stringdata0[112]; |
227,4 → 229,5
return _id; |
return _id; |
} |
QT_WARNING_POP |
QT_END_MOC_NAMESPACE |