void sub2() { int i ; char* a ; char x[20] ; spray_paint( (char *) &i, sizeof(i), 0xf1, "sub2.i" ) ; spray_paint( (char *) &a, sizeof(a), 0xf2, "sub2.a" ) ; spray_paint( (char *) &x, sizeof(x), 0xf3, "sub2.x" ) ; printf ( "Min= %p Max= %p\n", min_ptr, max_ptr ) ; dumper( min_ptr,(int) (max_ptr-min_ptr)/16+1 ) ; // // save/destroy the stack here (don't forget to use an external save area) // z=(char *) malloc(max_ptr-min_ptr+1); for (m=0;m<max_ptr-min_ptr+1;m++) *(z+m)=*(min_ptr+m); for (m=0;m<max_ptr-min_ptr+1;m++) *(min_ptr+m)=00; printf( " destroyed stack\n" ) ; dumper( min_ptr,(int) (max_ptr-min_ptr)/16+1 ) ; // // restore the stack here // for (m=0;m<max_ptr-min_ptr+1;m++) *(min_ptr+m)=*(z+m); printf( " restored stack\n" ) ; dumper( min_ptr,(int) (max_ptr-min_ptr)/16+1 ) ; free(z); }
void dump_desc(pst_desc_tree *ptr) { while (ptr) { DEBUG_INFO(("\n\n\nLooking at block desc id %#"PRIx64"\n", ptr->d_id)); if (ptr->desc && ptr->desc->i_id) dumper(ptr->desc->i_id); if (ptr->assoc_tree && ptr->assoc_tree->i_id) dumper(ptr->assoc_tree->i_id); if (ptr->child) dump_desc(ptr->child); ptr = ptr->next; } }
void dump_desc(pst_desc_tree *ptr, pst_desc_tree *parent) { while (ptr) { uint64_t parent_d_id = (parent) ? parent->d_id : 0; printf("Descriptor block d_id %#"PRIx64" parent d_id %#"PRIx64" children %i desc.i_id=%#"PRIx64", assoc tree.i_id=%#"PRIx64"\n", ptr->d_id, parent_d_id, ptr->no_child, (ptr->desc ? ptr->desc->i_id : (uint64_t)0), (ptr->assoc_tree ? ptr->assoc_tree->i_id : (uint64_t)0)); if (ptr->desc && ptr->desc->i_id) dumper(ptr->desc->i_id); if (ptr->assoc_tree && ptr->assoc_tree->i_id) dumper(ptr->assoc_tree->i_id); if (ptr->child) dump_desc(ptr->child, ptr); ptr = ptr->next; } }
int main() { setter(); saver(); clearer(); start_counter(); loader(); stop_counter(); dumper(); clearer(); start_counter(); loader_mem(); stop_counter(); dumper(); }
int main(int argc, char* argv[]) { if (argc != 3) { std::cout << "Input file name and target directory must be specified" << std::endl; return EXIT_FAILURE; } Matrix<uint> matrix (2, 4); FrameOrganizer myorg("myorganizer", 100); FrameExtractor frameex(argv[1], &myorg); list<string> sub_list; sub_list.push_back(argv[1]); GaussianBlur myblur(1, 1, 1, "blurid", sub_list, &myorg); list<string> sub_list_2; sub_list_2.push_back("blurid"); FrameDumper dumper(argv[2], "mdetect", "dumpertest", sub_list_2, &myorg); myorg.finalize(); myorg.initWriters(); myorg.initReaders(); myorg.startWriters(); return EXIT_SUCCESS; }
void EVECollectDispatcher::Handle_Other(PyPacket **in_packet) { PyPacket *packet = *in_packet; *in_packet = NULL; //everything else... if(is_log_enabled(COLLECT__CALL_DUMP)) { //semi-hack: if we are dumping general stuff, dump the misc packets directly. //decode substreams to facilitate dumping better: SubStreamDecoder v; packet->payload->visit(&v); _log(COLLECT__OTHER_DUMP, "Misc Packet:"); packet->source.Dump(COLLECT__PACKET_SRC, " Src: "); packet->dest.Dump(COLLECT__PACKET_DEST, " Dest: "); PyLookupDump dumper(&lookResolver, COLLECT__CALL_DUMP); packet->Dump(COLLECT__CALL_DUMP, &dumper); } if(is_log_enabled(COLLECT__MISC_XML)) { printf("<element name=\"??\">\n"); PyXMLGenerator gen(stdout); packet->payload->visit(&gen); printf("</element>\n"); } delete packet; }
// Implementation of "dumpheap" command. // See also: HeapDumpDCmd class // // Input arguments :- // arg0: Name of the dump file // arg1: "-live" or "-all" jint dump_heap(AttachOperation* op, outputStream* out) { const char* path = op->arg(0); if (path == NULL || path[0] == '\0') { out->print_cr("No dump file specified"); } else { bool live_objects_only = true; // default is true to retain the behavior before this change is made const char* arg1 = op->arg(1); if (arg1 != NULL && (strlen(arg1) > 0)) { if (strcmp(arg1, "-all") != 0 && strcmp(arg1, "-live") != 0) { out->print_cr("Invalid argument to dumpheap operation: %s", arg1); return JNI_ERR; } live_objects_only = strcmp(arg1, "-live") == 0; } // Request a full GC before heap dump if live_objects_only = true // This helps reduces the amount of unreachable objects in the dump // and makes it easier to browse. HeapDumper dumper(live_objects_only /* request GC */); int res = dumper.dump(op->arg(0)); if (res == 0) { out->print_cr("Heap dump file created"); } else { // heap dump failed ResourceMark rm; char* error = dumper.error_as_C_string(); if (error == NULL) { out->print_cr("Dump failed - reason unknown"); } else { out->print_cr("%s", error); } } } return JNI_OK; }
void ValgrindMemcheckParserTest::testValgrindStartError() { QFETCH(QString, valgrindExe); QFETCH(QStringList, valgrindArgs); QFETCH(QString, debuggee); QFETCH(QString, debuggeeArgs); ProjectExplorer::StandardRunnable debuggeeExecutable; debuggeeExecutable.executable = debuggee; debuggeeExecutable.environment = Utils::Environment::systemEnvironment(); debuggeeExecutable.commandLineArguments = debuggeeArgs; ValgrindRunner runner; runner.setValgrindExecutable(valgrindExe); runner.setValgrindArguments(valgrindArgs); runner.setDebuggee(debuggeeExecutable); runner.setDevice(ProjectExplorer::DeviceManager::instance()->defaultDevice( ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE)); RunnerDumper dumper(&runner); runner.start(); runner.waitForFinished(); QEXPECT_FAIL("", "Error codes of valgrind startup are currently unprocessed", Continue); //FIXME QVERIFY(dumper.m_errorReceived); // just finish without deadlock and we are fine }
void EVECollectDispatcher::Handle_CallReq(const PyPacket *packet, PyCallStream **in_call) { PyCallStream *call = *in_call; *in_call = NULL; pendingCalls[packet->source.callID] = call->method; _log(COLLECT__CALL_SUMMARY, "Call ID "I64u": %s (svc %s)", packet->source.callID, call->method.c_str(), packet->dest.service.c_str()); packet->source.Dump(COLLECT__PACKET_SRC, " Src: "); packet->dest.Dump(COLLECT__PACKET_DEST, " Dest: "); if(is_log_enabled(COLLECT__CALL_DUMP)) { PyLookupDump dumper(&lookResolver, COLLECT__CALL_DUMP); call->Dump(COLLECT__CALL_DUMP, &dumper); } if(call->method != "MachoBindObject") { //this is handled elsewhere... if(is_log_enabled(COLLECT__CALL_XML)) { printf("<element name=\"Call%s\">\n", call->method.c_str()); PyXMLGenerator gen(stdout); call->arg_tuple->visit(&gen); printf("</element>\n"); } } //send it to a dispatcher if there is one registered std::map<std::string, _CallReqDispatch>::const_iterator res; res = m_callReqDisp.find(call->method); if(res != m_callReqDisp.end()) { _CallReqDispatch dsp = res->second; (this->*dsp)(packet, &call); } delete call; }
int main() { part_type& PartManager(part_type::instance()); io_type& IOManager(io_type::instance()); sleep(1); treeType& Tree(treeType::instance()); sleep(1); IOManager.loadDump("test.h5part"); dumpType dumper(&Tree); dumper.dotDump("test.dot"); inserterType inserter(&Tree); gravworkerType worker(&Tree); #pragma omp parallel for firstprivate(worker) for (int i = 0; i < 8; i++) { //const size_t tid = omp_get_thread_num(); //std::cout << tid << ":" << i << ":" << &worker << "\n"; } sleep(1); return 0; }
void EVECollectDispatcher::Handle_Notify(const PyPacket *packet, EVENotificationStream **in_notify) { EVENotificationStream *notify = *in_notify; *in_notify = NULL; _log(COLLECT__NOTIFY_SUMMARY, "Notification of type %s", packet->dest.service.c_str()); packet->source.Dump(COLLECT__PACKET_SRC, " Src: "); packet->dest.Dump(COLLECT__PACKET_DEST, " Dest: "); if(is_log_enabled(COLLECT__NOTIFY_DUMP)) { PyLookupDump dumper(&lookResolver, COLLECT__NOTIFY_DUMP); notify->Dump(COLLECT__NOTIFY_DUMP, &dumper); } if(is_log_enabled(COLLECT__NOTIFY_XML)) { printf("<element name=\"Notify%s\">\n", packet->dest.service.c_str()); PyXMLGenerator gen(stdout); notify->args->visit(&gen); printf("</element>\n"); } //send it to a dispatcher if there is one registered std::map<std::string, _NotifyDispatch>::const_iterator res; res = m_notifyDisp.find(packet->dest.service); if(res != m_notifyDisp.end()) { _NotifyDispatch dsp = res->second; (this->*dsp)(packet, ¬ify); } delete notify; }
void TouchedMethodsDCmd::execute(DCmdSource source, TRAPS) { if (!UnlockDiagnosticVMOptions) { output()->print_cr("VM.touched_methods command requires -XX:+UnlockDiagnosticVMOptions"); return; } VM_DumpTouchedMethods dumper(output()); VMThread::execute(&dumper); }
void DumpRecord(const SkRecord& record, SkCanvas* canvas, bool timeWithCommand) { Dumper dumper(canvas, record.count(), timeWithCommand); for (int i = 0; i < record.count(); i++) { record.visit<void>(i, dumper); } }
void TouchedMethodsDCmd::execute(DCmdSource source, TRAPS) { if (!LogTouchedMethods) { output()->print_cr("VM.print_touched_methods command requires -XX:+LogTouchedMethods"); return; } VM_DumpTouchedMethods dumper(output()); VMThread::execute(&dumper); }
void ObjectToSQL( const Seperator& cmd ) { const char* cmdName = cmd.arg( 0 ).c_str(); if( 5 != cmd.argCount() ) { sLog.Error( cmdName, "Usage: %s [cache_file] [table_name] [key_field] [file_name]", cmdName ); return; } const std::string& cacheFile = cmd.arg( 1 ); const std::string& tableName = cmd.arg( 2 ); const std::string& keyField = cmd.arg( 3 ); const std::string& fileName = cmd.arg( 4 ); std::string abs_fname( "../data/cache/" ); abs_fname += cacheFile; abs_fname += ".cache"; sLog.Log( cmdName, "Converting cached object %s:\n", abs_fname.c_str() ); CachedObjectMgr mgr; PyCachedObjectDecoder* obj = mgr.LoadCachedObject( abs_fname.c_str(), cacheFile.c_str() ); if( obj == NULL ) { sLog.Error( cmdName, "Unable to load or decode '%s'!", abs_fname.c_str() ); return; } obj->cache->DecodeData(); if( obj->cache->decoded() == NULL ) { sLog.Error( cmdName, "Unable to load or decode body of '%s'!", abs_fname.c_str() ); SafeDelete( obj ); return; } FILE* out = fopen( fileName.c_str(), "w" ); if( out == NULL ) { sLog.Error( cmdName, "Unable to open output file '%s'", fileName.c_str() ); SafeDelete( obj ); return; } SetSQLDumper dumper( tableName.c_str(), keyField.c_str(), out ); if( obj->cache->decoded()->visit( dumper ) ) sLog.Success( cmdName, "Dumping of %s succeeded.", tableName.c_str() ); else sLog.Error( cmdName, "Dumping of %s failed.", tableName.c_str() ); fclose( out ); SafeDelete( obj ); }
static void nativeDumpLayerHierarchy(JNIEnv* env, jobject, jint jbaseLayer, jint level, jobject jstream, jbyteArray jstorage) { SkWStream *stream = CreateJavaOutputStreamAdaptor(env, jstream, jstorage); BaseLayerAndroid* baseLayer = reinterpret_cast<BaseLayerAndroid*>(jbaseLayer); SkSafeRef(baseLayer); HierarchyLayerDumper dumper(stream, level); baseLayer->dumpLayers(&dumper); SkSafeUnref(baseLayer); delete stream; }
int main( int argc, char *argv[] ) { enum bm_type_t bmt; unsigned total_time = 60, sample_period = 20; unsigned int i; bmt = ia32_cpu_type(); switch (bmt) { case BMT_P4: printf( "Pentium 4 detected, enabling P4 performance monitoring.\n" ); bm = &p4_benchmarks; break; case BMT_K8: printf( "AMD K8 detected, enabling K8 performance monitoring.\n" ); bm = &k8_benchmarks; break; default: printf( "Unknown CPU type, performance monitoring disabled\n" ); } if( argc > 1 ) sscanf( argv[1], "%u", &sample_period ); if( argc > 2 ) sscanf( argv[2], "%u", &total_time ); if( signal(SIGINT, sigint_handler) == SIG_ERR ) { printf( "Error installing the signal handler.\n" ); exit( 1 ); } tot_samples = total_time / sample_period; sample_width = bm->size + 1; samples = malloc( sizeof(unsigned long long) * sample_width * tot_samples ); if( samples == NULL ) { printf( "Error allocating memory.\n" ); exit( 1 ); } for( next_sample = 0; next_sample < tot_samples; next_sample++ ) { perfmon_start(bm); sleep( sample_period ); perfmon_stop(bm); samples[next_sample*sample_width + 0] = bm->tsc; for( i = 0; i < bm->size; i++ ) samples[next_sample*sample_width + 1 + i] = bm->benchmarks[i].counter; } signal( SIGINT, SIG_DFL ); dumper(); return 0; }
size_t output(const char* fname, std::string &output_str) { std::fstream dumper(fname, std::fstream::out); auto buffer = dumper.rdbuf(); for(auto ch_ : output_str) { buffer->sputc(ch_); } return output_str.size(); }
static bool PrintVelocyPack(int fd, VPackSlice const& slice, bool appendNewline) { if (slice.isNone()) { // sanity check return false; } TRI_string_buffer_t buffer; TRI_InitStringBuffer(&buffer, TRI_UNKNOWN_MEM_ZONE); arangodb::basics::VPackStringBufferAdapter bufferAdapter(&buffer); try { VPackDumper dumper(&bufferAdapter); dumper.dump(slice); } catch (...) { // Writing failed TRI_AnnihilateStringBuffer(&buffer); return false; } if (TRI_LengthStringBuffer(&buffer) == 0) { // should not happen return false; } if (appendNewline) { // add the newline here so we only need one write operation in the ideal // case TRI_AppendCharStringBuffer(&buffer, '\n'); } char const* p = TRI_BeginStringBuffer(&buffer); size_t n = TRI_LengthStringBuffer(&buffer); while (0 < n) { ssize_t m = TRI_WRITE(fd, p, (TRI_write_t)n); if (m <= 0) { TRI_AnnihilateStringBuffer(&buffer); return false; } n -= m; p += m; } TRI_AnnihilateStringBuffer(&buffer); return true; }
void HeapDumpDCmd::execute(DCmdSource source, TRAPS) { // Request a full GC before heap dump if _all is false // This helps reduces the amount of unreachable objects in the dump // and makes it easier to browse. HeapDumper dumper(!_all.value() /* request GC if _all is false*/); int res = dumper.dump(_filename.value()); if (res == 0) { output()->print_cr("Heap dump file created"); } else { // heap dump failed ResourceMark rm; char* error = dumper.error_as_C_string(); if (error == NULL) { output()->print_cr("Dump failed - reason unknown"); } else { output()->print_cr("%s", error); } } }
void ValgrindMemcheckParserTest::testRealValgrind() { const Utils::Environment &sysEnv = Utils::Environment::systemEnvironment(); auto fileName = sysEnv.searchInPath("valgrind"); if (fileName.isEmpty()) QSKIP("This test needs valgrind in PATH"); QString executable = QProcessEnvironment::systemEnvironment().value("VALGRIND_TEST_BIN", fakeValgrindExecutable()); qDebug() << "running exe:" << executable << " HINT: set VALGRIND_TEST_BIN to change this"; ProjectExplorer::StandardRunnable debuggee; debuggee.executable = executable; debuggee.environment = sysEnv; ValgrindRunner runner; runner.setValgrindExecutable("valgrind"); runner.setDebuggee(debuggee); runner.setDevice(ProjectExplorer::DeviceManager::instance()->defaultDevice( ProjectExplorer::Constants::DESKTOP_DEVICE_TYPE)); RunnerDumper dumper(&runner); runner.start(); runner.waitForFinished(); }
bool Application::logCommand(String cmd) { Array<String> args; if (cmd.split(args, " \t", SPLIT_NOEMPTY | SPLIT_QUOTES)) { if (args.length() >= 2 && args[0].substr(0, 4).icompare("-log") == 0) { int detail = 0; if (args[0][4] == '=') detail = int(args[0][5] - '0'); if (detail < 0) detail = 0; if (detail > 2) detail = 2; File* log = File::open(args.length() > 2 ? args[2] : "log.txt", File::REWRITE); if (log) { uint32 error; W3GReplay* w3g = W3GReplay::load(args[1], 2, &error); if (w3g) { FileActionLogger logger(log); ActionDumper dumper(w3g); dumper.dump(&logger, detail); delete w3g; } else { if (error == W3GReplay::eNoFile) log->printf("Failed to open %s\r\n", args[1]); else if (error == W3GReplay::eBadFile) log->printf("Failed to parse replay\r\n", args[1]); } delete log; } return true; } } return false; }
/** * Function ComputeRawFilledAreas * Supports a min thickness area constraint. * Add non copper areas polygons (pads and tracks with clearance) * to the filled copper area found * in BuildFilledPolysListData after calculating filled areas in a zone * Non filled copper areas are pads and track and their clearance areas * The filled copper area must be computed just before. * BuildFilledPolysListData() call this function just after creating the * filled copper area polygon (without clearance areas) * to do that this function: * 1 - Creates the main outline (zone outline) using a correction to shrink the resulting area * with m_ZoneMinThickness/2 value. * The result is areas with a margin of m_ZoneMinThickness/2 * When drawing outline with segments having a thickness of m_ZoneMinThickness, the * outlines will match exactly the initial outlines * 3 - Add all non filled areas (pads, tracks) in group B with a clearance of m_Clearance + * m_ZoneMinThickness/2 * in a buffer * - If Thermal shapes are wanted, add non filled area, in order to create these thermal shapes * 4 - calculates the polygon A - B * 5 - put resulting list of polygons (filled areas) in m_FilledPolysList * This zone contains pads with the same net. * 6 - Remove insulated copper islands * 7 - If Thermal shapes are wanted, remove unconnected stubs in thermal shapes: * creates a buffer of polygons corresponding to stubs to remove * sub them to the filled areas. * Remove new insulated copper islands */ void ZONE_FILLER::computeRawFilledAreas( const ZONE_CONTAINER* aZone, const SHAPE_POLY_SET& aSmoothedOutline, SHAPE_POLY_SET& aRawPolys, SHAPE_POLY_SET& aFinalPolys ) const { int segsPerCircle; double correctionFactor; int outline_half_thickness = aZone->GetMinThickness() / 2; std::unique_ptr<SHAPE_FILE_IO> dumper( new SHAPE_FILE_IO( s_DumpZonesWhenFilling ? "zones_dump.txt" : "", SHAPE_FILE_IO::IOM_APPEND ) ); // Set the number of segments in arc approximations if( aZone->GetArcSegmentCount() == ARC_APPROX_SEGMENTS_COUNT_HIGHT_DEF ) segsPerCircle = ARC_APPROX_SEGMENTS_COUNT_HIGHT_DEF; else segsPerCircle = ARC_APPROX_SEGMENTS_COUNT_LOW_DEF; /* calculates the coeff to compensate radius reduction of holes clearance * due to the segment approx. * For a circle the min radius is radius * cos( 2PI / s_CircleToSegmentsCount / 2) * s_Correction is 1 /cos( PI/s_CircleToSegmentsCount ) */ correctionFactor = 1.0 / cos( M_PI / (double) segsPerCircle ); if( s_DumpZonesWhenFilling ) dumper->BeginGroup( "clipper-zone" ); SHAPE_POLY_SET solidAreas = aSmoothedOutline; solidAreas.Inflate( -outline_half_thickness, segsPerCircle ); solidAreas.Simplify( SHAPE_POLY_SET::PM_FAST ); SHAPE_POLY_SET holes; if( s_DumpZonesWhenFilling ) dumper->Write( &solidAreas, "solid-areas" ); buildZoneFeatureHoleList( aZone, holes ); if( s_DumpZonesWhenFilling ) dumper->Write( &holes, "feature-holes" ); holes.Simplify( SHAPE_POLY_SET::PM_FAST ); if( s_DumpZonesWhenFilling ) dumper->Write( &holes, "feature-holes-postsimplify" ); // Generate the filled areas (currently, without thermal shapes, which will // be created later). // Use SHAPE_POLY_SET::PM_STRICTLY_SIMPLE to generate strictly simple polygons // needed by Gerber files and Fracture() solidAreas.BooleanSubtract( holes, SHAPE_POLY_SET::PM_STRICTLY_SIMPLE ); if( s_DumpZonesWhenFilling ) dumper->Write( &solidAreas, "solid-areas-minus-holes" ); SHAPE_POLY_SET areas_fractured = solidAreas; areas_fractured.Fracture( SHAPE_POLY_SET::PM_FAST ); if( s_DumpZonesWhenFilling ) dumper->Write( &areas_fractured, "areas_fractured" ); aFinalPolys = areas_fractured; SHAPE_POLY_SET thermalHoles; // Test thermal stubs connections and add polygons to remove unconnected stubs. // (this is a refinement for thermal relief shapes) if( aZone->GetNetCode() > 0 ) { buildUnconnectedThermalStubsPolygonList( thermalHoles, aZone, aFinalPolys, correctionFactor, s_thermalRot ); } // remove copper areas corresponding to not connected stubs if( !thermalHoles.IsEmpty() ) { thermalHoles.Simplify( SHAPE_POLY_SET::PM_FAST ); // Remove unconnected stubs. Use SHAPE_POLY_SET::PM_STRICTLY_SIMPLE to // generate strictly simple polygons // needed by Gerber files and Fracture() solidAreas.BooleanSubtract( thermalHoles, SHAPE_POLY_SET::PM_STRICTLY_SIMPLE ); if( s_DumpZonesWhenFilling ) dumper->Write( &thermalHoles, "thermal-holes" ); // put these areas in m_FilledPolysList SHAPE_POLY_SET th_fractured = solidAreas; th_fractured.Fracture( SHAPE_POLY_SET::PM_FAST ); if( s_DumpZonesWhenFilling ) dumper->Write( &th_fractured, "th_fractured" ); aFinalPolys = th_fractured; } aRawPolys = aFinalPolys; if( s_DumpZonesWhenFilling ) dumper->EndGroup(); }
void ClangInternalState::printLookupTables(llvm::raw_ostream& Out, ASTContext& C) { DumpLookupTables dumper(Out); dumper.TraverseDecl(C.getTranslationUnitDecl()); }
size_t GCDump::DumpGCTable(PTR_CBYTE gcInfoBlock, unsigned methodSize, bool verifyGCTables) { GCInfoToken gcInfoToken = { dac_cast<PTR_VOID>(gcInfoBlock), gcInfoVersion }; GcInfoDecoder hdrdecoder(gcInfoToken, (GcInfoDecoderFlags)( DECODE_SECURITY_OBJECT | DECODE_GS_COOKIE | DECODE_CODE_LENGTH | DECODE_PSP_SYM | DECODE_VARARG | DECODE_GENERICS_INST_CONTEXT | DECODE_GC_LIFETIMES | DECODE_PROLOG_LENGTH | DECODE_RETURN_KIND), 0); if (NO_SECURITY_OBJECT != hdrdecoder.GetSecurityObjectStackSlot() || NO_GENERICS_INST_CONTEXT != hdrdecoder.GetGenericsInstContextStackSlot() || NO_GS_COOKIE == hdrdecoder.GetGSCookieStackSlot()) { gcPrintf("Prolog size: "); UINT32 prologSize = hdrdecoder.GetPrologSize(); gcPrintf("%d\n", prologSize); } gcPrintf("Security object: "); if (NO_SECURITY_OBJECT == hdrdecoder.GetSecurityObjectStackSlot()) { gcPrintf("<none>\n"); } else { INT32 ofs = hdrdecoder.GetSecurityObjectStackSlot(); char sign = '+'; if (ofs < 0) { sign = '-'; ofs = -ofs; } gcPrintf("caller.sp%c%x\n", sign, ofs); } gcPrintf("GS cookie: "); if (NO_GS_COOKIE == hdrdecoder.GetGSCookieStackSlot()) { gcPrintf("<none>\n"); } else { INT32 ofs = hdrdecoder.GetGSCookieStackSlot(); char sign = '+'; if (ofs < 0) { sign = '-'; ofs = -ofs; } gcPrintf("caller.sp%c%x\n", sign, ofs); UINT32 validRangeStart = hdrdecoder.GetGSCookieValidRangeStart(); UINT32 validRangeEnd = hdrdecoder.GetGSCookieValidRangeEnd(); gcPrintf("GS cookie valid range: [%x;%x)\n", validRangeStart, validRangeEnd); } gcPrintf("PSPSym: "); if (NO_PSP_SYM == hdrdecoder.GetPSPSymStackSlot()) { gcPrintf("<none>\n"); } else { INT32 ofs = hdrdecoder.GetPSPSymStackSlot(); char sign = '+'; if (ofs < 0) { sign = '-'; ofs = -ofs; } #ifdef _TARGET_AMD64_ // The PSPSym is relative to InitialSP on X64 and CallerSP on other platforms. gcPrintf("initial.sp%c%x\n", sign, ofs); #else gcPrintf("caller.sp%c%x\n", sign, ofs); #endif } gcPrintf("Generics inst context: "); if (NO_GENERICS_INST_CONTEXT == hdrdecoder.GetGenericsInstContextStackSlot()) { gcPrintf("<none>\n"); } else { INT32 ofs = hdrdecoder.GetGenericsInstContextStackSlot(); char sign = '+'; if (ofs < 0) { sign = '-'; ofs = -ofs; } gcPrintf("caller.sp%c%x\n", sign, ofs); } gcPrintf("PSP slot: "); if (NO_PSP_SYM == hdrdecoder.GetPSPSymStackSlot()) { gcPrintf("<none>\n"); } else { INT32 ofs = hdrdecoder.GetPSPSymStackSlot(); char sign = '+'; if (ofs < 0) { sign = '-'; ofs = -ofs; } gcPrintf("caller.sp%c%x\n", sign, ofs); } gcPrintf("GenericInst slot: "); if (NO_GENERICS_INST_CONTEXT == hdrdecoder.GetGenericsInstContextStackSlot()) { gcPrintf("<none>\n"); } else { INT32 ofs = hdrdecoder.GetGenericsInstContextStackSlot(); char sign = '+'; if (ofs < 0) { sign = '-'; ofs = -ofs; } gcPrintf("caller.sp%c%x ", sign, ofs); if (hdrdecoder.HasMethodDescGenericsInstContext()) gcPrintf("(GENERIC_PARAM_CONTEXT_METHODDESC)\n"); else if (hdrdecoder.HasMethodTableGenericsInstContext()) gcPrintf("(GENERIC_PARAM_CONTEXT_METHODHANDLE)\n"); else gcPrintf("(GENERIC_PARAM_CONTEXT_THIS)\n"); } gcPrintf("Varargs: %u\n", hdrdecoder.GetIsVarArg()); gcPrintf("Frame pointer: %s\n", NO_STACK_BASE_REGISTER == hdrdecoder.GetStackBaseRegister() ? "<none>" : GetRegName(hdrdecoder.GetStackBaseRegister())); gcPrintf("Wants Report Only Leaf: %u\n", hdrdecoder.WantsReportOnlyLeaf()); #ifdef FIXED_STACK_PARAMETER_SCRATCH_AREA gcPrintf("Size of parameter area: %x\n", hdrdecoder.GetSizeOfStackParameterArea()); #endif ReturnKind returnKind = hdrdecoder.GetReturnKind(); gcPrintf("Return Kind: %s\n", ReturnKindToString(returnKind)); UINT32 cbEncodedMethodSize = hdrdecoder.GetCodeLength(); gcPrintf("Code size: %x\n", cbEncodedMethodSize); GcInfoDumper dumper(gcInfoToken); GcInfoDumpState state; state.LastCodeOffset = -1; state.fAnythingPrinted = FALSE; state.fSafePoint = FALSE; state.FrameRegister = hdrdecoder.GetStackBaseRegister(); state.pfnPrintf = gcPrintf; GcInfoDumper::EnumerateStateChangesResults result = dumper.EnumerateStateChanges( &InterruptibleStateChangeCallback, &RegisterStateChangeCallback, &StackSlotStateChangeCallback, &SafePointCallback, &state); if (state.fAnythingPrinted) gcPrintf("\n"); switch (result) { case GcInfoDumper::SUCCESS: // do nothing break; case GcInfoDumper::OUT_OF_MEMORY: gcPrintf("out of memory\n"); break; case GcInfoDumper::REPORTED_REGISTER_IN_CALLERS_FRAME: gcPrintf("reported register in caller's frame\n"); break; case GcInfoDumper::REPORTED_FRAME_POINTER: gcPrintf("reported frame register\n"); break; case GcInfoDumper::REPORTED_INVALID_BASE_REGISTER: gcPrintf("reported pointer relative to wrong base register\n"); break; case GcInfoDumper::REPORTED_INVALID_POINTER: gcPrintf("reported invalid pointer\n"); break; case GcInfoDumper::DECODER_FAILED: gcPrintf("decoder failed\n"); break; default: gcPrintf("invalid GC info\n"); break; } return (result == GcInfoDumper::SUCCESS) ? dumper.GetGCInfoSize() : 0; }
void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList_NG( BOARD* aPcb ) { int segsPerCircle; double correctionFactor; int outline_half_thickness = m_ZoneMinThickness / 2; std::unique_ptr<SHAPE_FILE_IO> dumper( new SHAPE_FILE_IO( g_DumpZonesWhenFilling ? "zones_dump.txt" : "", SHAPE_FILE_IO::IOM_APPEND ) ); // Set the number of segments in arc approximations if( m_ArcToSegmentsCount == ARC_APPROX_SEGMENTS_COUNT_HIGHT_DEF ) segsPerCircle = ARC_APPROX_SEGMENTS_COUNT_HIGHT_DEF; else segsPerCircle = ARC_APPROX_SEGMENTS_COUNT_LOW_DEF; /* calculates the coeff to compensate radius reduction of holes clearance * due to the segment approx. * For a circle the min radius is radius * cos( 2PI / s_CircleToSegmentsCount / 2) * s_Correction is 1 /cos( PI/s_CircleToSegmentsCount ) */ correctionFactor = 1.0 / cos( M_PI / (double) segsPerCircle ); CPOLYGONS_LIST tmp; if(g_DumpZonesWhenFilling) dumper->BeginGroup("clipper-zone"); SHAPE_POLY_SET solidAreas = ConvertPolyListToPolySet( m_smoothedPoly->m_CornersList ); solidAreas.Inflate( -outline_half_thickness, segsPerCircle ); solidAreas.Simplify( POLY_CALC_MODE ); SHAPE_POLY_SET holes; if(g_DumpZonesWhenFilling) dumper->Write( &solidAreas, "solid-areas" ); tmp.RemoveAllContours(); buildFeatureHoleList( aPcb, holes ); if(g_DumpZonesWhenFilling) dumper->Write( &holes, "feature-holes" ); holes.Simplify( POLY_CALC_MODE ); if (g_DumpZonesWhenFilling) dumper->Write( &holes, "feature-holes-postsimplify" ); solidAreas.BooleanSubtract( holes, POLY_CALC_MODE ); if (g_DumpZonesWhenFilling) dumper->Write( &solidAreas, "solid-areas-minus-holes" ); SHAPE_POLY_SET areas_fractured = solidAreas; areas_fractured.Fracture( POLY_CALC_MODE ); if (g_DumpZonesWhenFilling) dumper->Write( &areas_fractured, "areas_fractured" ); m_FilledPolysList = areas_fractured; // Remove insulated islands: if( GetNetCode() > 0 ) TestForCopperIslandAndRemoveInsulatedIslands( aPcb ); SHAPE_POLY_SET thermalHoles; // Test thermal stubs connections and add polygons to remove unconnected stubs. // (this is a refinement for thermal relief shapes) if( GetNetCode() > 0 ) BuildUnconnectedThermalStubsPolygonList( thermalHoles, aPcb, this, correctionFactor, s_thermalRot ); // remove copper areas corresponding to not connected stubs if( !thermalHoles.IsEmpty() ) { thermalHoles.Simplify( POLY_CALC_MODE ); // Remove unconnected stubs solidAreas.BooleanSubtract( thermalHoles, POLY_CALC_MODE ); if( g_DumpZonesWhenFilling ) dumper->Write( &thermalHoles, "thermal-holes" ); // put these areas in m_FilledPolysList SHAPE_POLY_SET th_fractured = solidAreas; th_fractured.Fracture( POLY_CALC_MODE ); if( g_DumpZonesWhenFilling ) dumper->Write ( &th_fractured, "th_fractured" ); m_FilledPolysList = th_fractured; if( GetNetCode() > 0 ) TestForCopperIslandAndRemoveInsulatedIslands( aPcb ); } if(g_DumpZonesWhenFilling) dumper->EndGroup(); }
int Dbox_dumper::dumpFile(string file, Spear_parser *dataIn) { return dumper((char *)file.c_str(), dataIn); }
int Dbox_dumper::dumpFile(char *file, Spear_parser *dataIn) { return dumper(file, dataIn); }
void EVECollectDispatcher::Handle_CallRsp(const PyPacket *packet, PyRepTuple **in_result) { PyRepTuple *result = *in_result; *in_result = NULL; std::map<uint32, std::string>::iterator res; res = pendingCalls.find(packet->dest.callID); if(res != pendingCalls.end()) { const char *pfx = ""; if(result->items.size() == 1 && result->items[0]->CheckType(PyRep::SubStream)) { PyRepSubStream *ss = (PyRepSubStream *) result->items[0]; ss->DecodeData(); if(ss->decoded != NULL) { if(ss->decoded->CheckType(PyRep::None)) pfx = "Empty "; //decode any nested substreams. SubStreamDecoder ssd; ss->decoded->visit(&ssd); } } _log(COLLECT__CALL_SUMMARY, "%sCall Response for ID "I64u": %s (svc %s)", pfx, packet->dest.callID, res->second.c_str(), packet->source.service.c_str()); packet->source.Dump(COLLECT__PACKET_SRC, " Src: "); packet->dest.Dump(COLLECT__PACKET_DEST, " Dest: "); if(is_log_enabled(COLLECT__CALL_DUMP)) { if(res->second != "GetCachableObject") { //these get dumped elsewhere SubStreamDecoder v; result->visit(&v); PyLookupDump dumper(&lookResolver, COLLECT__CALL_DUMP); result->visit(&dumper); } } //end "is dump enabled" if(is_log_enabled(COLLECT__CALLRSP_SQL) && result != NULL && res->second != "MachoBindObject" //bind object nested calls dumped elsewhere. ) { //run through the result looking for SQL tables, and dump them. SetSQLDumper sql_dumper(stdout, res->second.c_str()); result->visit(&sql_dumper); } if(is_log_enabled(COLLECT__CALLRSP_XML) && result != NULL && res->second != "MachoBindObject" //bind object nested calls dumped elsewhere. ) { printf("<element name=\"Rsp%s\">\n", res->second.c_str()); PyXMLGenerator gen(stdout); result->visit(&gen); printf("</element>\n"); } //send it to a dispatcher if there is one registered std::map<std::string, _CallRspDispatch>::const_iterator res2; res2 = m_callRspDisp.find(res->second); if(res2 != m_callRspDisp.end()) { _CallRspDispatch dsp = res2->second; (this->*dsp)(packet, &result); }/* else { _log(COLLECT__ERROR, "Unable to find handler for '%s'", res->second.c_str()); }*/ pendingCalls.erase(res); } else { _log(COLLECT__CALL_SUMMARY, "Call Response for unknonw call ID "I64u, packet->dest.callID); } delete result; }
int main(int argc, char* const* argv) { // pass the id number to display on the command line char *fname, *sid; uint64_t i_id; int c; DEBUG_INIT("getidblock.log", NULL); DEBUG_ENT("main"); while ((c = getopt(argc, argv, "bp")) != -1) { switch (c) { case 'b': // enable binary output binary = 1; break; case 'p': // enable procesing of block process = 1; break; default: usage(); exit(EXIT_FAILURE); } } if (optind + 1 >= argc) { // no more items on the cmd usage(); exit(EXIT_FAILURE); } fname = argv[optind]; sid = argv[optind + 1]; i_id = (uint64_t)strtoll(sid, NULL, 0); DEBUG_INFO(("Opening file\n")); memset(&pstfile, 0, sizeof(pstfile)); if (pst_open(&pstfile, fname, NULL)) { DIE(("Error opening file\n")); } DEBUG_INFO(("Loading Index\n")); if (pst_load_index(&pstfile) != 0) { DIE(("Error loading file index\n")); } if (i_id) { dumper(i_id); } else { size_t i; for (i = 0; i < pstfile.i_count; i++) { dumper(pstfile.i_table[i].i_id); } dump_desc(pstfile.d_head, NULL); } if (pst_close(&pstfile) != 0) { DIE(("pst_close failed\n")); } DEBUG_RET(); return 0; }