Ticket #2185: src_servers_debug_DebugServer.cpp.diff

File src_servers_debug_DebugServer.cpp.diff, 2.3 KB (added by kaoutsis, 11 years ago)
  • src/servers/debug/DebugServer.cpp

     
    1717#include <Autolock.h>
    1818#include <debug_support.h>
    1919#include <Entry.h>
     20#include <FindDirectory.h>
    2021#include <Invoker.h>
     22#include <Path.h>
    2123
    2224#include <RegistrarDefs.h>
    2325#include <RosterPrivate.h>
     
    4042
    4143static const char *kSignature = "application/x-vnd.Haiku-debug_server";
    4244
    43 // paths to the apps used for debugging
    44 static const char *kConsoledPath    = "/bin/consoled";
    45 static const char *kTerminalPath    = "/boot/beos/apps/Terminal";
    46 static const char *kGDBPath         = "/bin/gdb";
    4745
    48 
    4946// KillTeam
    5047static void
    5148KillTeam(team_id team, const char *appName = NULL)
     
    444441    char teamString[32];
    445442    snprintf(teamString, sizeof(teamString), "--pid=%ld", fTeam);
    446443
    447     const char *terminal = (debugInConsoled ? kConsoledPath : kTerminalPath);
     444    BPath terminalPath;
     445    error = find_directory(B_BEOS_APPS_DIRECTORY, &terminalPath);
     446    if (error == B_OK) 
     447        error = terminalPath.Append("Terminal");
    448448
     449    if (error < B_OK) {
     450        debug_printf("Composing the path failed! At %s, %s, %d.\n"
     451            "Reason: %s\n", __FILE__, __PRETTY_FUNCTION__, __LINE__,
     452            strerror(error));
     453        return error;
     454    }
     455
     456    BPath consoledPath;
     457    error = find_directory(B_BEOS_BIN_DIRECTORY, &consoledPath);
     458    if (error == B_OK) 
     459        error = consoledPath.Append("consoled");
     460
     461    if (error < B_OK) {
     462        debug_printf("Composing the path failed! At %s, %s, %d.\n"
     463            "Reason: %s\n", __FILE__, __PRETTY_FUNCTION__, __LINE__,
     464            strerror(error));
     465        return error;
     466    }
     467
     468    const char* terminal = debugInConsoled ? consoledPath.Path()
     469        : terminalPath.Path();
     470
    449471    const char *argv[16];
    450472    int argc = 0;
    451473
     
    459481        argv[argc++] = windowTitle;
    460482    }
    461483
    462     argv[argc++] = kGDBPath;
     484    BPath gdbPath;
     485    error = find_directory(B_BEOS_BIN_DIRECTORY, &gdbPath);
     486    if (error == B_OK)
     487        error = gdbPath.Append("gdb");
     488
     489    if (error < B_OK) {
     490        debug_printf("Composing the path failed! At %s, %s, %d.\n"
     491            "Reason: %s\n", __FILE__, __PRETTY_FUNCTION__, __LINE__,
     492            strerror(error));
     493        return error;
     494    }
     495
     496    argv[argc++] = gdbPath.Path();
    463497    argv[argc++] = teamString;
    464498    if (strlen(fExecutablePath) > 0)
    465499        argv[argc++] = fExecutablePath;