Debugging an array of pointers to structures

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

Debugging an array of pointers to structures

558 次查看
michaelhuslig
Contributor IV

I have an array of structure points which is working in my code (struct userst * user_ptr[MAXUSERS]).  What I want to do in debug is hover over the declaration to see what is there.  What I am getting now is just:

Expression                  Type                                              Value

user_ptr                       struct userst *[]                             [0]

Using the memory browser I can see I have entries, and my code sees them properly too.  It would be nice to see the pointers in debug, even better to see the structures.

This is KDS3.2 with the latest updates using a MK22FX512

0 项奖励
5 回复数

404 次查看
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello ,

Could you please show your project to let's see your code in detail .

Then I can debug it on my side to check .

BR

Alice

0 项奖励

404 次查看
michaelhuslig
Contributor IV

Alice,

I forgot to mention that I am using PE micro's Multilink Universal.  Is

this something to do with the gdb server?  How much of my project would

you need.  Wouldn't you need my custom board in order to see what I am

seeing?

Mike H.

0 项奖励

404 次查看
BlackNight
NXP Employee
NXP Employee

Hi Michael,

which debug probe you are using should not be relevant.

I tried to reproduce your problem, but works for me:

pastedImage_1.png

I used the following:

#define MAXUSERS 3
typedef struct userst {
  int a;
} userst;
struct userst a, b, c;
struct userst* user_ptr[MAXUSERS];

What is really needed is a piece of code to reproduce what you see.

I hope this helps,

Erich

0 项奖励

404 次查看
michaelhuslig
Contributor IV

Erich,

My structures were a lot more complicated.  I ended up declaring

individual array pointers and assigning them the same values in the

array.  This way I was able to examine the selected structures I needed

in debug.

Mike H.

0 项奖励

404 次查看
Alice_Yang
NXP TechSupport
NXP TechSupport

Hi  Michael,

I just want to know detail what information you want to see.

Usually we check variable on ''Expressions " view of KDS you also mentioned :

pastedImage_2.png

If you want to check variable when the program on board is running, you can refer to this thread :

Automatic Variable, Expression and Memory Display with GDB and Eclipse | MCU on Eclipse  

Hope it helps


Have a great day,
TIC

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 项奖励