/*static*/ status_t BPathFinder::FindPaths(const char* architecture, path_base_directory baseDirectory, const char* subPath, uint32 flags, BStringList& _paths) { _paths.MakeEmpty(); // get the paths char** pathArray; size_t pathCount; status_t error = find_paths_etc(architecture, baseDirectory, subPath, flags, &pathArray, &pathCount); if (error != B_OK) return error; MemoryDeleter pathArrayDeleter(pathArray); // add them to BStringList for (size_t i = 0; i < pathCount; i++) { BString path(pathArray[i]); if (path.IsEmpty() || !_paths.Add(path)) { _paths.MakeEmpty(); return B_NO_MEMORY; } } return B_OK; }
status_t TeamDebugHandler::_SetupGDBArguments(BStringList &arguments, bool usingConsoled) { // prepare the argument vector BString teamString; teamString.SetToFormat("--pid=%" B_PRId32, fTeam); status_t error; BPath terminalPath; if (usingConsoled) { error = find_directory(B_SYSTEM_BIN_DIRECTORY, &terminalPath); if (error != B_OK) { debug_printf("debug_server: can't find system-bin directory: %s\n", strerror(error)); return error; } error = terminalPath.Append("consoled"); if (error != B_OK) { debug_printf("debug_server: can't append to system-bin path: %s\n", strerror(error)); return error; } } else { error = find_directory(B_SYSTEM_APPS_DIRECTORY, &terminalPath); if (error != B_OK) { debug_printf("debug_server: can't find system-apps directory: %s\n", strerror(error)); return error; } error = terminalPath.Append("Terminal"); if (error != B_OK) { debug_printf("debug_server: can't append to system-apps path: %s\n", strerror(error)); return error; } } arguments.MakeEmpty(); if (!arguments.Add(terminalPath.Path())) return B_NO_MEMORY; if (!usingConsoled) { BString windowTitle; windowTitle.SetToFormat("Debug of Team %" B_PRId32 ": %s", fTeam, _LastPathComponent(fExecutablePath)); if (!arguments.Add("-t") || !arguments.Add(windowTitle)) return B_NO_MEMORY; } BPath gdbPath; error = find_directory(B_SYSTEM_BIN_DIRECTORY, &gdbPath); if (error != B_OK) { debug_printf("debug_server: can't find system-bin directory: %s\n", strerror(error)); return error; } error = gdbPath.Append("gdb"); if (error != B_OK) { debug_printf("debug_server: can't append to system-bin path: %s\n", strerror(error)); return error; } if (!arguments.Add(gdbPath.Path()) || !arguments.Add(teamString)) return B_NO_MEMORY; if (strlen(fExecutablePath) > 0 && !arguments.Add(fExecutablePath)) return B_NO_MEMORY; return B_OK; }