diff --git a/src/sys/error/adebug.c b/src/sys/error/adebug.c index 7b42eecdd3d..5efc65461ca 100644 --- a/src/sys/error/adebug.c +++ b/src/sys/error/adebug.c @@ -315,7 +315,12 @@ PetscErrorCode PetscAttachDebugger(void) PetscCall(PetscStrncmp(DebugTerminal,"Terminal",8,&cmp)); if (cmp) { char command[1024]; - PetscCall(PetscSNPrintf(command,sizeof(command),"osascript -e 'tell app \"Terminal\" to do script \"lldb -p %s %s \"'\n",pid,program)); + if (islldb) PetscCall(PetscSNPrintf(command,sizeof(command),"osascript -e 'tell app \"Terminal\" to do script \"lldb -p %s \"'\n",pid)); + else { + char fullprogram[PETSC_MAX_PATH_LEN]; + PetscCall(PetscGetFullPath(program,fullprogram,sizeof(fullprogram))); + PetscCall(PetscSNPrintf(command,sizeof(command),"osascript -e 'tell app \"Terminal\" to do script \"%s %s %s \"'\n",PetscDebugger,fullprogram,pid)); + } PetscCall(PetscPOpen(PETSC_COMM_SELF,NULL,command,"r",NULL)); exit(0); } diff --git a/src/sys/fileio/fpath.c b/src/sys/fileio/fpath.c index 191032654e1..c5f8d298773 100644 --- a/src/sys/fileio/fpath.c +++ b/src/sys/fileio/fpath.c @@ -31,6 +31,11 @@ PetscErrorCode PetscGetFullPath(const char path[],char fullpath[],size_t flen) fullpath[flen-1] = 0; PetscFunctionReturn(0); } + if (path[0] == '.' && path[1] == '/') { + PetscCall(PetscGetWorkingDirectory(fullpath,flen)); + PetscCall(PetscStrlcat(fullpath,path+1,flen)); + PetscFunctionReturn(0); + } PetscCall(PetscStrncpy(fullpath,path,flen)); fullpath[flen-1] = 0;