[lldb-dev] Force format for frame variable using type summary is not working as expected.

Chirag Patel via lldb-dev lldb-dev at lists.llvm.org
Wed Jan 8 00:09:33 PST 2020


Hello,

I am trying to debug a simple c program,
int main() {
    char arr[] = "Hello World!";
}

On gdb, while printing variable content with force formatting,
(gdb) l
1       int main() {
2               char arr[] = "Hello World!";
3       }
(gdb) b 3
Breakpoint 2 at 0x40050a: file string.c, line 3.
(gdb) r
Starting program: /home/chirag/Desktop/test/./a.out

Breakpoint 2, main () at string.c:3
3       }
(gdb) p arr
$4 = "Hello World!"
(gdb) p /d arr
$5 = {72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100, 33, 0}
(gdb) p /x arr
$6 = {0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x20, 0x57, 0x6f, 0x72, 0x6c, 0x64, 0x21, 0x0}
(gdb)


While on lldb,
(lldb) l
   1    int main() {
   2            char arr[] = "Hello World!";
  3    }
(lldb) b 3
Breakpoint 1: where = a.out`main + 29 at string.c:3, address = 0x000000000040050a
(lldb) r
Process 59671 launched: '/home/chirag/Desktop/test/a.out' (x86_64)
Process 59671 stopped
* thread #1, name = 'a.out', stop reason = breakpoint 1.1
    frame #0: 0x000000000040050a a.out`main at string.c:3
   1    int main() {
   2            char arr[] = "Hello World!";
-> 3    }
(lldb) fr v arr
(char [13]) arr = "Hello World!"
(lldb) fr v arr -f d
(char [13]) arr = "Hello World!"
(lldb) fr v arr -f x
(char [13]) arr = "Hello World!"
(lldb)

It seems like lldb type summary is completely ignoring the force format option, is it a bug or it is intended?

Regards,

Chirag Patel
Software Engineer | Raincode Labs India
Tel: (+91) 080 41159811
Mob: (+91) 9049336744
www.raincodelabs.com<http://www.raincodelabs.com/>
[linkedin-button]<https://in.linkedin.com/in/chirag-patel->

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20200108/dbbc3b04/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image003.png
Type: image/png
Size: 7399 bytes
Desc: image003.png
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20200108/dbbc3b04/attachment-0001.png>


More information about the lldb-dev mailing list