1

I am displaying an array (a pointer inside a structure, with the array size being defined by a calloc) using the lldb parray command given here

This shows me the value of the array in the following format:

(float *) $0 = 0x123456789 {  
 (float) [0] = 0.0012   
 (float) [1] = 0.123456   
 (float) [2] = 0.0012   
 (float) [3] = 0.123456   
 .  
 .  
 .  

I would like to only display the array's values

0.0012   
0.123456    
0.0012   
0.123456    
.  
.  
.  

How do I do this is the lldb console? I am using objective-c.

Also, is it possible to only display a range of values (such as from the 100th to the 150th element)?

Willeke
  • 14,578
  • 4
  • 19
  • 47
user13267
  • 6,871
  • 28
  • 80
  • 138

1 Answers1

2

The expr command doesn't have controls over whether to print the name/type of the subelements of an aggregate object. parray is just a particular use of the expr command. So you can't do this with the built-in commands.

You could pretty easily write a python-based command to dump the output of an array however you would like.

Also feel free to file an enhancement request with http://bugs.llvm.org to add such an option.

You can sort of display ranges by doing:

(lldb) parray 4 &array[10]
(int *) $2 = 0x0000000100300218 {
  (int) [0] = 10
  (int) [1] = 11
  (int) [2] = 12
  (int) [3] = 13
(lldb)

Of course the numbering is off (but you didn't want to see that anyway...)

Jim Ingham
  • 25,260
  • 2
  • 55
  • 63
  • Hi thank you for the answer. Would you mind having a look at my other question please? https://stackoverflow.com/questions/53331618/lldb-python-basic-print-value-of-a-global-array-while-inside-a-breakpoint-in-a?noredirect=1&lq=1 – user13267 Nov 16 '18 at 12:04