You are not logged in.

magpielover

Beginner

  • "magpielover" is male
  • "magpielover" started this thread

Posts: 13

Location: Finland

  • Send private message

1

Monday, December 19th 2011, 9:31am

[SOLVED]Qt debugger doesn't work properly, an important bug?

Hello,
I am trying to see the first ten values of a particular memory space pointed by a pointer. I can do it by evaluating an expression on Locals and Expressions window. Simply, hover on an expression and right-click "Evaluate Expression". Identifier will be shown on the window split down. In order to monitor first ten values, put " @10 " at the end of the identifier. It works properly for the local pointers in my program.
However, the problem arises when I use a library of which I have the source code. When I try to see the first ten values of an array passed to a method which I call from the library.dll, debugger shows some nonsense numbers
Such that,

Source code

1
2
double *vector1;double *vector2;...
double aa =  m_MyModul->m_pMyAPI->My_GetDistance(vector1,vector2);


In the code above, the values of vector1 and vector2 are different from the ones below.
The following method is in my API.

Source code

1
2
3
double My_GetDistance(double* x_bins, double* y_bins)
{        return theFex->GetDist(x_bins, y_bins);
}


In the code above, vector1 and x_bins must be the same. But debugger shows something completely different.
Oddly enough, if I put this code into the library source code
[code]for(int i=0;i<9;i++)
qDebug()<I am getting the first ten values on Terminal and they seem to be what I would normally expect.
The values are different from the ones in the Locals and Expressions window. More specifically, the values in the Locals and Expressions windows are not meaningful at all.
I presume it's a problem related to gdb but I am not sure.
Is there anyone who can give me any advice or who encountered such a problem before?

Thanks

This post has been edited 3 times, last edit by "magpielover" (Dec 19th 2011, 10:52am)


2

Monday, December 19th 2011, 10:14am

assuming everything is compiled with debug symbols (is this the case?), then it does sound like a bug, but it's not something I'm very familiar with.
If you have a problem, CUT and PASTE your code. Do not retype or simplify it. Give a COMPLETE and COMPILABLE example of your problem. Otherwise we are all guessing the problem from a fabrication where relevant details are often missing.

magpielover

Beginner

  • "magpielover" is male
  • "magpielover" started this thread

Posts: 13

Location: Finland

  • Send private message

3

Monday, December 19th 2011, 10:40am

Correct,
it's in debug mode.
I hope it's not a bug and I can find a solution without waiting for the next release :)

magpielover

Beginner

  • "magpielover" is male
  • "magpielover" started this thread

Posts: 13

Location: Finland

  • Send private message

4

Monday, December 19th 2011, 10:51am

I have found the solution.

When you evaluate the pointer in the Locals and Expressions window, before putting @10, you should dereference it.
That is,

Instead of, pointer@10
use, *pointer@10.