int DebuggerProxy::getStackDepth() { TRACE(2, "DebuggerProxy::getStackDepth\n"); int depth = 0; auto fp = vmfp(); if (!fp) return 0; fp = fp->sfp(); while (fp) { fp = fp->sfp(); depth++; } return depth; }
void AbiCollab::_shutdownAsMaster() { UT_DEBUGMSG(("AbiCollab::_shutdownAsMaster()\n")); UT_return_if_fail(m_pController == BuddyPtr()); UT_return_if_fail(!m_bProposedController); AbiCollabSessionManager* pManager = AbiCollabSessionManager::getManager(); UT_return_if_fail(pManager); // the session takeover is complete; inform everyone that all session data // is flushed, and that everyone should talk to the new master from now on SessionFlushedPacket sfp(m_sId, m_pDoc->getDocUUIDString()); for (std::map<BuddyPtr, std::string>::iterator it = m_vCollaborators.begin(); it != m_vCollaborators.end(); it++) { BuddyPtr pBuddy = (*it).first; UT_continue_if_fail(pBuddy); pBuddy->getHandler()->send(&sfp, pBuddy); } // session takeover is done as far as the leaving session contoller is concerned pManager->endAsyncOperation(this); }
int main(int argc, char *argv[]) { int rv; char *full; if (argc != 3) { fprintf(stderr, "usage:\n" " sbsnarf full-path-to-sb output-bytecode-file\n\n"); return -1; } full = realpath(argv[1], NULL); printf("[+] full path to sb: \"%s\"\n", full); void *h = dlopen("libsandbox.1.dylib", RTLD_FIRST | RTLD_LAZY | RTLD_LOCAL); if (NULL == h) { errx(-1, "dlopen failed: %s", dlerror()); } void *(*scf)(char *, int, char **) = dlsym(h, "sandbox_compile_file"); if (NULL == scf) { errx(-1, "dlsym failed: %s", dlerror()); } void (*sfp)(void *) = dlsym(h, "sandbox_free_profile"); if (NULL == sfp) { errx(-1, "dlsym failed: %s", dlerror()); } char *error; struct { unsigned int type; user_addr_t bytecode; user_size_t bytecode_length; } *sb = scf(full, 0, &error); if (NULL == sb) { dlclose(h); errx(-1, "sandbox_compile_file failed: %s", error); } if (NULL != error) { free(error); } FILE *f_out = fopen(argv[2], "wb"); if (NULL == f_out) { sfp(sb); dlclose(h); err(-1, "fopen failed:"); } rv = fwrite((void *) sb->bytecode, sb->bytecode_length, 1, f_out); if (1 != rv) { sfp(sb); dlclose(h); err(-1, "fwrite failed:"); } fclose(f_out); sfp(sb); dlclose(h); printf("[+] success!\n"); return 0; }
PWIZ_API_DECL void initializeTiny(MSData& msd) { msd.id = "urn:lsid:psidev.info:mzML.instanceDocuments.tiny.pwiz"; // cvList msd.cvs = defaultCVList(); // fileDescription FileContent& fc = msd.fileDescription.fileContent; fc.set(MS_MSn_spectrum); fc.set(MS_centroid_spectrum); SourceFilePtr sfp(new SourceFile); sfp->id = "tiny1.yep"; sfp->name = "tiny1.yep"; sfp->location = "file://*****:*****@higglesworth.edu"); // paramGroupList ParamGroupPtr pg1(new ParamGroup); pg1->id = "CommonMS1SpectrumParams"; pg1->set(MS_MS1_spectrum); pg1->set(MS_positive_scan); msd.paramGroupPtrs.push_back(pg1); ParamGroupPtr pg2(new ParamGroup); pg2->id = "CommonMS2SpectrumParams"; pg2->set(MS_MSn_spectrum); pg2->set(MS_negative_scan); msd.paramGroupPtrs.push_back(pg2); // sampleList SamplePtr samplePtr(new Sample); samplePtr->id = "20090101 - Sample 1"; samplePtr->name = "Sample 1"; msd.samplePtrs.push_back(samplePtr); // instrumentConfigurationList InstrumentConfigurationPtr instrumentConfigurationPtr(new InstrumentConfiguration("LCQ Deca")); instrumentConfigurationPtr->set(MS_LCQ_Deca); instrumentConfigurationPtr->set(MS_instrument_serial_number,"23433"); instrumentConfigurationPtr->componentList.push_back(Component(MS_nanoelectrospray, 1)); instrumentConfigurationPtr->componentList.push_back(Component(MS_quadrupole_ion_trap, 2)); instrumentConfigurationPtr->componentList.push_back(Component(MS_electron_multiplier, 3)); SoftwarePtr softwareCompassXtract(new Software); softwareCompassXtract->id = "CompassXtract"; softwareCompassXtract->set(MS_CompassXtract); softwareCompassXtract->version = "2.0.5"; instrumentConfigurationPtr->softwarePtr = softwareCompassXtract; msd.instrumentConfigurationPtrs.push_back(instrumentConfigurationPtr); // softwareList SoftwarePtr softwareBioworks(new Software); softwareBioworks->id = "Bioworks"; softwareBioworks->set(MS_Bioworks); softwareBioworks->version = "3.3.1 sp1"; SoftwarePtr softwarepwiz(new Software); softwarepwiz->id = "pwiz"; softwarepwiz->set(MS_pwiz); softwarepwiz->version = "1.0"; msd.softwarePtrs.push_back(softwareBioworks); msd.softwarePtrs.push_back(softwarepwiz); msd.softwarePtrs.push_back(softwareCompassXtract); // dataProcessingList DataProcessingPtr dpCompassXtract(new DataProcessing); dpCompassXtract->id = "CompassXtract processing"; ProcessingMethod procCXT; procCXT.order = 1; procCXT.softwarePtr = softwareCompassXtract; procCXT.set(MS_deisotoping); procCXT.set(MS_charge_deconvolution); procCXT.set(MS_peak_picking); dpCompassXtract->processingMethods.push_back(procCXT); DataProcessingPtr dppwiz(new DataProcessing("pwiz_processing")); ProcessingMethod procpwiz; procpwiz.order = 2; procpwiz.softwarePtr = softwarepwiz; procpwiz.set(MS_Conversion_to_mzML); dppwiz->processingMethods.push_back(procpwiz); msd.dataProcessingPtrs.push_back(dpCompassXtract); //msd.dataProcessingPtrs.push_back(dppwiz); ScanSettingsPtr as1(new ScanSettings("tiny scan settings")); as1->sourceFilePtrs.push_back(sfp_parameters); Target t1; t1.set(MS_selected_ion_m_z, 1000, MS_m_z); Target t2; t2.set(MS_selected_ion_m_z, 1200, MS_m_z); as1->targets.push_back(t1); as1->targets.push_back(t2); msd.scanSettingsPtrs.push_back(as1); // run msd.run.id = "Experiment 1"; msd.run.defaultInstrumentConfigurationPtr = instrumentConfigurationPtr; msd.run.samplePtr = samplePtr; msd.run.startTimeStamp = "2007-06-27T15:23:45.00035"; msd.run.defaultSourceFilePtr = sfp; shared_ptr<SpectrumListSimple> spectrumList(new SpectrumListSimple); msd.run.spectrumListPtr = spectrumList; spectrumList->dp = dppwiz; spectrumList->spectra.push_back(SpectrumPtr(new Spectrum)); spectrumList->spectra.push_back(SpectrumPtr(new Spectrum)); spectrumList->spectra.push_back(SpectrumPtr(new Spectrum)); spectrumList->spectra.push_back(SpectrumPtr(new Spectrum)); spectrumList->spectra.push_back(SpectrumPtr(new Spectrum)); Spectrum& s19 = *spectrumList->spectra[0]; s19.id = "scan=19"; s19.index = 0; s19.set(MS_ms_level, 1); s19.set(MS_centroid_spectrum); s19.set(MS_lowest_observed_m_z, 400.39, MS_m_z); s19.set(MS_highest_observed_m_z, 1795.56, MS_m_z); s19.set(MS_base_peak_m_z, 445.347, MS_m_z); s19.set(MS_base_peak_intensity, 120053, MS_number_of_detector_counts); s19.set(MS_total_ion_current, 1.66755e+007); s19.paramGroupPtrs.push_back(pg1); s19.scanList.scans.push_back(Scan()); s19.scanList.set(MS_no_combination); Scan& s19scan = s19.scanList.scans.back(); s19scan.instrumentConfigurationPtr = instrumentConfigurationPtr; s19scan.set(MS_scan_start_time, 5.890500, UO_minute); s19scan.set(MS_filter_string, "+ c NSI Full ms [ 400.00-1800.00]"); s19scan.set(MS_preset_scan_configuration, 3); s19scan.scanWindows.resize(1); ScanWindow& window = s19.scanList.scans.back().scanWindows.front(); window.set(MS_scan_window_lower_limit, 400.000000, MS_m_z); window.set(MS_scan_window_upper_limit, 1800.000000, MS_m_z); BinaryDataArrayPtr s19_mz(new BinaryDataArray); s19_mz->dataProcessingPtr = dpCompassXtract; s19_mz->set(MS_m_z_array, "", MS_m_z); s19_mz->data.resize(15); for (int i=0; i<15; i++) s19_mz->data[i] = i; BinaryDataArrayPtr s19_intensity(new BinaryDataArray); s19_intensity->dataProcessingPtr = dpCompassXtract; s19_intensity->set(MS_intensity_array, "", MS_number_of_detector_counts); s19_intensity->data.resize(15); for (int i=0; i<15; i++) s19_intensity->data[i] = 15-i; s19.binaryDataArrayPtrs.push_back(s19_mz); s19.binaryDataArrayPtrs.push_back(s19_intensity); s19.defaultArrayLength = s19_mz->data.size(); Spectrum& s20 = *spectrumList->spectra[1]; s20.id = "scan=20"; s20.index = 1; s20.paramGroupPtrs.push_back(pg2); s20.set(MS_ms_level, 2); s20.set(MS_profile_spectrum); s20.set(MS_lowest_observed_m_z, 320.39, MS_m_z); s20.set(MS_highest_observed_m_z, 1003.56, MS_m_z); s20.set(MS_base_peak_m_z, 456.347, MS_m_z); s20.set(MS_base_peak_intensity, 23433, MS_number_of_detector_counts); s20.set(MS_total_ion_current, 1.66755e+007); s20.precursors.resize(1); Precursor& precursor = s20.precursors.front(); precursor.spectrumID= s19.id; precursor.isolationWindow.set(MS_isolation_window_target_m_z, 445.3, MS_m_z); precursor.isolationWindow.set(MS_isolation_window_lower_offset, .5, MS_m_z); precursor.isolationWindow.set(MS_isolation_window_upper_offset, .5, MS_m_z); precursor.selectedIons.resize(1); precursor.selectedIons[0].set(MS_selected_ion_m_z, 445.34, MS_m_z); precursor.selectedIons[0].set(MS_peak_intensity, 120053, MS_number_of_detector_counts); precursor.selectedIons[0].set(MS_charge_state, 2); precursor.activation.set(MS_collision_induced_dissociation); precursor.activation.set(MS_collision_energy, 35.00, UO_electronvolt); s20.scanList.scans.push_back(Scan()); s20.scanList.set(MS_no_combination); Scan& s20scan = s20.scanList.scans.back(); s20scan.instrumentConfigurationPtr = instrumentConfigurationPtr; s20scan.set(MS_scan_start_time, 5.990500, UO_minute); s20scan.set(MS_filter_string, "+ c d Full ms2 [email protected] [ 110.00-905.00]"); s20scan.set(MS_preset_scan_configuration, 4); s20scan.scanWindows.resize(1); ScanWindow& window2 = s20scan.scanWindows.front(); window2.set(MS_scan_window_lower_limit, 110.000000, MS_m_z); window2.set(MS_scan_window_upper_limit, 905.000000, MS_m_z); BinaryDataArrayPtr s20_mz(new BinaryDataArray); s20_mz->dataProcessingPtr = dpCompassXtract; s20_mz->set(MS_m_z_array, "", MS_m_z); s20_mz->data.resize(10); for (int i=0; i<10; i++) s20_mz->data[i] = i*2; BinaryDataArrayPtr s20_intensity(new BinaryDataArray); s20_intensity->dataProcessingPtr = dpCompassXtract; s20_intensity->set(MS_intensity_array, "", MS_number_of_detector_counts); s20_intensity->data.resize(10); for (int i=0; i<10; i++) s20_intensity->data[i] = (10-i)*2; s20.binaryDataArrayPtrs.push_back(s20_mz); s20.binaryDataArrayPtrs.push_back(s20_intensity); s20.defaultArrayLength = s20_mz->data.size(); // spectrum with no data Spectrum& s21 = *spectrumList->spectra[2]; s21.id = "scan=21"; s21.index = 2; s21.paramGroupPtrs.push_back(pg1); s21.set(MS_ms_level, 1); s21.set(MS_centroid_spectrum); s21.userParams.push_back(UserParam("example", "spectrum with no data")); s21.setMZIntensityArrays(vector<double>(), vector<double>(), MS_number_of_detector_counts); s21.scanList.scans.push_back(Scan()); s21.scanList.scans.back().instrumentConfigurationPtr = instrumentConfigurationPtr; s21.scanList.set(MS_no_combination); // Cover ETD, ETD+SA, and ECD precursor activation mode usage Spectrum& s22 = *spectrumList->spectra[3]; s22.id = "scan=22"; s22.index = 3; s22.paramGroupPtrs.push_back(pg2); s22.set(MS_ms_level, 2); s22.set(MS_profile_spectrum); s22.set(MS_lowest_observed_m_z, 320.39, MS_m_z); s22.set(MS_highest_observed_m_z, 1003.56, MS_m_z); s22.set(MS_base_peak_m_z, 456.347, MS_m_z); s22.set(MS_base_peak_intensity, 23433, MS_number_of_detector_counts); s22.set(MS_total_ion_current, 1.66755e+007); s22.precursors.resize(1); Precursor& precursor22 = s22.precursors.front(); precursor22.spectrumID= s19.id; precursor22.isolationWindow.set(MS_isolation_window_target_m_z, 545.3, MS_m_z); precursor22.isolationWindow.set(MS_isolation_window_lower_offset, .5, MS_m_z); precursor22.isolationWindow.set(MS_isolation_window_upper_offset, .5, MS_m_z); precursor22.selectedIons.resize(1); precursor22.selectedIons[0].set(MS_selected_ion_m_z, 545.34, MS_m_z); precursor22.selectedIons[0].set(MS_peak_intensity, 120053, MS_number_of_detector_counts); precursor22.selectedIons[0].set(MS_charge_state, 2); precursor22.activation.set(MS_ETD); precursor22.activation.set(MS_CID); precursor22.activation.set(MS_collision_energy, 60.00, UO_electronvolt); s22.scanList.scans.push_back(Scan()); s22.scanList.set(MS_no_combination); Scan& s22scan = s22.scanList.scans.back(); s22scan.instrumentConfigurationPtr = instrumentConfigurationPtr; s22scan.set(MS_scan_start_time, 6.5, UO_minute); s22scan.set(MS_filter_string, "+ c d Full ms2 [email protected] [ 110.00-905.00]"); s22scan.set(MS_preset_scan_configuration, 4); s22scan.scanWindows.resize(1); window2 = s22scan.scanWindows.front(); window2.set(MS_scan_window_lower_limit, 110.000000, MS_m_z); window2.set(MS_scan_window_upper_limit, 905.000000, MS_m_z); BinaryDataArrayPtr s22_mz(new BinaryDataArray); s22_mz->dataProcessingPtr = dpCompassXtract; s22_mz->set(MS_m_z_array, "", MS_m_z); s22_mz->data.resize(10); for (int i=0; i<10; i++) s22_mz->data[i] = i*2; BinaryDataArrayPtr s22_intensity(new BinaryDataArray); s22_intensity->dataProcessingPtr = dpCompassXtract; s22_intensity->set(MS_intensity_array, "", MS_number_of_detector_counts); s22_intensity->data.resize(10); for (int i=0; i<10; i++) s22_intensity->data[i] = (10-i)*2; s22.binaryDataArrayPtrs.push_back(s22_mz); s22.binaryDataArrayPtrs.push_back(s22_intensity); s22.defaultArrayLength = s22_mz->data.size(); // spectrum with MALDI spot information Spectrum& s23 = *spectrumList->spectra[4]; s23.id = "sample=1 period=1 cycle=23 experiment=1"; s23.index = 4; s23.spotID = "A1,42x42,4242x4242"; s23.sourceFilePtr = sfp2; s23.set(MS_ms_level, 1); s23.set(MS_centroid_spectrum); s23.set(MS_lowest_observed_m_z, 142.39, MS_m_z); s23.set(MS_highest_observed_m_z, 942.56, MS_m_z); s23.set(MS_base_peak_m_z, 422.42, MS_m_z); s23.set(MS_base_peak_intensity, 42, MS_number_of_detector_counts); s23.set(MS_total_ion_current, 4200); s23.userParams.push_back(UserParam("alternate source file", "to test a different nativeID format")); s23.paramGroupPtrs.push_back(pg1); s23.scanList.scans.push_back(Scan()); s23.scanList.set(MS_no_combination); Scan& s23scan = s23.scanList.scans.back(); s23scan.instrumentConfigurationPtr = instrumentConfigurationPtr; s23scan.set(MS_scan_start_time, 42.0500, UO_second); s23scan.set(MS_filter_string, "+ c MALDI Full ms [100.00-1000.00]"); s23scan.scanWindows.resize(1); ScanWindow& window3 = s23scan.scanWindows.front(); window3.set(MS_scan_window_lower_limit, 100.000000, MS_m_z); window3.set(MS_scan_window_upper_limit, 1000.000000, MS_m_z); s23.binaryDataArrayPtrs.push_back(s19_mz); s23.binaryDataArrayPtrs.push_back(s19_intensity); s23.defaultArrayLength = s19_mz->data.size(); // chromatograms shared_ptr<ChromatogramListSimple> chromatogramList(new ChromatogramListSimple); msd.run.chromatogramListPtr = chromatogramList; chromatogramList->dp = dppwiz; chromatogramList->chromatograms.push_back(ChromatogramPtr(new Chromatogram)); chromatogramList->chromatograms.push_back(ChromatogramPtr(new Chromatogram)); Chromatogram& tic = *chromatogramList->chromatograms[0]; tic.id = "tic"; tic.index = 0; tic.defaultArrayLength = 15; tic.dataProcessingPtr = dpCompassXtract; tic.set(MS_total_ion_current_chromatogram); BinaryDataArrayPtr tic_time(new BinaryDataArray); tic_time->dataProcessingPtr = dppwiz; tic_time->set(MS_time_array, "", UO_second); tic_time->data.resize(15); for (int i=0; i<15; i++) tic_time->data[i] = i; BinaryDataArrayPtr tic_intensity(new BinaryDataArray); tic_intensity->dataProcessingPtr = dppwiz; tic_intensity->set(MS_intensity_array, "", MS_number_of_detector_counts); tic_intensity->data.resize(15); for (int i=0; i<15; i++) tic_intensity->data[i] = 15-i; tic.binaryDataArrayPtrs.push_back(tic_time); tic.binaryDataArrayPtrs.push_back(tic_intensity); Chromatogram& sic = *chromatogramList->chromatograms[1]; sic.id = "sic"; sic.index = 1; sic.defaultArrayLength = 10; sic.dataProcessingPtr = dppwiz; sic.set(MS_selected_ion_current_chromatogram); sic.precursor.isolationWindow.set(MS_isolation_window_target_m_z, 456.7, MS_m_z); sic.precursor.activation.set(MS_CID); sic.product.isolationWindow.set(MS_isolation_window_target_m_z, 678.9, MS_m_z); BinaryDataArrayPtr sic_time(new BinaryDataArray); sic_time->dataProcessingPtr = dppwiz; sic_time->set(MS_time_array, "", UO_second); sic_time->data.resize(10); for (int i=0; i<10; i++) sic_time->data[i] = i; BinaryDataArrayPtr sic_intensity(new BinaryDataArray); sic_intensity->dataProcessingPtr = dppwiz; sic_intensity->set(MS_intensity_array, "", MS_number_of_detector_counts); sic_intensity->data.resize(10); for (int i=0; i<10; i++) sic_intensity->data[i] = 10-i; sic.binaryDataArrayPtrs.push_back(sic_time); sic.binaryDataArrayPtrs.push_back(sic_intensity); } // initializeTiny()
PRIVATE inline L4_msg_tag Thread_object::sys_vcpu_resume(L4_msg_tag const &tag, Utcb *utcb) { if (this != current() || !(state() & Thread_vcpu_enabled)) return commit_result(-L4_err::EInval); Space *s = space(); Vcpu_state *vcpu = vcpu_state().access(true); L4_obj_ref user_task = vcpu->user_task; if (user_task.valid()) { L4_fpage::Rights task_rights = L4_fpage::Rights(0); Task *task = Kobject::dcast<Task*>(s->lookup_local(user_task.cap(), &task_rights)); if (EXPECT_FALSE(task && !(task_rights & L4_fpage::Rights::W()))) return commit_result(-L4_err::EPerm); if (task != vcpu_user_space()) vcpu_set_user_space(task); vcpu->user_task = L4_obj_ref(); } else if (user_task.op() == L4_obj_ref::Ipc_reply) vcpu_set_user_space(0); L4_snd_item_iter snd_items(utcb, tag.words()); int items = tag.items(); if (vcpu_user_space()) for (; items && snd_items.more(); --items) { if (EXPECT_FALSE(!snd_items.next())) break; Lock_guard<Lock> guard; if (!guard.check_and_lock(&static_cast<Task *>(vcpu_user_space())->existence_lock)) return commit_result(-L4_err::ENoent); cpu_lock.clear(); L4_snd_item_iter::Item const *const item = snd_items.get(); L4_fpage sfp(item->d); Reap_list rl; L4_error err = fpage_map(space(), sfp, vcpu_user_space(), L4_fpage::all_spaces(), item->b, &rl); rl.del(); cpu_lock.lock(); if (EXPECT_FALSE(!err.ok())) return commit_error(utcb, err); } if ((vcpu->_saved_state & Vcpu_state::F_irqs) && (vcpu->sticky_flags & Vcpu_state::Sf_irq_pending)) { assert_kdb(cpu_lock.test()); do_ipc(L4_msg_tag(), 0, 0, true, 0, L4_timeout_pair(L4_timeout::Zero, L4_timeout::Zero), &vcpu->_ipc_regs, L4_fpage::Rights::FULL()); vcpu = vcpu_state().access(true); if (EXPECT_TRUE(!vcpu->_ipc_regs.tag().has_error() || this->utcb().access(true)->error.error() == L4_error::R_timeout)) { vcpu->_ts.set_ipc_upcall(); Address sp; // tried to resume to user mode, so an IRQ enters from user mode if (vcpu->_saved_state & Vcpu_state::F_user_mode) sp = vcpu->_entry_sp; else sp = vcpu->_ts.sp(); arch_load_vcpu_kern_state(vcpu, true); LOG_TRACE("VCPU events", "vcpu", this, Vcpu_log, l->type = 4; l->state = vcpu->state; l->ip = vcpu->_entry_ip; l->sp = sp; l->space = static_cast<Task*>(_space.vcpu_aware())->dbg_id(); );