Example #1
0
void ModelicaRecordValue::retrieveChildrenSize()
{
  GDBAdapter *pGDBAdapter = GDBAdapter::instance();
  StackFramesWidget *pStackFramesWidget = MainWindow::instance()->getStackFramesWidget();
  pGDBAdapter->postCommand(CommandFactory::arrayLength(pStackFramesWidget->getSelectedThread(), pStackFramesWidget->getSelectedFrame(),
                                                       mpLocalsTreeItem->getName()),
                           GDBAdapter::BlockUntilResponse, this, &GDBAdapter::arrayLengthCB);
}
Example #2
0
void ModelicaRecordValue::retrieveChildren()
{
  GDBAdapter *pGDBAdapter = GDBAdapter::instance();
  for (int i = 2 ; i <= getRecordElements() ; i++) {
    StackFramesWidget *pStackFramesWidget = MainWindow::instance()->getStackFramesWidget();
    QByteArray cmd = CommandFactory::getMetaTypeElement(pStackFramesWidget->getSelectedThread(), pStackFramesWidget->getSelectedFrame(),
                                                        mpLocalsTreeItem->getName(), i, CommandFactory::record_metaType);
    pGDBAdapter->postCommand(cmd, GDBAdapter::BlockUntilResponse, mpLocalsTreeItem, &GDBAdapter::getMetaTypeElementCB);
  }
}
Example #3
0
void ModelicaOptionValue::retrieveChildren()
{
  if (!isOptionNone()) {
    GDBAdapter *pGDBAdapter = GDBAdapter::instance();
    StackFramesWidget *pStackFramesWidget = MainWindow::instance()->getStackFramesWidget();
    QByteArray cmd = CommandFactory::getMetaTypeElement(pStackFramesWidget->getSelectedThread(), pStackFramesWidget->getSelectedFrame(),
                                                        mpLocalsTreeItem->getName(), 1, CommandFactory::option_metaType);
    pGDBAdapter->postCommand(cmd, GDBAdapter::BlockUntilResponse, mpLocalsTreeItem, &GDBAdapter::getMetaTypeElementCB);
  }
}
Example #4
0
/*!
 * \brief LocalsTreeItem::retrieveValue
 * Gets the value of the LocalsTreeItem using CommandFactory::anyString
 */
void LocalsTreeItem::retrieveValue()
{
  GDBAdapter *pGDBAdapter = mpLocalsTreeModel->getLocalsWidget()->getMainWindow()->getGDBAdapter();
  StackFramesWidget *pStackFramesWidget = mpLocalsTreeModel->getLocalsWidget()->getMainWindow()->getStackFramesWidget();
  if (isCoreTypeExceptString()) {
    pGDBAdapter->postCommand(CommandFactory::dataEvaluateExpression(pStackFramesWidget->getSelectedThread(),
                                                                    pStackFramesWidget->getSelectedFrame(), getName()),
                             GDBAdapter::BlockUntilResponse, this, &GDBAdapter::dataEvaluateExpressionCB);
  } else if (isCoreType()) {
    pGDBAdapter->postCommand(CommandFactory::anyString(pStackFramesWidget->getSelectedThread(), pStackFramesWidget->getSelectedFrame(),
                                                       getName()), GDBAdapter::BlockUntilResponse, this, &GDBAdapter::anyStringCB);
  } else {
    setValue(getDisplayType());
  }
}
Example #5
0
void LocalsTreeItem::retrieveModelicaMetaType()
{
  if (getDisplayType().isEmpty() || (getDisplayType().compare(Helper::VALUE_OPTIMIZED_OUT) == 0)
      || (getDisplayType().compare(Helper::REPLACEABLE_TYPE_ANY) == 0)) {
    GDBAdapter *pGDBAdapter = mpLocalsTreeModel->getLocalsWidget()->getMainWindow()->getGDBAdapter();
    StackFramesWidget *pStackFramesWidget = mpLocalsTreeModel->getLocalsWidget()->getMainWindow()->getStackFramesWidget();
    if (parent() && parent()->getModelicaValue() && qobject_cast<ModelicaRecordValue*>(parent()->getModelicaValue())) {
      pGDBAdapter->postCommand(CommandFactory::getTypeOfAny(pStackFramesWidget->getSelectedThread(), pStackFramesWidget->getSelectedFrame(),
                                                            getName(), true),
                               GDBAdapter::BlockUntilResponse, this, &GDBAdapter::getTypeOfAnyCB);
    } else {
      pGDBAdapter->postCommand(CommandFactory::getTypeOfAny(pStackFramesWidget->getSelectedThread(), pStackFramesWidget->getSelectedFrame(),
                                                            getName(), false),
                               GDBAdapter::BlockUntilResponse, this, &GDBAdapter::getTypeOfAnyCB);
    }
  } else {
    retrieveValue();
  }
}
Example #6
0
void StackFramesTreeWidget::createFullBacktrace()
{
  QByteArray cmd = CommandFactory::createFullBacktrace();
  GDBAdapter *pGDBAdapter = mpStackFramesWidget->getMainWindow()->getGDBAdapter();
  pGDBAdapter->postCommand(cmd, GDBAdapter::ConsoleCommand, &GDBAdapter::createFullBacktraceCB);
}
Example #7
0
/*
  -stack-list-frames
  ^done,
  stack=[
  frame={level="0",addr="0x00010734",func="callee4",
  file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
  fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="8"},
  frame={level="1",addr="0x0001076c",func="callee3",
  file="../../../devo/gdb/testsuite/gdb.mi/basics.c",
  fullname="/home/foo/bar/devo/gdb/testsuite/gdb.mi/basics.c",line="17"}]
  */
void StackFramesTreeWidget::createStackFrames(GDBMIValue *pGDBMIValue)
{
  /* Clear the StackFramesTreeWidget items */
  clearStackFrames();
  /* create the StackFramesTreeWidget items */
  if(pGDBMIValue->type == GDBMIValue::ListValue) {
    GDBMIResultList::iterator resultListIterator;
    for (resultListIterator = pGDBMIValue->miList->miResultsList.begin(); resultListIterator != pGDBMIValue->miList->miResultsList.end(); ++resultListIterator) {
      GDBMIResult *pGDBMIResult = *resultListIterator;
      if (pGDBMIResult->variable.compare("frame") == 0) {
        QString level, address, function, line, file, fullName;
        if (pGDBMIResult->miValue->type == GDBMIValue::TupleValue) {
          GDBAdapter *pGDBAdapter = mpStackFramesWidget->getMainWindow()->getGDBAdapter();
          GDBMIResultList resultsList = pGDBMIResult->miValue->miTuple->miResultsList;
          level = pGDBAdapter->getGDBMIConstantValue(pGDBAdapter->getGDBMIResult("level", resultsList));
          address = pGDBAdapter->getGDBMIConstantValue(pGDBAdapter->getGDBMIResult("addr", resultsList));
          function = pGDBAdapter->getGDBMIConstantValue(pGDBAdapter->getGDBMIResult("func", resultsList));
          line = pGDBAdapter->getGDBMIConstantValue(pGDBAdapter->getGDBMIResult("line", resultsList));
          file = pGDBAdapter->getGDBMIConstantValue(pGDBAdapter->getGDBMIResult("file", resultsList));
          fullName = pGDBAdapter->getGDBMIConstantValue(pGDBAdapter->getGDBMIResult("fullname", resultsList));
        }
        StackFrameItem *pStackFrameItem = new StackFrameItem(level, address, function, line, file, fullName, this);
        addTopLevelItem(pStackFrameItem);
      }
    }
  }
  /* if we get some frames then make the first enabled one selected and fetch the variables for it. */
  for (int i = 0 ; i < topLevelItemCount() ; i++) {
    if (!topLevelItem(i)->isDisabled()) {
      mpStackFramesWidget->stackItemDoubleClicked(topLevelItem(i));
      return;
    }
  }
  // if there are no stack frames or no enabled stack frames then we need to clear locals browser.
  QList<QVector<QVariant> > locals;
  mpStackFramesWidget->getMainWindow()->getLocalsWidget()->getLocalsTreeModel()->insertLocalsList(locals);
  /* if we reach here we should suspend the debugger. Otherwise the debugger is suspended in GDBAdapter::stackListVariablesCB */
  mpStackFramesWidget->getMainWindow()->getGDBAdapter()->suspendDebugger();
  mpStackFramesWidget->getMainWindow()->getLocalsWidget()->getLocalsTreeProxyModel()->invalidate();
}