No function parameters in debugger?

General questions regarding the usage of CodeLite
marksibly
CodeLite Enthusiast
Posts: 23
Joined: Thu Oct 30, 2008 1:40 am
Contact:

No function parameters in debugger?

Post by marksibly »

Hi,

Not sure if this is new to v6, but I'm having a problem where I can't see function parameter locals in the 'Locals' window - it's only showing locals declared within the function.

Is there something I need to enable perhaps?

Bye!
Mark
User avatar
eranif
CodeLite Plugin
Posts: 6367
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: No function parameters in debugger?

Post by eranif »

Can you please submit a screenshot?
Eran
Make sure you have read the HOW TO POST thread
marksibly
CodeLite Enthusiast
Posts: 23
Joined: Thu Oct 30, 2008 1:40 am
Contact:

Re: No function parameters in debugger?

Post by marksibly »

I'll try!

Image

I'm no gdb expert, but I kind of expected 'frames', 'tx', 'ty', and 'scale' (and 'this'!) to appear in the lower right hand debugger/locals panel, but they don't.

The same thing happens all the way down the call stack.

I've try clicking the 'refresh' button.

The only potentially weird thing I can think of is that the assert is my own inlined version - hence the mystery local 'cond' I guess.

Codelite version is 6.0.
User avatar
eranif
CodeLite Plugin
Posts: 6367
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: No function parameters in debugger?

Post by eranif »

I just tried a simple function and I got the function arguments. I think its something that has to do with gdb and your function
Here is a screenshot:
1.png
Can you try a simpler example?
Do you get tooltip for those arguments? (hover them with the mouse OR (depend on your settings) Hover+CTRL click)

Eran
You do not have the required permissions to view the files attached to this post.
Make sure you have read the HOW TO POST thread
marksibly
CodeLite Enthusiast
Posts: 23
Joined: Thu Oct 30, 2008 1:40 am
Contact:

Re: No function parameters in debugger?

Post by marksibly »

Ok, the problem seems to be related to trying to view locals further down the callstack.

For example, with the below code, if I run/continue the code until it breakpoints inside test(), then double click on main() in the callstack window, I can't view the locals for 'main' in the locals window - only 'x' and 'y' from test(), and there's something weird about these too - I can't 'open' them the way I can usually open std::string objects in the locals window.

Here's the state of things with the code stopped inside test() (so test and main are both on the callstack) but main 'selected' by double click in the callstack window. I would have expected to see argc and argv in the locals window. Also, in this state I can get tooltips for argc and argv, but not x, y and z in test().

Image

Code: Select all

#include <string>

void blah( const std::string &q ){
	puts( "BREAKPOINT!" );		//breakpoint here...
}

void test( const std::string &x,const std::string &y ){
	std::string z=x+y;
	blah( z );					//and here!
}

int main( int argc,char **argv){
	test( "Hello","World" );	//and here!
	return 0;
}
Maybe it's my version of gdb/mingw, or I'm just doing it wrong or something, but I don't remember having any of these problems with v5...?
User avatar
eranif
CodeLite Plugin
Posts: 6367
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: No function parameters in debugger?

Post by eranif »

Your sample works fine here.
Did you try updating your gdb version?
1.png
2.png
3.png
Eran
You do not have the required permissions to view the files attached to this post.
Make sure you have read the HOW TO POST thread
marksibly
CodeLite Enthusiast
Posts: 23
Joined: Thu Oct 30, 2008 1:40 am
Contact:

Re: No function parameters in debugger?

Post by marksibly »

The problem is with viewing locals that are *not* at the top of the callstack.

I've just checked, and it's happening on Linux too - latest updated 32 bit Ubuntu 14.04. Doesn't this make it less likely to be a gdb issue?

I'm used to working without a debugger, so it's not that big a deal, but it would definitely be nice to get it going. So please try this:

1) Create g++ console project with code below.

2) Toggle breakpoint on the puts() line in 'test2'.

3) Debug program.

4) When program stops, go to Debugger/Call Stack pane. (Note that on Windows, I actually have to click on a different tab and then click back to Call Stack before anything actually appears there - on Linux, it works first time).

5) Double click on 'main' in the Debugger/Call Stack pane.

6) Go back to Debugger/Locals pane - on both Windows and Linux, I can only see 'p' here. I would have expected to see 'argc' and 'argv'.

7) Ditto, try going to 'test' on the call stack. I can see 'z' and 'p' here (after clicking the refresh button in the Debugger/Locals pane). I would have expected to see 'x', 'y' and 'z'.

Code: Select all

#include <stdio.h>

void test2( int p ){
	puts( "TEST2" );	//breakpoint here!
}

void test( int x,int y ){
	int z=x+y;
	test2( z );
}

int main( int argc,char **argv ){
	test( 10,20 );
	return 0;
}
If you still can't reproduce, I'll give up!
User avatar
eranif
CodeLite Plugin
Posts: 6367
Joined: Wed Feb 06, 2008 9:29 pm
Genuine User: Yes
IDE Question: C++
Contact:

Re: No function parameters in debugger?

Post by eranif »

marksibly wrote:If you still can't reproduce, I'll give up!
:) Lucky for you, I was able to see what you mean

When switching between frames, codelite used 2 commands to print the arguments:

Code: Select all

-stack-list-locals
-stack-list-arguments
The second command ( -stack-list-arguments ) accepts the frame number as an input argument - this is where the problem was, codelite always passed '0'...

I switched to using the new command:

Code: Select all

-stack-list-arguments
which always works on the active frame and prints both function arguments _and_ the function locals

Fixed and committed in git head
If you are interested in gdb's MI stack manipulation commands, see here: https://sourceware.org/gdb/onlinedocs/g ... nipulation

Eran
Make sure you have read the HOW TO POST thread
marksibly
CodeLite Enthusiast
Posts: 23
Joined: Thu Oct 30, 2008 1:40 am
Contact:

Re: No function parameters in debugger?

Post by marksibly »

Sweet! All fixed, thanks!
Post Reply