External BAT shell redirect to eclipse CDT Console #531
-
Hello, We use a in-house chip simulator to debug some embedded projects (mix of C + ASM) using eclipse CDT and GDB. (The chip simulator implements a GdbServer stub which is good enough for our purposes). Originally we used a 'Zylin embedded debug' configuration (under eclipse CDT [Juno 2013-02], Windows 10), which worked fine. Under GDB 'Initialization' commands we launched the simulator from within a shell like this: launch.bat took some actions, which included prompting the user for some choices, and then launches the simulator. The reason for this is that the simulator had to complete some actions first before it could start to listen for the GDB connection. So the shell launched from eclipse CDT only returned after these actions were completed by launch.bat. Only then did GDB (under eclipse CDT) connect with: target remote:1234 Another thing to note was that the bat file was launched in an external Windows console (eg. cmd.exe), which stayed open for the duration of the execution of the simulator (and it's output is not redirected to the eclipse Console). Recently we upgraded to eclipse CDT 2022-06. This does not have the 'Zylin embedded debug' option anymore, so I used the 'GDB Hardware Debugging' option. I tried to duplicate the same solution as before, but now eclipse, directly after the launch.bat prompted the user (in an external cmd.exe), suddenly is redirecting the shell output to the eclipse Console. But this somehow interrupts the bat file (the simulator never starts) and the GDB remote communication is never established. If I comment the shell x:/some/path/to/launch.bat line and execute launch.bat manually, and then start the debug configuration in eclipse CDT, everything works fine i.e. like what I want. So it seems that 'GDB Hardware Debugging' itself does not cause this, but that the redirection of the shell output causes this. So my question is: how can I force the 'shell [command]' to launch in an external console, and not be redirected back to the eclipse console? Best regards |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
I would recommend creating an Eclipse External Tool Configuration of type Program to invoke your
You will need to add You can then create an Eclipse Launch Group to launch your external tool launch configuration and your GDB debug launch configuration in sequence. When adding the external tools configuration to the launch group, use the following options:
You might find the following note useful: https://www.codeconfidence.com/technote-0005.shtml |
Beta Was this translation helpful? Give feedback.
I would recommend creating an Eclipse External Tool Configuration of type Program to invoke your
launch.bat
file. You can force an external console using the following settings in the launch configuration:C:\Windows\System32\cmd.exe
/c "start launch.bat"
You will need to add
exit
as a final command in yourlaunch.bat
file to close the console and you will probably wish to disable Build before launch in the launch configuration.You can then create an Eclipse Launch Group to launch your external tool launch configuration and your GDB debug launch configuration in sequence. When adding the external tools configuration to the launch group, use the following options: