From e9adb3ab29a37e0fc29387b32cb5acc5e5ca148a Mon Sep 17 00:00:00 2001 From: Fritz Stracke <fritz.stracke@rwth-aachen.de> Date: Wed, 10 May 2023 12:49:23 +0200 Subject: [PATCH] Remove absolute path in cricket start command. - Removed two absolute paths in start command. - Fixes issue in said command. - The location of cricket can now be specified using CRICKET_PATH variable. Signed-off-by: Niklas Eiling <niklas.eiling@eonerc.rwth-aachen.de> --- gpu/src/main.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/gpu/src/main.c b/gpu/src/main.c index 3fcb864..a1d5dfe 100644 --- a/gpu/src/main.c +++ b/gpu/src/main.c @@ -31,7 +31,7 @@ #include "gdb.h" #ifndef LOG_LEVEL -#define LOG_LEVEL LOG_INFO +#define LOG_LEVEL LOG_DEBUG #endif #define CRICKET_PROFILE 1 @@ -1096,6 +1096,8 @@ detach: int cricket_start(int argc, char *argv[]) { + char* cricket_path; + char cmd_str[1024]; struct cmd_list_element *alias = NULL; struct cmd_list_element *prefix_cmd = NULL; struct cmd_list_element *cmd = NULL; @@ -1105,12 +1107,19 @@ int cricket_start(int argc, char *argv[]) return -1; } + cricket_path = getenv("CRICKET_PATH"); + if (cricket_path == NULL) { + LOG(LOG_DEBUG, "no cricket path specified. assuming /usr/local/cricket\n"); + cricket_path = "/usr/local/cricket"; + } + gdb_init(argc, argv, argv[2], NULL); /* load files */ //exec_file_attach(argv[2], !batch_flag); // - execute_command("set exec-wrapper env 'LD_PRELOAD=/opt/cricket/bin/libtirpc.so.3:/opt/cricket/bin/cricket-server.so' 'LOG=DEBUG'", !batch_flag); + snprintf(cmd_str, 1024, "set exec-wrapper env 'LD_PRELOAD=%s/bin/libtirpc.so.3:%s/cpu/cricket-server.so' 'LOG=DEBUG'", cricket_path, cricket_path); + execute_command(cmd_str, !batch_flag); //execute_command("break main", !batch_flag); execute_command("starti", !batch_flag); //execute_command("unset exec-wrapper", !batch_flag); -- GitLab