Remove redundant callstack member in APIEvent

* We already link to the chunk index and the chunk metadata contains the
  callstack, there's no need for a duplicate copy when there may be many
  APIEvents in a capture
This commit is contained in:
baldurk
2021-02-24 13:52:07 +00:00
parent 728fa34acc
commit d6e88ae4fa
8 changed files with 30 additions and 27 deletions
+20 -10
View File
@@ -25,8 +25,6 @@
#include "APIInspector.h"
#include "ui_APIInspector.h"
Q_DECLARE_METATYPE(APIEvent);
APIInspector::APIInspector(ICaptureContext &ctx, QWidget *parent)
: QFrame(parent), ui(new Ui::APIInspector), m_Ctx(ctx)
{
@@ -159,17 +157,27 @@ void APIInspector::on_apiEvents_itemSelectionChanged()
{
RDTreeWidgetItem *node = ui->apiEvents->selectedItem();
if(!node)
return;
SDChunk *chunk = NULL;
// search up the tree to find the next parent with a chunk tag
while(node)
{
chunk = (SDChunk *)node->tag().value<quintptr>();
APIEvent ev = node->tag().value<APIEvent>();
// if we found one, break
if(chunk)
break;
if(!ev.callstack.isEmpty())
// move to the parent
node = node->parent();
}
if(chunk && !chunk->metadata.callstack.isEmpty())
{
if(m_Ctx.Replay().GetCaptureAccess())
{
m_Ctx.Replay().AsyncInvoke([this, ev](IReplayController *) {
rdcarray<rdcstr> stack = m_Ctx.Replay().GetCaptureAccess()->GetResolve(ev.callstack);
m_Ctx.Replay().AsyncInvoke([this, chunk](IReplayController *) {
rdcarray<rdcstr> stack =
m_Ctx.Replay().GetCaptureAccess()->GetResolve(chunk->metadata.callstack);
GUIInvoke::call(this, [this, stack]() { addCallstack(stack); });
});
@@ -207,9 +215,11 @@ void APIInspector::fillAPIView()
{
RDTreeWidgetItem *root = new RDTreeWidgetItem({QString::number(ev.eventId), QString()});
SDChunk *chunk = NULL;
if(ev.chunkIndex < file.chunks.size())
{
SDChunk *chunk = file.chunks[ev.chunkIndex];
chunk = file.chunks[ev.chunkIndex];
m_Chunks.push_back(chunk);
@@ -225,7 +235,7 @@ void APIInspector::fillAPIView()
if(ev.eventId == draw->eventId)
root->setBold(true);
root->setTag(QVariant::fromValue(ev));
root->setTag(QVariant::fromValue((quintptr)(void *)chunk));
ui->apiEvents->addTopLevelItem(root);