- _table->cellAt(row, 0).firstCursorPosition().insertText(bytestring);
-
- line = line.replace('\t', ' ').toHtmlEscaped();
- if (href != "") {
- QStringList list = href.split(":");
- if (list[0] == "function") {
- uint64_t address = href.split(":")[1].toLongLong(NULL, 16);
- Function* fun = block->getManager()->getFunction(address);
-
- if (fun) {
- line = line.split(" ")[0] + " " + QString(fun->getName().c_str()).toHtmlEscaped();
- LOG4CXX_DEBUG(logger, "Naming function at " << address << " " << fun->getName());
+void BasicBlockWidget::populateWidget() {
+ int row;
+ QTextTableFormat format;
+ format.setBorderStyle(QTextFrameFormat::BorderStyle_None);
+ format.setBorder(0);
+
+ for (Instruction& inst : instructions) {
+ if (_table) {
+ row = _table->rows();
+ _table->appendRows(1);
+ } else {
+ row = 0;
+ _table = _widget->textCursor().insertTable(1, 3, format);
+ }
+ QString bytestring;
+ for (uint8_t byte : inst.getBytes()) {
+ const char * hexdigits = "0123456789ABCDEF";
+ bytestring += hexdigits[(byte >> 4) & 0xF];
+ bytestring += hexdigits[byte & 0xF];
+ bytestring += ' ';
+ }
+ _table->cellAt(row, 0).firstCursorPosition().insertText(bytestring);
+
+ QString line = inst.getText().c_str();
+ line = line.replace('\t', ' ').toHtmlEscaped();
+ if (inst.getReference() != "") {
+ QString href = inst.getReference().c_str();
+ QStringList list = href.split(":");
+ if (list[0] == "function") {
+ uint64_t address = href.split(":")[1].toLongLong(NULL, 16);
+ Function* fun = block->getManager()->getFunction(address);
+
+ if (fun) {
+ line = line.split(" ")[0] + " " + QString(fun->getName().c_str()).toHtmlEscaped();
+ LOG4CXX_DEBUG(logger, "Naming function at " << address << " " << fun->getName());
+ }