Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[cdt-dev] Interacting with GDB/MI through Eclipse console

Hi guys,

I have been partially able to add a new MI command to GDB and to CDT. I can call a test GDB/MI command which displays "Hello", from the Eclipse UI. I embedded a call to my function/ MI command in the stepinto() function. So when I press the stepinto button in Eclipse UI, my test command in 'gdb' gets called and "Hello" is displayed in the Eclipse Console.
The real command which I now intend to call from Eclipse UI requires user input. It processes the user input and then displays the result. If I try calling this command using the method similar to the test command (the command displaying "Hello"), Eclipse hangs. Rather at the backend 'gdb' waits for user input which it does not receive. I have a scanf statement in the function corresponding to my gdb command. Since that scanf does not receive any data, everything stops working. I guess gdb when working through the MI interface requires some out of band result records like *stopped or ^running which it then interprets and displays result accordingly. Hence there is no output.
If I hardcode the user input, without asking the user for it (commenting the scanf statement), and run Eclipse I receive the output on the Eclipse Console as necessary. Because this time at the end of the function gdb knows that the function for my command is over.
But if I ask user to input the values, nothing happens as explained above. I thought that Eclipse will display the prompt "Enter your Choice" as my function in gdb does if I run the command in the Terminal. But that does not happen too. Is there any way to tell the GDB/MI that user input is needed and to display the prompt on the Eclipse console ? Because normal command like step or resume or step over do not need user input so I cannot make any sense even after reading that code.
Can anyone please help me on this ? If you have not understood my issue please let me know I will try to further clarify it. Thanks for your help guys.

Thanks & Regards,
Rohit Girme

Back to the top