Post

Replies

Boosts

Views

Activity

Attach lldb debugger to the compiled program's executable when the main executable is not the compiled program
I am building an MPI C project in Xcode. In order to do run it, I had to: Specify /path/to/mpiexec in Edit Scheme -> Run -> Info -> Executable, instead of the "default" one, say myprogram if my target is called myprogram. Specify the following arguments in Edit Scheme -> Run -> Arguments -> Arguments Passed On Launch: -np 4, ${BUILT_PRODUCTS_DIR}/${EXECUTABLE_NAME} This is clearly analogous to a mpiexec -np 4 a.out command launched on terminal. The problem is, when I want to debug my application, the execution doesn't "stop" on the breakpoints. I instantly thought that it is because of the check box Debug Executable in Edit Scheme -> Run -> Info -> Executable. Indeed (as I have just said), the Executable specified in there is mpiexec and not myprogram. Thus, is there an option or some command I could set in Xcode to attach the lldb to myprogram?
2
0
269
Oct ’24
Xcode Arguments Passed On Launch won't load
I am building and running a simple Open MPI C application. In order to run it, I configured the run process in this way:\ Edit Scheme -> Run -> Info -> Executable -> Other... -> /path/to/mpiexec Edit Scheme -> Run -> Arguments -> Arguments Passed On Launch -> -np 4 "$(BUILT_PRODUCTS_DIR)/$(EXECUTABLE_NAME)" Now, instead of the hardcoded "4" as the number of processes, I want to specify an environment variable (like the already existing BUILT_PRODUCTS_DIR and EXECUTABLE_NAME environment variables), so I enter in Environment Variables NUM_PROCS as Name and 4 as Value. Thus, I write in Arguments Passed On Launch the whole quoted string: "-np" "$(NUM_PROCS)" "$(BUILT_PRODUCTS_DIR)/$(EXECUTABLE_NAME)". And Xcode can't read the NUM_PROCS environment variable (despite I can easily read it in the C program by a getenv("NUM_PROCS")!), in fact, it runs the default number of processes of my system (12). I tried in a very large number the different ways of writing arguments (every string on a new line, with quotes, without quotes, ...), but none worked as I expected. M3 Pro, macOS Sequoia 15.0.1 Xcode 16.0
2
0
267
Oct ’24