[Qt-creator] Debugger display for array data

Poenitz Andre Andre.Poenitz at digia.com
Fri Nov 16 11:21:44 CET 2012

On Thu, Nov 15, 2012 at 05:27:49PM +0000, May, Ryan wrote:
> [...]This is pretty much where my thoughts had gone; thanks for the reference 
>  and the concrete example (I've played with simpler dumpers before).  
> My big stumbling block right now is: how can I get this dumper to run for 
> data not in a class, but for a local function variable like:
> unsigned char data[240][240];
> It's old code from C, so I don't have the luxury of a proper data structure. 
> I can't find any way to get this dumped as a whole rather than as a tree of char.

Even in C you can have structures for that, i.e. 
typdef struct  { unsigned char data[240][240]; } data_t;
You'd even gain "assignability" that way.

Anyway. I see three options:

(a) Actually use a struct like above in your code and write a dumper for it.

(b) Add that struct definition to your code, write a dumper for it, and 
    when in need of inspecting the data, use an Expression Evaluator on
   *(data_t*) &your_data;  (or {data_t} your_data;

(c) Hack your dumper into the "if type.code == ArrayCode:" blob in
   dumper.py, recognize your special situation and fall back to the
   existing implementation when needed.

I think (a) is cleanest and least maintenance/usability effort in the long
run, but would mean touching your code.


More information about the Qt-creator mailing list