This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Parsing arguments to main() through debugger

I am trying to pass arguments to main function while calling the program to execute through the debugger but it does not work. The debugger has automatically enabled me semihosting on my target (in ELF) but I cannot pass any arguments in main().

My test program is something like :

int main(int argc, char *argv[]) {

 

printf("%d\n",argc);
return 0;

}

so I want to print the number of arguments that passed. I call the debugger using a script file and inside that script I have load the .axf file and set the parameters like:

set semihosting args "Hello" "World"
cd "path-to-Workspace"

set debug-from main
run "Hello" "World" 

The debugger keeps answering me [target] 0

So what an i doing wrong? There is not much information for that in the internet and I cannot find any relevant information about it.

Parents Reply Children
No data