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

Zachary Turner via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Thu Oct 25 17:17:42 PDT 2018


zturner added a comment.

In https://reviews.llvm.org/D53731#1276818, @jingham wrote:

> dotest tests don't require a process.  Presumably dotest knows how to build windows targeted PDB debug flavor files (to go along with dwarf/dsym/etc.).  So it would be straightforward to make a test that had your input sources, built and made a target out of it and then poked at static variables and their types.  That would straightaway run with all the different symbol file formats we support.
>
> That was why using Vedant's FileCheck thing made sense to me.  You would use that to specify the test cases, since you like that way of writing tests and anyway already have them written out in that form, but use the dotest machinery to build it for whatever symfile format and target architecture/s the person who was running the test dialed up.  But if you are interesting in also getting this to work with the straight FileCheck style test, your time is your own...
>
> BTW, I would use dotest tests specifically for the kind of thing you are doing here because then you can test against the SBType and SBTypeMembers from the debug info you've ingested, which would give you bit and byte offsets and sizes for free.  But if your differing tastes end up getting you to add that info to "type lookup" - which we really should do - then I guess we win either way...


Yea, so one of the commands I'm used to on the Windows command line debugger WinDbg is the `dt` (dump type) command.  It's basically the equivalent of `type lookup` - more powerful in some ways, less in others .  The output format looks like this:

  0:000> dt _EXCEPTION_RECORD
  ntdll!_EXCEPTION_RECORD
     +0x000 ExceptionCode    : Int4B
     +0x004 ExceptionFlags   : Uint4B
     +0x008 ExceptionRecord  : Ptr64 _EXCEPTION_RECORD
     +0x010 ExceptionAddress : Ptr64 Void
     +0x018 NumberParameters : Uint4B
     +0x020 ExceptionInformation : [15] Uint8B

So you can see the field offsets and such.  (Less powerful because that's about it, no methods, for example).

But you can also pass it an address, which it then formats the block of memory as that type.  e.g.

  0:000> dt ntdll!_TEB32 00000000007ed000
     +0x000 NtTib            : _NT_TIB32
     +0x01c EnvironmentPointer : 0
     +0x020 ClientId         : _CLIENT_ID32
     +0x028 ActiveRpcHandle  : 0
     +0x02c ThreadLocalStoragePointer : 0
     +0x030 ProcessEnvironmentBlock : 0x7ed000
     +0x034 LastErrorValue   : 0
     +0x038 CountOfOwnedCriticalSections : 0
     +0x03c CsrClientThread  : 0
     +0x040 Win32ThreadInfo  : 0x4d18
     +0x044 User32Reserved   : [26] 0
     +0x0ac UserReserved     : [5] 0

So up on my list of things to implement is these two features.


https://reviews.llvm.org/D53731





More information about the lldb-commits mailing list