patch to access and retain the original name/type of an SBType

The attach patch makes it possible to get the name of a type as emitted in the dwarf debug info, through SBType type, instead of the clang name for it. This is useful for debugging non-C based languages to get their real type name from a type. It doesn't affect any of the existing apis (it only adds new ones) and it's tested.

the patch is based on the Windows branch, if approved I can redo the changes for trunk & commit.

lldb-get-access-to-type-original-name.patch (10.4 KB)

I would rather this not make it into the API if we can avoid it.

Why do you need this? Can you give some justification?

Op 29-10-2012 20:54, Greg Clayton schreef:

I would rather this not make it into the API if we can avoid it.

Why do you need this? Can you give some justification?

my language has it's own type system. There are lots of types in it, and none of them match the c/c++ names. However when calling GetName() all that info is lost and i get back something like "unsigned short" or "char*". On the calling side I have no way to turn that back into their real types, I need this info to know if something is a (string) character or if it's a 16bits integer, or for pointer types, if they should be treated specials (some pointer to type-types are arrays while others are not). C has no such distinction.

Can you fix this by having your language emit better DWARF? Like use typedefs and other common source idioms? Do you have your own debug info parser, or are you using DWARF?

Op 29-10-2012 21:55, Greg Clayton schreef:

Op 29-10-2012 20:54, Greg Clayton schreef:

I would rather this not make it into the API if we can avoid it.

Why do you need this? Can you give some justification?

> my language has it's own type system. There are lots of types in it,

and none of them match the c/c++ names. However when calling GetName()
all that info is lost and i get back something like "unsigned short" or
"char*". On the calling side I have no way to turn that back into their
real types, I need this info to know if something is a (string)
character or if it's a 16bits integer, or for pointer types, if they
should be treated specials (some pointer to type-types are arrays while
others are not). C has no such distinction.

Can you fix this by having your language emit better DWARF? Like use

typedefs and other common source idioms? Do you have your own debug info
parser, or are you using DWARF?

I am emitting proper DWARF. It's just that LLDB ignores the "name" of the dwarf records and several other things and makes presumptions on the debugged language being C/C++/ObjC, ignoring what the debug info says a type is really called and using it's own type names based on the bitsize and dwarf flags.

Then lets fix this and not add new API functions.

LLDB does currently ignore the names of built-in types, but we can modify it so that if a name is provided and it doesn't match the name of the clang type that is returned, then we create a typedef for it. This will be very easy to add and not add anything to the API.

Greg

Op 30-10-2012 00:30, Greg Clayton schreef:

Try this patch out:

This should do what you want?

This patch has been working very well for me, can this become part of the offical lldb?

How would I do the same for (named) pointers? I tried doing the same in SymbolFileDWARF.cpp for DIE_eEncodingIsPointerUID but it seemed to give asserts because byte_size is 0.