ribi::About::About( const std::string& author, const std::string& file_title, const std::string& file_description, const std::string& programmed_on, const std::string& years, const std::string& url, const std::string& version, const std::vector<std::string>& version_history) noexcept : m_author{author}, m_file_title{file_title}, m_file_description{file_description}, m_libraries{}, m_programmed_on{programmed_on}, m_years{years}, m_url{url}, m_version{version}, m_version_history{version_history} { AddLibrary( "About version: " + GetAboutVersion()); AddLibrary( "Boost version: " + GetBoostVersion()); AddLibrary( "STL version: " + GetStlVersion() + " (GNU ISO C++ library)"); }
About::About( const std::string author, const std::string file_title, const std::string file_description, const std::string programmed_on, const std::string years, const std::string url, const std::string version, const std::vector<std::string>& version_history) : m_author(author), m_file_title(file_title), m_file_description(file_description), m_libraries( {} ), m_programmed_on(programmed_on), m_years(years), m_url(url), m_version(version), m_version_history(version_history) { AddLibrary( std::string("About version: ") + GetAboutVersion()); AddLibrary( std::string("Boost version: ") + GetBoostVersion()); AddLibrary( std::string("STL version: ") + GetStlVersion() + std::string(" (GNU ISO C++ library)")); }
static cell AMX_NATIVE_CALL register_library(AMX *amx, cell *params) { int len; char *lib = get_amxstring(amx, params[1], 0, len); AddLibrary(lib, LibType_Library, LibSource_Plugin, g_plugins.findPluginFast(amx)); return 1; }
/* readonly attribute sbIDeviceContent content; */ NS_IMETHODIMP sbMockDevice::GetContent(sbIDeviceContent * *aContent) { nsresult rv; if (!mContent) { nsRefPtr<sbDeviceContent> deviceContent = sbDeviceContent::New(); NS_ENSURE_TRUE(deviceContent, NS_ERROR_OUT_OF_MEMORY); rv = deviceContent->Initialize(); NS_ENSURE_SUCCESS(rv, rv); mContent = deviceContent; // Create a device volume. nsRefPtr<sbBaseDeviceVolume> volume; rv = sbBaseDeviceVolume::New(getter_AddRefs(volume), this); NS_ENSURE_SUCCESS(rv, rv); // Set the volume GUID. char volumeGUID[NSID_LENGTH]; nsID* deviceID; rv = GetId(&deviceID); NS_ENSURE_SUCCESS(rv, rv); deviceID->ToProvidedString(volumeGUID); NS_Free(deviceID); rv = volume->SetGUID(NS_ConvertUTF8toUTF16(volumeGUID)); NS_ENSURE_SUCCESS(rv, rv); // Add the volume. rv = AddVolume(volume); NS_ENSURE_SUCCESS(rv, rv); // Set the primary and default volume. { nsAutoLock autoVolumeLock(mVolumeLock); mPrimaryVolume = volume; mDefaultVolume = volume; } // make a mock library too NS_NAMED_LITERAL_STRING(LIBID, "mock-library.mock-device"); nsCOMPtr<sbIDeviceLibrary> devLib; rv = CreateDeviceLibrary(LIBID, nsnull, getter_AddRefs(devLib)); NS_ENSURE_SUCCESS(rv, rv); // Set the volume device library. rv = volume->SetDeviceLibrary(devLib); NS_ENSURE_SUCCESS(rv, rv); rv = AddLibrary(devLib); NS_ENSURE_SUCCESS(rv, rv); } NS_ADDREF(*aContent = mContent); return NS_OK; }
void Project::ImportLibrary(const char *path, const platform_t &platform) { DPath libpath(path); BString filename = libpath.GetFileName(); BPath systemLibPath; find_directory(B_BEOS_LIB_DIRECTORY,&systemLibPath); // Most of the problems stem from migrating from Zeta to any Haiku build, so handle the // common cases here switch (platform) { case PLATFORM_HAIKU_GCC4: { // Haiku GCC4 breaks tradition in renaming libstdc++.r4.so to libstdc++.so if (filename == "libstdc++.r4.so") { libpath = systemLibPath.Path(); libpath << "libstdc++.so"; } } case PLATFORM_HAIKU: case PLATFORM_R5: case PLATFORM_ZETA: { // Haiku GCC4 breaks tradition in renaming libstdc++.r4.so to libstdc++.so, // so go back to the old naming scheme for the other platforms if (filename == "libstdc++.so") { libpath = systemLibPath.Path(); libpath << "libstdc++.r4.so"; } break; } default: { break; } } // libsupc++ is only for Haiku GCC4. It is not found or needed on other platforms, // so we will silently ignore any requests for the library on any other platform and // the code will build just fine. if (filename == "libsupc++.so" && platform != PLATFORM_HAIKU_GCC4) return; AddLibrary(libpath.GetFullPath()); }
PyMODINIT_FUNC initlibs() { char dbfdir[PATH_MAX]; /* Initialize the various bongo libraries */ if (!ConnStartup(DEFAULT_CONNECTION_TIMEOUT)) { PyErr_SetString(PyExc_ImportError, "bongo.libs error: ConnStartup() failed"); return; } MsgInit(); if (!BongoCalInit(MsgGetDir(MSGAPI_DIR_DBF, NULL, 0))) { PyErr_SetString(PyExc_ImportError, "bongo.libs error: BongoCalInit() failed"); return; } if (!NMAPInitialize()) { PyErr_SetString(PyExc_ImportError, "bongo.libs error: NMAPInitialize() failed"); return; } if (!StreamioInit()) { PyErr_SetString(PyExc_ImportError, "bongo.libs error: StreamioInit() failed"); return; } if (!BongoJsonPreInit()) { PyErr_SetString(PyExc_ImportError, "bongo.libs error: BongoJsonPreInit() failed"); return; } /* Create the libs module */ PyObject *module = Py_InitModule("libs", ModuleMethods); /* Add the Bongo libs */ AddLibrary(module, "cal", CalMethods, NULL); //AddLibrary(module, "calcmd", CalCmdMethods, CalCmdEnums); AddLibrary(module, "msgapi", MsgApiMethods, NULL); AddLibrary(module, "streamio", StreamIOMethods, NULL); AddLibrary(module, "bongojson", BongoJsonMethods, NULL); AddLibrary(module, "bongoutil", BongoUtilMethods, NULL); AddLibrary(module, "tests", TestMethods, NULL); BongoJsonPostInit(module); BongoCalPostInit(module); }
///////////////////////////////////////////////////////////////////////////// //загрузка системной библиотеки объектов void CMetadata::LoadSystemLibrary() { CString StartPath=csCurrentExeDir; StartPath.TrimRight('\\'); StartPath+="\\SYSTEM\\"; SetCurrentDirectory(csIBDir); WIN32_FIND_DATA fdata; HANDLE hfind=FindFirstFile(StartPath+"*.md2",&fdata); if(NULL==hfind || INVALID_HANDLE_VALUE==hfind) return; CArray <CString,CString&> aLibName; do { CString csName=StartPath + fdata.cFileName; if(mUpper(csName)!=mUpper(m_csConfigPath)) aLibName.Add(csName); } while(FindNextFile(hfind,&fdata)); FindClose(hfind); // m_zip.Open(m_csConfigPath, CZipArchive::create,0);//Новый архив // m_zip.Close(); //сортировка SortList(aLibName); for(int i=0;i<aLibName.GetSize();i++) { CString csName=mUpper(aLibName[i]); if(csName.Right(4)==".MD2") //AfxMessageBox(aLibName[i]); AddLibrary(aLibName[i]); } }
SCH_BASE_FRAME::COMPONENT_SELECTION SCH_BASE_FRAME::SelectComponentFromLibTree( const SCHLIB_FILTER* aFilter, std::vector<COMPONENT_SELECTION>& aHistoryList, bool aAllowBrowser, int aUnit, int aConvert, bool aShowFootprints, const LIB_ID* aHighlight, bool aAllowFields ) { std::unique_lock<std::mutex> dialogLock( DIALOG_CHOOSE_COMPONENT::g_Mutex, std::defer_lock ); wxString dialogTitle; SYMBOL_LIB_TABLE* libs = Prj().SchSymbolLibTable(); // One CHOOSE_COMPONENT dialog at a time. User probaby can't handle more anyway. if( !dialogLock.try_lock() ) return COMPONENT_SELECTION(); auto adapterPtr( SYMBOL_TREE_MODEL_ADAPTER::Create( libs ) ); auto adapter = static_cast<SYMBOL_TREE_MODEL_ADAPTER*>( adapterPtr.get() ); bool loaded = false; if( aFilter ) { const wxArrayString& liblist = aFilter->GetAllowedLibList(); for( unsigned ii = 0; ii < liblist.GetCount(); ii++ ) { if( libs->HasLibrary( liblist[ii], true ) ) { loaded = true; adapter->AddLibrary( liblist[ii] ); } } adapter->AssignIntrinsicRanks(); if( aFilter->GetFilterPowerParts() ) adapter->SetFilter( SYMBOL_TREE_MODEL_ADAPTER::CMP_FILTER_POWER ); } std::vector< LIB_TREE_ITEM* > history_list; for( auto const& i : aHistoryList ) { LIB_ALIAS* alias = GetLibAlias( i.LibId ); if( alias ) history_list.push_back( alias ); } adapter->DoAddLibrary( "-- " + _( "Recently Used" ) + " --", wxEmptyString, history_list, true ); if( !aHistoryList.empty() ) adapter->SetPreselectNode( aHistoryList[0].LibId, aHistoryList[0].Unit ); const std::vector< wxString > libNicknames = libs->GetLogicalLibs(); if( !loaded ) adapter->AddLibraries( libNicknames, this ); if( aHighlight && aHighlight->IsValid() ) adapter->SetPreselectNode( *aHighlight, /* aUnit */ 0 ); if( adapter->GetFilter() == SYMBOL_TREE_MODEL_ADAPTER::CMP_FILTER_POWER ) dialogTitle.Printf( _( "Choose Power Symbol (%d items loaded)" ), adapter->GetItemCount() ); else dialogTitle.Printf( _( "Choose Symbol (%d items loaded)" ), adapter->GetItemCount() ); DIALOG_CHOOSE_COMPONENT dlg( this, dialogTitle, adapterPtr, aConvert, aAllowFields, aShowFootprints, aAllowBrowser ); if( dlg.ShowQuasiModal() == wxID_CANCEL ) return COMPONENT_SELECTION(); COMPONENT_SELECTION sel; LIB_ID id = dlg.GetSelectedLibId( &sel.Unit ); if( dlg.IsExternalBrowserSelected() ) // User requested component browser. { sel = SelectComponentFromLibBrowser( this, aFilter, id, sel.Unit, sel.Convert ); id = sel.LibId; } if( !id.IsValid() ) // Dialog closed by OK button, // or the selection by lib browser was requested, // but no symbol selected return COMPONENT_SELECTION(); if( sel.Unit == 0 ) sel.Unit = 1; sel.Fields = dlg.GetFields(); sel.LibId = id; if( sel.LibId.IsValid() ) { aHistoryList.erase( std::remove_if( aHistoryList.begin(), aHistoryList.end(), [ &sel ]( COMPONENT_SELECTION const& i ){ return i.LibId == sel.LibId; } ), aHistoryList.end() ); aHistoryList.insert( aHistoryList.begin(), sel ); } return sel; }
void LIB_EDIT_FRAME::DeleteOnePart( wxCommandEvent& event ) { wxString cmp_name; LIB_ALIAS* libEntry; wxArrayString nameList; wxString msg; m_canvas->EndMouseCapture( ID_NO_TOOL_SELECTED, m_canvas->GetDefaultCursor() ); m_lastDrawItem = NULL; m_drawItem = NULL; LIB_PART *part = GetCurPart(); PART_LIB* lib = GetCurLib(); if( !lib ) { SelectActiveLibrary(); lib = GetCurLib(); if( !lib ) { DisplayError( this, _( "Please select a component library." ) ); return; } } auto adapter( CMP_TREE_MODEL_ADAPTER::Create( Prj().SchLibs() ) ); wxString name = part ? part->GetName() : wxString( wxEmptyString ); adapter->SetPreselectNode( name, /* aUnit */ 0 ); adapter->ShowUnits( false ); adapter->AddLibrary( *lib ); wxString dialogTitle; dialogTitle.Printf( _( "Delete Component (%u items loaded)" ), adapter->GetComponentsCount() ); DIALOG_CHOOSE_COMPONENT dlg( this, dialogTitle, adapter, m_convert ); if( dlg.ShowModal() == wxID_CANCEL ) { return; } libEntry = dlg.GetSelectedAlias( NULL ); if( !libEntry ) { msg.Printf( _( "Entry '%s' not found in library '%s'." ), GetChars( libEntry->GetName() ), GetChars( lib->GetName() ) ); DisplayError( this, msg ); return; } msg.Printf( _( "Delete component '%s' from library '%s' ?" ), GetChars( libEntry->GetName() ), GetChars( lib->GetName() ) ); if( !IsOK( this, msg ) ) return; part = GetCurPart(); if( !part || !part->HasAlias( libEntry->GetName() ) ) { lib->RemoveAlias( libEntry ); m_canvas->Refresh(); return; } // If deleting the current entry or removing one of the aliases for // the current entry, sync the changes in the current entry as well. if( GetScreen()->IsModify() && !IsOK( this, _( "The component being deleted has been modified." " All changes will be lost. Discard changes?" ) ) ) { return; } LIB_ALIAS* nextEntry = lib->RemoveAlias( libEntry ); if( nextEntry != NULL ) { if( LoadOneLibraryPartAux( nextEntry, lib ) ) Zoom_Automatique( false ); } else { SetCurPart( NULL ); // delete CurPart m_aliasName.Empty(); } m_canvas->Refresh(); }
status_t Project::Load(const char *path) { BEntry entry(path,true); status_t status = entry.InitCheck(); if (status != B_OK) return status; entry_ref ref; entry.GetRef(&ref); fReadOnly = BVolume(ref.device).IsReadOnly(); TextFile file(ref,B_READ_ONLY); status = file.InitCheck(); if (status != B_OK) return status; fGroupList.MakeEmpty(); fPath = path; fName = fPath.GetBaseName(); platform_t actualPlatform = DetectPlatform(); STRACE(2,("Loading project %s\n",path)); // Set this to an out-of-bounds value to detect if // there is no SCM entry in the project fSCMType = SCM_INIT; SourceGroup *srcgroup = NULL; SourceFile *srcfile = NULL; BString line = file.ReadLine(); while (line.CountChars() > 0) { int32 pos = line.FindFirst("="); if (pos < 0) { line = file.ReadLine(); continue; } BString entry = line; entry.Truncate(pos); BString value = line.String() + pos + 1; STRACE(2,("Load Project: %s=%s\n",entry.String(),value.String())); if (value.CountChars() > 0) { if (entry[0] == '#') continue; else if (entry == "SOURCEFILE") { if (value.String()[0] != '/') { value.Prepend("/"); value.Prepend(fPath.GetFolder()); } srcfile = gFileFactory.CreateSourceFileItem(value.String()); AddFile(srcfile, srcgroup); } else if (entry == "DEPENDENCY") { if (srcfile) srcfile->fDependencies = value; } else if (entry == "LOCALINCLUDE") { ProjectPath include(fPath.GetFolder(), value.String()); AddLocalInclude(include.Absolute().String()); } else if (entry == "SYSTEMINCLUDE") AddSystemInclude(value.String()); else if (entry == "LIBRARY") { if (actualPlatform == fPlatform) AddLibrary(value.String()); else ImportLibrary(value.String(),actualPlatform); } else if (entry == "GROUP") srcgroup = AddGroup(value.String()); else if (entry == "EXPANDGROUP") { if (srcgroup) srcgroup->expanded = value == "yes" ? true : false; } else if (entry == "TARGETNAME") fTargetName = value; else if (entry == "CCDEBUG") fDebug = value == "yes" ? true : false; else if (entry == "CCPROFILE") fProfile = value == "yes" ? true : false; else if (entry == "CCOPSIZE") fOpSize = value == "yes" ? true : false; else if (entry == "CCOPLEVEL") fOpLevel = atoi(value.String()); else if (entry == "CCTARGETTYPE") fTargetType = atoi(value.String()); else if (entry == "CCEXTRA") fExtraCompilerOptions = value; else if (entry == "LDEXTRA") fExtraLinkerOptions = value; else if (entry == "RUNARGS") fRunArgs = value; else if (entry == "SCM") { if (value.ICompare("hg") == 0) fSCMType = SCM_HG; else if (value.ICompare("git") == 0) fSCMType = SCM_GIT; else if (value.ICompare("svn") == 0) fSCMType = SCM_SVN; else fSCMType = SCM_NONE; } else if (entry == "PLATFORM") { if (value.ICompare("Haiku") == 0) fPlatform = PLATFORM_HAIKU; else if (value.ICompare("HaikuGCC4") == 0) fPlatform = PLATFORM_HAIKU_GCC4; else if (value.ICompare("Zeta") == 0) fPlatform = PLATFORM_ZETA; else fPlatform = PLATFORM_R5; } } line = file.ReadLine(); } // Fix one of my pet peeves when changing platforms: having to add libsupc++.so whenever // I change to Haiku GCC4 or GCC4hybrid from any other platform if (actualPlatform == PLATFORM_HAIKU_GCC4 && actualPlatform != fPlatform) { BPath libpath; find_directory(B_USER_DEVELOP_DIRECTORY,&libpath); libpath.Append("lib/x86/libsupc++.so"); AddLibrary(libpath.Path()); } fObjectPath = fPath.GetFolder(); BString objfolder("(Objects."); objfolder << GetName() << ")"; fObjectPath.Append(objfolder.String()); UpdateBuildInfo(); // We now set the platform to whatever we're building on. fPlatform is only used // in the project loading code to be able to help cover over issues with changing platforms. // Most of the time this is just the differences in libraries, but there may be other // unforeseen issues that will come to light in the future. fPlatform = actualPlatform; return B_OK; }
/* Handle breakpoints - we expect to see breakpoints in the dynamic linker * (which we set ourselves) as well as profiler marks (embedded in the * profiled application's code). */ static bool ProcessBreakpoint( pid_t pid, u_long ip ) { static int ld_state = RT_CONSISTENT; // This ought to be per-pid int ptrace_sig = 0; #if defined( MD_x86 ) user_regs_struct regs; // on x86, when breakpoint was hit the EIP points to the next // instruction, so we must be careful ptrace( PTRACE_GETREGS, pid, NULL, ®s ); if( ip == Rdebug.r_brk + sizeof( opcode_type ) ) { #elif defined( MD_ppc ) if( ip == Rdebug.r_brk ) { #endif opcode_type brk_opcode = BRKPOINT; int status; int ret; /* The dynamic linker breakpoint was hit, meaning that * libraries are being loaded or unloaded. This gets a bit * tricky because we must restore the original code that was * at the breakpoint and execute it, but we still want to * keep the breakpoint. */ if( WriteMem( pid, &saved_opcode, Rdebug.r_brk, sizeof( saved_opcode ) ) != sizeof( saved_opcode ) ) printf( "WriteMem() #1 failed\n" ); ReadMem( pid, &Rdebug, (addr_off)DbgRdebug, sizeof( Rdebug ) ); dbg_printf( "ld breakpoint hit, state is " ); switch( Rdebug.r_state ) { case RT_ADD: dbg_printf( "RT_ADD\n" ); AddLibrary( pid, Rdebug.r_map ); ld_state = RT_ADD; break; case RT_DELETE: dbg_printf( "RT_DELETE\n" ); ld_state = RT_DELETE; break; case RT_CONSISTENT: dbg_printf( "RT_CONSISTENT\n" ); if( ld_state == RT_DELETE ) RemoveLibrary( pid, Rdebug.r_map ); ld_state = RT_CONSISTENT; break; default: dbg_printf( "error!\n" ); break; } #if defined( MD_x86 ) regs.eip--; ptrace( PTRACE_SETREGS, pid, NULL, ®s ); #endif // unset breakpoint, single step, re-set breakpoint if( ptrace( PTRACE_SINGLESTEP, pid, NULL, (void *)ptrace_sig ) < 0 ) perror( "ptrace()" ); do { // have to loop since SIGALRM can interrupt us here ret = waitpid( pid, &status, 0 ); } while( (ret < 0) && (errno == EINTR) ); if( ret == -1) perror( "waitpid()" ); if( WriteMem( pid, &brk_opcode, Rdebug.r_brk, sizeof( brk_opcode ) ) != sizeof( brk_opcode ) ) dbg_printf( "WriteMem() #2 failed with errno %d for pid %d, %d bytes (at %p)!\n", errno, pid, sizeof( brk_opcode ), Rdebug.r_brk ); return( true ); // indicate this was our breakpoint } else { dbg_printf( "Not an ld breakpoint, assuming mark\n" ); #if defined( MD_x86 ) return( ProcessMark( pid, ®s ) ); #endif } return( false ); } /* * Real time signal (SIGALRM) handler. All we really need to do is wake up * periodically to interrupt waitpid(), the signal handler need not do much * at all. */ static void alarm_handler( int signo ) { TimerTicked = true; } /* Install periodic real time alarm signal */ static void InstSigHandler( int msec_period ) { struct sigaction sigalrm; struct itimerval timer; sigalrm.sa_handler = (void *)alarm_handler; sigemptyset( &sigalrm.sa_mask ); sigalrm.sa_flags = 0; sigaction( SIGALRM, &sigalrm, NULL ); timer.it_interval.tv_sec = 0; timer.it_interval.tv_usec = msec_period * 1000; timer.it_value.tv_sec = 0; timer.it_value.tv_usec = msec_period * 1000; if( setitimer( ITIMER_REAL, &timer, NULL ) ) { InternalError( MsgArray[MSG_SAMPLE_6 - ERR_FIRST_MESSAGE] ); } } /* * Main sampler loop. We run the profiled application under the control of * ptrace(). The sampler installs a SIGALRM handler which ticks at the desired * rate. Whenever the SIGALRM interrupts our own waitpid(), we send a SIGSTOP * to the profiled app and when the child app notifies us of the SIGSTOP, we * remember the current execution point and continue the profiled app. Note * that we may miss some ticks but this is not a problem - the ticks don't * even need to be regular to provide usable results. */ static void SampleLoop( pid_t pid ) { static int ptrace_sig = 0; static bool do_cont = true; int status; user_regs_struct regs; bool sample_continue = true; int ret; opcode_type brk_opcode = BRKPOINT; TimerTicked = false; InstSigHandler( SleepTime ); do { if( do_cont && ptrace( PTRACE_CONT, pid, NULL, (void *)ptrace_sig ) == -1) perror( "ptrace()" ); ret = waitpid( pid, &status, 0 ); if( (ret < 0) && (errno == EINTR) ) { /* did we get woken up by SIGALRM? */ if( TimerTicked ) { TimerTicked = false; /* interrupt child process - next waitpid() will see this */ kill( pid, SIGSTOP ); } else { dbg_printf( "who the hell interrupted waitpid()?\n" ); } do_cont = false; continue; } if( ret < 0 ) perror( "waitpid()" ); do_cont = true; /* record current execution point */ #if defined( MD_x86 ) ptrace( PTRACE_GETREGS, pid, NULL, ®s ); #elif defined( MD_ppc ) regs.eip = ptrace( PTRACE_PEEKUSER, pid, REGSIZE * PT_NIP, NULL ); #endif if( WIFSTOPPED( status ) ) { /* If debuggee has dynamic section, try getting the r_debug struct * every time the child process stops. The r_debug data may not be * available immediately after the child process first loads. */ if( !HaveRdebug && (DbgDyn != NULL) ) { if( Get_ld_info( pid, DbgDyn, &Rdebug, &DbgRdebug ) ) { AddLibrary( pid, Rdebug.r_map ); HaveRdebug = true; /* Set a breakpoint in dynamic linker. That way we can be * informed on dynamic library load/unload events. */ ReadMem( pid, &saved_opcode, Rdebug.r_brk, sizeof( saved_opcode ) ); dbg_printf( "setting ld breakpoint at %p, old opcode was %X\n", Rdebug.r_brk, saved_opcode ); WriteMem( pid, &brk_opcode, Rdebug.r_brk, sizeof( brk_opcode ) ); } } sample_continue = false; switch( (ptrace_sig = WSTOPSIG( status )) ) { case SIGSEGV: dbg_printf( "SIGSEGV at %p\n", regs.eip ); sample_continue = true; break; case SIGILL: dbg_printf( "SIGILL at %p\n", regs.eip ); sample_continue = true; break; case SIGABRT: dbg_printf( "SIGABRT at %p\n", regs.eip ); sample_continue = true; break; case SIGINT: dbg_printf( "SIGINT at %p\n", regs.eip ); sample_continue = true; break; case SIGTRAP: dbg_printf( "SIGTRAP at %p\n", regs.eip ); if( ProcessBreakpoint( pid, regs.eip ) ) { // don't pass on SIGTRAP if we expected this breakpoint ptrace_sig = 0; } sample_continue = true; break; case SIGSTOP: /* presumably we were behind this SIGSTOP */ RecordSample( regs.eip, 1 ); ptrace_sig = 0; sample_continue = true; break; default: /* all other signals get passed down to the child and we let * the child handle them (or not handle and die) */ sample_continue = true; break; } } else if( WIFEXITED( status ) ) { dbg_printf( "WIFEXITED pid %d\n", pid ); report(); sample_continue = false; } else if( WIFSIGNALED( status ) ) { dbg_printf( "WIFSIGNALED pid %d\n", pid ); report(); sample_continue = false; } } while( sample_continue ); } static int GetExeNameFromPid( pid_t pid, char *buffer, int max_len ) { char procfile[24]; int len; sprintf( procfile, "/proc/%d/exe", pid ); len = readlink( procfile, buffer, max_len ); if( len < 0 ) len = 0; buffer[len] = '\0'; return( len ); }
wxString PCB_BASE_EDIT_FRAME::CreateNewLibrary(const wxString& aLibName ) { // Kicad cannot write legacy format libraries, only .pretty new format // because the legacy format cannot handle current features. // The footprint library is actually a directory wxString initialPath = wxPathOnly( Prj().GetProjectFullName() ); wxFileName fn; bool doAdd = false; if( aLibName.IsEmpty() ) { fn = initialPath; if( !LibraryFileBrowser( false, fn, KiCadFootprintLibPathWildcard(), KiCadFootprintLibPathExtension) ) { return wxEmptyString; } doAdd = true; } else { fn = aLibName; if( !fn.IsAbsolute() ) { fn.SetName( aLibName ); fn.MakeAbsolute( initialPath ); } // Enforce the .pretty extension: fn.SetExt( KiCadFootprintLibPathExtension ); } // We can save fp libs only using IO_MGR::KICAD_SEXP format (.pretty libraries) IO_MGR::PCB_FILE_T piType = IO_MGR::KICAD_SEXP; wxString libPath = fn.GetFullPath(); try { PLUGIN::RELEASER pi( IO_MGR::PluginFind( piType ) ); bool writable = false; bool exists = false; try { writable = pi->IsFootprintLibWritable( libPath ); exists = true; // no exception was thrown, lib must exist. } catch( const IO_ERROR& ) { } if( exists ) { if( !writable ) { wxString msg = wxString::Format( FMT_LIB_READ_ONLY, libPath ); DisplayError( this, msg ); return wxEmptyString; } else { wxString msg = wxString::Format( _( "Library %s already exists." ), libPath ); KIDIALOG dlg( this, msg, _( "Confirmation" ), wxOK | wxCANCEL | wxICON_WARNING ); dlg.SetOKLabel( _( "Overwrite" ) ); dlg.DoNotShowCheckbox( __FILE__, __LINE__ ); if( dlg.ShowModal() == wxID_CANCEL ) return wxEmptyString; pi->FootprintLibDelete( libPath ); } } pi->FootprintLibCreate( libPath ); } catch( const IO_ERROR& ioe ) { DisplayError( this, ioe.What() ); return wxEmptyString; } if( doAdd ) AddLibrary( libPath ); return libPath; }