Displaying Message in GDB Output Pane

General questions regarding the usage of CodeLite
Verax
CodeLite Enthusiast
Posts: 46
Joined: Sat Jan 19, 2013 10:31 am
Genuine User: Yes
IDE Question: C++
Contact:

Displaying Message in GDB Output Pane

Post 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.
You do not have the required permissions to view the files attached to this post.
Gibbon1
CodeLite Expert
Posts: 167
Joined: Fri Jul 22, 2011 5:32 am
Genuine User: Yes
IDE Question: C++
Contact:

Re: Displaying Message in GDB Output Pane

Post 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.
User avatar
eranif
CodeLite Plugin
Posts: 6373
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Displaying Message in GDB Output Pane

Post 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
Make sure you have read the HOW TO POST thread
User avatar
eranif
CodeLite Plugin
Posts: 6373
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Displaying Message in GDB Output Pane

Post 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
Make sure you have read the HOW TO POST thread
User avatar
eranif
CodeLite Plugin
Posts: 6373
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Displaying Message in GDB Output Pane

Post by eranif »

If you are using codelite from git head, you might want to 'git pull' and try the fix I have committed

Eran
Make sure you have read the HOW TO POST thread
Verax
CodeLite Enthusiast
Posts: 46
Joined: Sat Jan 19, 2013 10:31 am
Genuine User: Yes
IDE Question: C++
Contact:

Re: Displaying Message in GDB Output Pane

Post 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?
User avatar
eranif
CodeLite Plugin
Posts: 6373
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Displaying Message in GDB Output Pane

Post 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
Make sure you have read the HOW TO POST thread
Verax
CodeLite Enthusiast
Posts: 46
Joined: Sat Jan 19, 2013 10:31 am
Genuine User: Yes
IDE Question: C++
Contact:

Re: Displaying Message in GDB Output Pane

Post 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.
You do not have the required permissions to view the files attached to this post.
User avatar
eranif
CodeLite Plugin
Posts: 6373
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: Displaying Message in GDB Output Pane

Post 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
Make sure you have read the HOW TO POST thread
Verax
CodeLite Enthusiast
Posts: 46
Joined: Sat Jan 19, 2013 10:31 am
Genuine User: Yes
IDE Question: C++
Contact:

Re: Displaying Message in GDB Output Pane

Post 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.
Post Reply