コード例 #1
0
void PdbEngine::continueInferior()
{
    resetLocation();
    notifyInferiorRunRequested();
    notifyInferiorRunOk();
    // Callback will be triggered e.g. when breakpoint is hit.
    postCommand("continue", CB(handleUpdateAll));
}
コード例 #2
0
void GdbCoreEngine::setupInferior()
{
    CHECK_STATE(InferiorSetupRequested);
    // Do that first, otherwise no symbols are loaded.
    QFileInfo fi(m_executable);
    QByteArray path = fi.absoluteFilePath().toLocal8Bit();
    postCommand("-file-exec-and-symbols \"" + path + '"', NoFlags,
         CB(handleFileExecAndSymbols));
}
コード例 #3
0
ファイル: readerwriter.c プロジェクト: coyotama/retroshare
ops_parse_cb_return_t
callback_cmd_get_secret_key(const ops_parser_content_t *content_,ops_parse_cb_info_t *cbinfo)
{
	ops_parser_content_union_t* content=(ops_parser_content_union_t *)&content_->content;
	const ops_secret_key_t *secret;
	ops_parser_content_t pc;

	OPS_USED(cbinfo);

	//    ops_print_packet(content_);

	switch(content_->tag)
	{
		case OPS_PARSER_CMD_GET_SECRET_KEY:
			cbinfo->cryptinfo.keydata=ops_keyring_find_key_by_id(cbinfo->cryptinfo.keyring,content->get_secret_key.pk_session_key->key_id);
			if (!cbinfo->cryptinfo.keydata || !ops_is_key_secret(cbinfo->cryptinfo.keydata))
				return 0;

			/* now get the key from the data */
			secret=ops_get_secret_key_from_data(cbinfo->cryptinfo.keydata);
			int tag_to_use = OPS_PARSER_CMD_GET_SK_PASSPHRASE ;
			int nbtries = 0 ;

			while( (!secret) && nbtries++ < 3)
			{
				if (!cbinfo->cryptinfo.passphrase)
				{
					memset(&pc,'\0',sizeof pc);
					pc.content.secret_key_passphrase.passphrase=&cbinfo->cryptinfo.passphrase;
					CB(cbinfo,tag_to_use,&pc);
					if (!cbinfo->cryptinfo.passphrase)
					{
						fprintf(stderr,"can't get passphrase\n");
						assert(0);
					}
				}
				/* then it must be encrypted */
				secret=ops_decrypt_secret_key_from_data(cbinfo->cryptinfo.keydata,cbinfo->cryptinfo.passphrase);

				free(cbinfo->cryptinfo.passphrase) ;
				cbinfo->cryptinfo.passphrase = NULL ;
				tag_to_use = OPS_PARSER_CMD_GET_SK_PASSPHRASE_PREV_WAS_BAD ;
			}

			if(!secret)
				return 0 ;

			*content->get_secret_key.secret_key=secret;
			break;

		default:
			//        return callback_general(content_,cbinfo);
			break;
	}

	return OPS_RELEASE_MEMORY;
}
コード例 #4
0
void GdbCoreEngine::setupInferior()
{
    QTC_ASSERT(state() == InferiorSetupRequested, qDebug() << state());
    // Do that first, otherwise no symbols are loaded.
    QFileInfo fi(m_executable);
    QByteArray path = fi.absoluteFilePath().toLocal8Bit();
    postCommand("-file-exec-and-symbols \"" + path + '"',
         CB(handleFileExecAndSymbols));
}
コード例 #5
0
void PlainGdbAdapter::startInferior()
{
    QTC_ASSERT(state() == InferiorStarting, qDebug() << state());
    if (!startParameters().processArgs.isEmpty())
        m_engine->postCommand(_("-exec-arguments ")
            + startParameters().processArgs.join(_(" ")));
    QFileInfo fi(startParameters().executable);
    m_engine->postCommand(_("-file-exec-and-symbols \"%1\"").arg(fi.absoluteFilePath()),
        CB(handleFileExecAndSymbols));
}
コード例 #6
0
ファイル: gdbplainengine.cpp プロジェクト: Revulet/qtcreator
void GdbPlainEngine::setupInferior()
{
    QTC_ASSERT(state() == InferiorSetupRequested, qDebug() << state());
    if (!startParameters().processArgs.isEmpty()) {
        QString args = startParameters().processArgs;
        postCommand("-exec-arguments " + toLocalEncoding(args));
    }
    postCommand("-file-exec-and-symbols \"" + execFilePath() + '"',
        CB(handleFileExecAndSymbols));
}
コード例 #7
0
ファイル: bplus.c プロジェクト: edisenwang/libmm
int prev_key(ENTRY *pe, IX_DESC *pix)
{
    RECPOS  address;
    pci = pix;
    retrieve_block(pci->level, CB(pci->level));
    prev_entry(CO(pci->level));
    if (CO(pci->level) == -1)
    {
        address = block_ptr->p0;
    }
    else
    {
        address = ENT_ADR(block_ptr, CO(pci->level))->idxptr;
    }

    if (address != NULLREC)
    { 
        do
        {
            retrieve_block(++(pci->level), address);
            address = ENT_ADR(block_ptr, last_entry())->idxptr;
        } while (address != NULLREC);
    }
    if (CO(pci->level) == -1)
    { 
        do
        {
            if(pci->level == 0)
            {
                first_key(pci);
                return (EOIX);
            }
            --(pci->level);

        } while (CO(pci->level) == -1);

        retrieve_block(pci->level, CB(pci->level));
    }
    copy_entry(pe, ENT_ADR(block_ptr, CO(pci->level)));

    return ( IX_OK );
} 
コード例 #8
0
ファイル: gdbplainengine.cpp プロジェクト: DuinoDu/qt-creator
void GdbPlainEngine::setupInferior()
{
    QTC_ASSERT(state() == InferiorSetupRequested, qDebug() << state());
    setEnvironmentVariables();
    if (!runParameters().inferior.commandLineArguments.isEmpty()) {
        QString args = runParameters().inferior.commandLineArguments;
        runCommand({"-exec-arguments " + toLocalEncoding(args), NoFlags});
    }
    runCommand({"-file-exec-and-symbols \"" + execFilePath() + '"', NoFlags,
        CB(handleFileExecAndSymbols)});
}
コード例 #9
0
ファイル: coregdbadapter.cpp プロジェクト: anchowee/QtCreator
void CoreGdbAdapter::setupInferior()
{
    QTC_ASSERT(state() == InferiorSetupRequested, qDebug() << state());
    // Do that first, otherwise no symbols are loaded.
    QFileInfo fi(m_executable);
    const QByteArray sysroot = startParameters().sysroot.toLocal8Bit();
    QByteArray path = fi.absoluteFilePath().toLocal8Bit();
    if (!sysroot.isEmpty())
        m_engine->postCommand("set sysroot " + sysroot);
    m_engine->postCommand("-file-exec-and-symbols \"" + path + '"',
         CB(handleFileExecAndSymbols));
}
コード例 #10
0
void RemoteGdbServerAdapter::callTargetRemote()
{
    //m_breakHandler->clearBreakMarkers();

    // "target remote" does three things:
    //     (1) connects to the gdb server
    //     (2) starts the remote application
    //     (3) stops the remote application (early, e.g. in the dynamic linker)
    QString channel = startParameters().remoteChannel;
    m_engine->postCommand("target remote " + channel.toLatin1(),
        CB(handleTargetRemote));
}
コード例 #11
0
ファイル: reader_armoured.c プロジェクト: G10h4ck/RetroShare
static void flush(dearmour_arg_t *arg,ops_parse_cb_info_t *cbinfo)
    {
    ops_parser_content_t content;

    if(arg->num_unarmoured == 0)
	return;

    content.content.unarmoured_text.data=arg->unarmoured;
    content.content.unarmoured_text.length=arg->num_unarmoured;
    CB(cbinfo,OPS_PTAG_CT_UNARMOURED_TEXT,&content);
    arg->num_unarmoured=0;
    }
コード例 #12
0
ファイル: bplus.c プロジェクト: edisenwang/libmm
static void retrieve_block(int j, RECPOS r)
{
    if (j == 0)
    {
        block_ptr = &(pci->root);
    }
    else  
    {
        get_cache(r);
    }

    CB(j) = block_ptr->brec;
} 
コード例 #13
0
ファイル: zscriptMain.cpp プロジェクト: gwx/ZeldaClassic
GUI::Widget* ZScriptMainDialog::createDialog(const GUI::WidgetFactory& f)
{
    GUI::Window* win=
      f.window("Compile ZScript",
        f.column(GUI::Contents(
          sizeText=f.text(""),
          f.buttonRow(GUI::Contents(
            f.button("&Edit", CB(onEdit)),
            f.button("&Compile", CB(onCompile))
          )),
          f.buttonRow(GUI::Contents(
            f.button("&Import", CB(onImport)),
            f.button("E&xport", CB(onExport))
          )),
          f.button("C&lose", CB(shutDown))
        ))
      );
    
    setSizeText();
    
    return win;
}
コード例 #14
0
ファイル: bplus.c プロジェクト: edisenwang/libmm
/*  get next, previous entries  */
int next_key(ENTRY *pe, IX_DESC *pix)
{
    RECPOS  address;
    if(block_ptr->bend == 0)
    {
        return IX_FAIL;
    }

    pci = pix;
    retrieve_block(pci->level, CB(pci->level));
    address = ENT_ADR(block_ptr, CO(pci->level))->idxptr;
    while (address != NULLREC)
    {
        retrieve_block(++(pci->level), address);
        CO(pci->level) = -1;
        address = block_ptr->p0;
    }
    next_entry(CO(pci->level));
    if (CO(pci->level) == block_ptr->bend)
    {
        do
        { 
            if(pci->level == 0)
            {
                last_key(pci);
                return (EOIX);
            }

            --(pci->level);
            retrieve_block(pci->level, CB(pci->level));
            next_entry(CO(pci->level));

        } while (CO(pci->level) == block_ptr->bend);
    }
    copy_entry(pe, ENT_ADR(block_ptr, CO(pci->level)));

    return ( IX_OK );
} 
コード例 #15
0
ファイル: FuzzerLoop.cpp プロジェクト: UBERLLVM/llvm
void Fuzzer::ExecuteCallback(const uint8_t *Data, size_t Size) {
  // We copy the contents of Unit into a separate heap buffer
  // so that we reliably find buffer overflows in it.
  std::unique_ptr<uint8_t[]> DataCopy(new uint8_t[Size]);
  memcpy(DataCopy.get(), Data, Size);
  AssignTaintLabels(DataCopy.get(), Size);
  CurrentUnitData = DataCopy.get();
  CurrentUnitSize = Size;
  int Res = CB(DataCopy.get(), Size);
  (void)Res;
  assert(Res == 0);
  CurrentUnitData = nullptr;
  CurrentUnitSize = 0;
}
コード例 #16
0
void TermGdbAdapter::setupInferior()
{
    QTC_ASSERT(state() == InferiorSetupRequested, qDebug() << state());
    const qint64 attachedPID = m_stubProc.applicationPID();
#ifdef Q_OS_WIN
    const qint64 attachedMainThreadID = m_stubProc.applicationMainThreadID();
    showMessage(QString::fromLatin1("Attaching to %1 (%2)").arg(attachedPID).arg(attachedMainThreadID), LogMisc);
#else
    showMessage(QString::fromLatin1("Attaching to %1").arg(attachedPID), LogMisc);
#endif
    m_engine->notifyInferiorPid(attachedPID);
    m_engine->postCommand("attach " + QByteArray::number(attachedPID),
        CB(handleStubAttached));
}
コード例 #17
0
void GdbRemoteServerEngine::callTargetRemote()
{
    QByteArray rawChannel = startParameters().remoteChannel.toLatin1();
    QByteArray channel = rawChannel;

    // Don't touch channels with explicitly set protocols.
    if (!channel.startsWith("tcp:") && !channel.startsWith("udp:")
            && !channel.startsWith("file:") && channel.contains(':'))
    {
        // "Fix" the IPv6 case with host names without '['...']'
        if (!channel.startsWith('[') && channel.count(':') >= 2) {
            channel.insert(0, '[');
            channel.insert(channel.lastIndexOf(':'), ']');
        }
        channel = "tcp:" + channel;
    }

    if (m_isQnxGdb)
        postCommand("target qnx " + channel, CB(handleTargetQnx));
    else if (m_isMulti)
        postCommand("target extended-remote " + m_serverChannel, CB(handleTargetExtendedRemote));
    else
        postCommand("target remote " + channel, CB(handleTargetRemote), 10);
}
コード例 #18
0
void RemoteGdbAdapter::startInferior()
{
    QTC_ASSERT(state() == InferiorStarting, qDebug() << state());

    m_engine->postCommand("set architecture "
                          + startParameters().remoteArchitecture.toLatin1());
    m_engine->postCommand("set sysroot "
                          + startParameters().sysRoot.toLocal8Bit());
    m_engine->postCommand("set solib-search-path "
                          + QFileInfo(startParameters().dumperLibrary).path().toLocal8Bit());

    if (!startParameters().processArgs.isEmpty()) {
        QString args = startParameters().processArgs.join(_(" "));
        m_engine->postCommand("-exec-arguments " + args.toLocal8Bit());
    }

    m_engine->postCommand("set target-async on", CB(handleSetTargetAsync));
    QString x = startParameters().executable;
    QFileInfo fi(startParameters().executable);
    QString fileName = fi.absoluteFilePath();
    m_engine->postCommand("-file-exec-and-symbols \""
                          + fileName.toLocal8Bit() + '"',
                          CB(handleFileExecAndSymbols));
}
コード例 #19
0
GUI::Widget* CheatEditor::createDialog(const GUI::WidgetFactory& f)
{
    GUI::Window* win=f.window("Cheat codes",
      f.column(GUI::Contents(
        enabledCB=f.checkbox("Cheats &enabled"),
        f.row(GUI::Contents(f.text("Level 1"), code1=f.textField(40))),
        f.row(GUI::Contents(f.text("Level 2"), code2=f.textField(40))),
        f.row(GUI::Contents(f.text("Level 3"), code3=f.textField(40))),
        f.row(GUI::Contents(f.text("Level 4"), code4=f.textField(40))),
        f.buttonRow(GUI::Contents(
          f.button("O&K", CB(onOK)),
          f.button("&Cancel", CB(shutDown))
        ))
      ))
    );
    
    enabledCB->setValue((zcheats.flags&1)!=0);
    code1->setText(zcheats.codes[0]);
    code2->setText(zcheats.codes[1]);
    code3->setText(zcheats.codes[2]);
    code4->setText(zcheats.codes[3]);
    
    return win;
}
コード例 #20
0
void PdbEngine::insertBreakpoint(BreakpointModelId id)
{
    BreakHandler *handler = breakHandler();
    QTC_CHECK(handler->state(id) == BreakpointInsertRequested);
    handler->notifyBreakpointInsertProceeding(id);

    QByteArray loc;
    if (handler->type(id) == BreakpointByFunction)
        loc = handler->functionName(id).toLatin1();
    else
        loc = handler->fileName(id).toLocal8Bit() + ':'
         + QByteArray::number(handler->lineNumber(id));

    postCommand("break " + loc, CB(handleBreakInsert), QVariant(id));
}
コード例 #21
0
ファイル: bplus.c プロジェクト: edisenwang/libmm
/*  position at start/end of index  */
int first_key(IX_DESC *pix)
{
    pci = pix;
    block_ptr = &(pci->root);
    CB(0) = 0L;
    CO(0) = -1;
    pci->level = 0;

    while(block_ptr->p0 != NULLREC)
    {
        retrieve_block(++(pci->level), block_ptr->p0);
        CO(pci->level) = -1;
    }

    return (IX_OK);
} 
コード例 #22
0
void RemoteGdbServerAdapter::interruptInferior()
{
    QTC_ASSERT(state() == InferiorStopRequested, qDebug() << state());
    if (debuggerCore()->boolSetting(TargetAsync)) {
        m_engine->postCommand("-exec-interrupt", GdbEngine::Immediate,
            CB(handleInterruptInferior));
    } else {
        bool ok = m_gdbProc.interrupt();
        if (!ok) {
            // FIXME: Extra state needed?
            m_engine->showMessage(_("NOTE: INFERIOR STOP NOT POSSIBLE"));
            m_engine->showStatusMessage(tr("Interrupting not possible"));
            m_engine->notifyInferiorRunOk();
        }
    }
}
コード例 #23
0
void CoreGdbAdapter::setupInferior()
{
    QTC_ASSERT(state() == InferiorSetupRequested, qDebug() << state());
    // Do that first, otherwise no symbols are loaded.
    QFileInfo fi(m_executable);
    const QByteArray sysroot = startParameters().sysroot.toLocal8Bit();
    QByteArray path = fi.absoluteFilePath().toLocal8Bit();
    if (!sysroot.isEmpty()) {
        m_engine->postCommand("set sysroot " + sysroot);
        // sysroot is not enough to correctly locate the sources, so explicitly
        // relocate the most likely place for the debug source
        m_engine->postCommand("set substitute-path /usr/src " + sysroot + "/usr/src");
    }
    m_engine->postCommand("-file-exec-and-symbols \"" + path + '"',
         CB(handleFileExecAndSymbols));
}
コード例 #24
0
void GdbCoreEngine::handleTargetCore(const DebuggerResponse &response)
{
    CHECK_STATE(EngineRunRequested);
    notifyEngineRunOkAndInferiorUnrunnable();
    if (response.resultClass == ResultDone) {
        showMessage(tr("Attached to core."), StatusBar);
        // Due to the auto-solib-add off setting, we don't have any
        // symbols yet. Load them in order of importance.
        reloadStack();
        reloadModulesInternal();
        postCommand("p 5", NoFlags, CB(handleRoundTrip));
        return;
    }
    showStatusMessage(tr("Attach to core \"%1\" failed:").arg(runParameters().coreFile)
        + QLatin1Char('\n') + QString::fromLocal8Bit(response.data["msg"].data()));
    notifyEngineIll();
}
コード例 #25
0
ファイル: FuzzerLoop.cpp プロジェクト: afesteves/llvm
void Fuzzer::ExecuteCallback(const uint8_t *Data, size_t Size) {
  UnitStartTime = system_clock::now();
  // We copy the contents of Unit into a separate heap buffer
  // so that we reliably find buffer overflows in it.
  std::unique_ptr<uint8_t[]> DataCopy(new uint8_t[Size]);
  memcpy(DataCopy.get(), Data, Size);
  AssignTaintLabels(DataCopy.get(), Size);
  CurrentUnitData = DataCopy.get();
  CurrentUnitSize = Size;
  AllocTracer.Start();
  int Res = CB(DataCopy.get(), Size);
  (void)Res;
  HasMoreMallocsThanFrees = AllocTracer.Stop();
  CurrentUnitSize = 0;
  CurrentUnitData = nullptr;
  assert(Res == 0);
}
コード例 #26
0
ファイル: fileHighlevel.c プロジェクト: nobled/executor
PUBLIC OSErr
HOpenRF (INTEGER vref, LONGINT dirid, Str255 name, SignedByte perm,
         INTEGER *refp)
{
    HParamBlockRec hpb;
    OSErr retval;

    hpb.fileParam.ioNamePtr = RM (name);
    hpb.fileParam.ioVRefNum = CW (vref);
    hpb.ioParam.ioPermssn = CB (perm);
    hpb.ioParam.ioMisc = CLC (0);
    hpb.fileParam.ioDirID = CL (dirid);
    retval = PBHOpenRF (&hpb, FALSE);
    if (retval == noErr)
        *refp = CW (hpb.ioParam.ioRefNum);
    return retval;
}
コード例 #27
0
void testArithmetic(std::string const & filename)
{
	::libmaus::autoarray::AutoArray<uint8_t> data = ::libmaus::util::GetFileSize::readFile(filename);
	unsigned int const alph = 8;
	for ( uint64_t i = 0; i < data.size(); ++i )
		data[i] &= (alph-1);

	::libmaus::timing::RealTimeClock rtc; rtc.start();

	typedef ::libmaus::bitio::BitWriterVector8 bw_type;
	std::vector < uint8_t > VV;
	std::back_insert_iterator< std::vector < uint8_t > > it(VV);
	bw_type CB(it);

	unsigned int const loops = 3;
	
	for ( uint64_t z = 0; z < loops; ++z )
		encodeFileArithmetic(data,alph,CB);

	typedef ::libmaus::bitio::IteratorBitInputStream< std::vector<uint8_t>::const_iterator, true > br_type;
	br_type CR(VV.begin(),VV.end());

	for ( uint64_t z = 0; z < loops; ++z )
	{
		rtc.start();	
		::libmaus::arithmetic::ArithmeticDecoder < br_type > AD (CR);
		model_type MD(alph);
	
		::libmaus::autoarray::AutoArray<uint8_t> ddata(data.size(),false);
		for ( uint64_t i = 0; i < data.size(); ++i )
			ddata[i] = AD.decodeUpdate(MD);
		AD.flush(true /* read end marker */);
			
		std::cerr << "Decoded in " << rtc.getElapsedSeconds() << " s, "
			<< 1./(rtc.getElapsedSeconds()/data.size());

		bool ok = true;
		for ( uint64_t i = 0; i < data.size(); ++i )
			ok = ok && (data[i] == ddata[i]);
			
		std::cout << " " << (ok ? "ok" : "failed") << std::endl;
	}

	std::cerr << static_cast<double>(loops*data.size()) / VV.size() << std::endl;

}
コード例 #28
0
void PlainGdbAdapter::handleFileExecAndSymbols(const GdbResponse &response)
{
    QTC_ASSERT(state() == InferiorStarting, qDebug() << state());
    if (response.resultClass == GdbResultDone) {
#ifdef Q_OS_LINUX
        // Old gdbs do not announce the PID for programs without pthreads.
        // Note that successfully preloading the debugging helpers will
        // automatically load pthreads, so this will be unnecessary.
        if (m_engine->m_gdbVersion < 70000)
            m_engine->postCommand(_("info target"), CB(handleInfoTarget));
#endif
        emit inferiorPrepared();
    } else {
        QString msg = tr("Starting executable failed:\n") +
            QString::fromLocal8Bit(response.data.findChild("msg").data());
        emit inferiorStartFailed(msg);
    }
}
コード例 #29
0
ファイル: bplus.c プロジェクト: edisenwang/libmm
int last_key(IX_DESC *pix)
{
    long  ads;
    pci = pix;
    block_ptr = &(pci->root);
    CB(0) = 0L;
    pci->level = 0;
    if(last_entry() >= 0)
    {
        while ((ads = ENT_ADR(block_ptr,last_entry())->idxptr) != NULLREC)
        {
            retrieve_block(++(pci->level), ads);
        }
    }
    CO(pci->level) = block_ptr->bend;

    return ( IX_OK );
} 
コード例 #30
0
ファイル: coregdbadapter.cpp プロジェクト: anchowee/QtCreator
void CoreGdbAdapter::startAdapter()
{
    QTC_ASSERT(state() == EngineSetupRequested, qDebug() << state());
    showMessage(_("TRYING TO START ADAPTER"));

    QStringList args;
    args.append(_("-ex"));
    args.append(_("set auto-solib-add off"));
    if (!m_engine->startGdb(args, QString()))
        return;

    //if (m_executable.isEmpty()) {
    //    showMessageBox(QMessageBox::Warning,
    //        tr("Error Loading Symbols"),
    //        tr("No executable to load symbols from specified."));
    //}

#ifdef Q_OS_LINUX
    const bool canUseExeFromCore = true;
#else
    const bool canUseExeFromCore = false;
#endif

    if (!m_executable.isEmpty()) {
        m_engine->notifyEngineSetupOk();
    } else if (canUseExeFromCore) {
        // Extra round trip to get executable name from core file.
        // This is sometimes not the full name, so it can't be used
        // as the generic solution.

        // Quoting core name below fails in gdb 6.8-debian.
        m_engine->postCommand("target core " + m_coreName,
            CB(handleTemporaryTargetCore));
    } else {
        QString msg = tr("The name of the binary file cannot be extracted "
            "from this core file.");
        msg += _(" ");
        msg += tr("Try to specify the binary using the "
            "<i>Debug->Start Debugging->Attach to Core</i> dialog.");
        showMessageBox(QMessageBox::Warning,
            tr("Loading core file failed"), msg);
        m_engine->notifyEngineSetupFailed();
    }
}