[Lldb-commits] [PATCH] D53731: [NativePDB] Add the ability to display global variables

Jim Ingham via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Oct 25 17:41:40 PDT 2018


jingham added a comment.

The first of the commands you showed presents info we definitely should add to type lookup.  I actually have a bug around to do that, but it hasn't risen to the top of my queue because it's trivial to do with the SB API's so every time I've needed that info I get it from script.  Selfish me...

The second command is done in lldb with "memory read -t TYPE", and you can also use the "-c COUNT" argument to treat the memory as an array of COUNT elements of the TYPE:

  (lldb) fr v myFoo
  (foo *) myFoo = 0x0000000100400000
  (lldb) memory read -t foo 0x0000000100400000
  (foo) 0x100400000 = {
    First = 0
    Second = 0
  }
  (lldb) memory read -t foo 0x0000000100400000 -c 10
  (foo) 0x100400000 = {
    First = 0
    Second = 0
  }
  (foo) 0x100400008 = {
    First = 1
    Second = 10
  }
  (foo) 0x100400010 = {
    First = 2
    Second = 20
  }

if you want to also see the types of all the subelements add the -T flag, and if you want to see all the memory locations of the subelements, add the -L flag:

  (lldb) memory read -t foo 0x0000000100400000 -c 10 -T -L
  0x0000000100400000: (foo) 0x100400000 = {
  0x0000000100400000:   (int) First = 0
  0x0000000100400004:   (int) Second = 0
  }
  0x0000000100400008: (foo) 0x100400008 = {
  0x0000000100400008:   (int) First = 1
  0x000000010040000c:   (int) Second = 10
  }

BTW, the latter two flags have the same meaning pretty much wherever we print values (expression, frame var...)


https://reviews.llvm.org/D53731





More information about the lldb-commits mailing list