Page 1 of 1

Displaying Message in GDB Output Pane

Posted: Mon Aug 19, 2013 5:43 pm
by Verax
I'm using a method called "semihosting" to print messages from my ARM embedded system to GDB console.

It works well when I run GDB from a command prompt,...
GDB.png
...but I don't see the message in CodeLite's Debugger Output window:
CodeLite.png
If I "Enable debugger full logging" I can see the message, but not in the same way it appears in the command prompt:
FullLog.png
How can I reproduce the same results from the command prompt in CodeLite?

Thanks,
Mike

CodeLite 5.2, Windows 8 Pro 64-bit.

Re: Displaying Message in GDB Output Pane

Posted: Tue Aug 20, 2013 6:32 am
by Gibbon1
Not sure, but from the Debug stuff you've posted it looks like codelite talks to GDB via the machine interface, if that helps.

Re: Displaying Message in GDB Output Pane

Posted: Tue Aug 20, 2013 9:16 am
by eranif
As Gibbon1 noticed, codelite communicates with gdb using the machine interface.
You message is considered as "target-stream-output" (a message produced by the target program) and thus it should appear in the console _not_ in codelite's gdb window
For example, when I debug a simple console application codelite will create another instance of CMD.EXE which will contain all the program output.
I am not sure if this is done when debugging an embedded target or not...

How do you produce this message? is this a simple 'printf'?

Eran

Re: Displaying Message in GDB Output Pane

Posted: Tue Aug 20, 2013 9:19 am
by eranif
Ok, I have read about semihosting here: http://infocenter.arm.com/help/index.js ... jjgij.html
So its basically similar to printf... however, I am guessing that you don't have that extra console I talked about
But I can still capture and output it - I will fix this

Eran

Re: Displaying Message in GDB Output Pane

Posted: Tue Aug 20, 2013 9:22 am
by eranif
If you are using codelite from git head, you might want to 'git pull' and try the fix I have committed

Eran

Re: Displaying Message in GDB Output Pane

Posted: Tue Aug 20, 2013 11:07 am
by Verax
Thanks Eran,

I'll try to test it soon. But your comments beg the question: Is the output window the appropriate place to display such messages?

You mentioned an "extra console". How do I open this console?

Re: Displaying Message in GDB Output Pane

Posted: Tue Aug 20, 2013 11:30 am
by eranif
Verax wrote:I'll try to test it soon. But your comments beg the question: Is the output window the appropriate place to display such messages?
I see no other window that can be used for this purpose
Verax wrote:You mentioned an "extra console". How do I open this console?
If you don't have it, it means gdb was unable to create one for you. It usually done automatically by gdb. Try creating a simple hello world program and you will see what I mean

It is done by calling to "set new-console on" in gdb prompt (you should see this command when you have the logging enabled for gdb inside codelite)

Eran

Re: Displaying Message in GDB Output Pane

Posted: Sat Aug 24, 2013 4:13 pm
by Verax
I can see the message in Debug's Output window. But it looks like the carriage return '\r' was not processed. Here's an image.

My code looks like this:

Code: Select all

dbg_write_str("^Reset Handler\r\n");
Output.png
Also, it appears arm-none-eabi-gdb.exe doesn't have the "set new-console" command. Here's an output from GDB's help:
gdb.png
So, I guess that explains why the extra console doesn't appear.

Re: Displaying Message in GDB Output Pane

Posted: Sat Aug 24, 2013 5:06 pm
by eranif
I committed a small fix that should remove those extra \r\n
Please give it a try

note that I am coding on a hunch here ( can't reproduce any of your problems ;) )

Eran

Re: Displaying Message in GDB Output Pane

Posted: Mon Aug 26, 2013 4:20 am
by Verax
Thanks, Eran. But, the latest change didn't seem to work. The result is the same.

I realize you're coding blind, so I'll try to figure out how to debug CodeLite in CodeLite and see if I can make a patch.