License | BSD3 |
---|---|
Maintainer | emertens@galois.com |
Stability | provisional |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
Text.LLVM.DebugUtils
Description
Synopsis
- data Info
- data StructFieldInfo = StructFieldInfo {
- sfiName :: String
- sfiOffset :: Word64
- sfiBitfield :: Maybe BitfieldInfo
- sfiInfo :: Info
- data BitfieldInfo = BitfieldInfo {}
- data UnionFieldInfo = UnionFieldInfo {}
- computeFunctionTypes :: Module -> Symbol -> Maybe [Maybe Info]
- valMdToInfo :: MdMap -> ValMd -> Info
- localVariableNameDeclarations :: IntMap ValMd -> Define -> Map Ident Ident
- mkMdMap :: Module -> IntMap ValMd
- derefInfo :: Info -> Info
- fieldIndexByPosition :: Int -> Info -> Info
- fieldIndexByName :: String -> Info -> Maybe Int
- guessAliasInfo :: IntMap ValMd -> Ident -> Info
- guessTypeInfo :: IntMap ValMd -> String -> Info
- debugInfoArgNames :: Module -> Define -> IntMap String
- debugInfoGlobalLines :: Module -> Map String Int
- debugInfoDefineLines :: Module -> Map String Int
Definition type analyzer
data StructFieldInfo Source #
Record debug information about a field in a struct type.
Constructors
StructFieldInfo | |
Fields
|
Instances
Show StructFieldInfo Source # | |
Defined in Text.LLVM.DebugUtils Methods showsPrec :: Int -> StructFieldInfo -> ShowS # show :: StructFieldInfo -> String # showList :: [StructFieldInfo] -> ShowS # |
data BitfieldInfo Source #
Record debug information about a field within a bitfield. For example, the following C struct:
struct s { int32_t w; uint8_t x1:1; uint8_t x2:2; uint8_t y:1; int32_t z; };
Corresponds to the following Info
:
Structure
[StructFieldInfo
{sfiName
= "w" ,sfiOffset
= 0 ,sfiBitfield
= Nothing ,sfiInfo
=BaseType
"int32_t" } ,StructFieldInfo
{sfiName
= "x1" ,sfiOffset
= 32 ,sfiBitfield
= Just (BitfieldInfo
{biFieldSize
= 1 ,biBitfieldOffset
= 32 }) ,sfiInfo
=BaseType
"uint8_t" } ,StructFieldInfo
{sfiName
= "x2" ,sfiOffset
= 33 ,sfiBitfield
= Just (BitfieldInfo
{biFieldSize
= 2 ,biBitfieldOffset
= 32 }) ,sfiInfo
= BaseType "uint8_t" } ,StructFieldInfo
{sfiName
= "y" ,sfiOffset
= 35 ,sfiBitfield
= Just (BitfieldInfo
{biFieldSize
= 1 ,biBitfieldOffset
= 32 }) ,sfiInfo
=BaseType
"uint8_t" } ,StructFieldInfo
{sfiName
= "z" ,sfiOffset
= 64 ,sfiBitfield
= Nothing ,sfiInfo
= BaseType "int32_t" } ]
Notice that only x1
, x2
, and y
have BitfieldInfo
s, as they are the
only fields that were declared with bitfield syntax.
Constructors
BitfieldInfo | |
Fields
|
Instances
Show BitfieldInfo Source # | |
Defined in Text.LLVM.DebugUtils Methods showsPrec :: Int -> BitfieldInfo -> ShowS # show :: BitfieldInfo -> String # showList :: [BitfieldInfo] -> ShowS # |
data UnionFieldInfo Source #
Record debug information about a field in a union type.
Constructors
UnionFieldInfo | |
Instances
Show UnionFieldInfo Source # | |
Defined in Text.LLVM.DebugUtils Methods showsPrec :: Int -> UnionFieldInfo -> ShowS # show :: UnionFieldInfo -> String # showList :: [UnionFieldInfo] -> ShowS # |
Arguments
:: Module | module to search |
-> Symbol | function symbol |
-> Maybe [Maybe Info] | return and argument type information |
Compute the structures of a function's return and argument types using DWARF information metadata of the LLVM module. Different versions of LLVM make this information available via different paths. This function attempts to support the variations.
valMdToInfo :: MdMap -> ValMd -> Info Source #
Metadata lookup
Type structure dereference
If the argument describes a pointer, return the information for the type that it points do. If the argument describes an array, return information about the element type.
Arguments
:: Int | zero-based field index |
-> Info | composite type information |
-> Info | type information for specified field |
If the argument describes a composite type, returns the type of the field by zero-based index into the list of fields.
Arguments
:: String | field name |
-> Info | composite type info |
-> Maybe Int | zero-based index of field matching the name |
If the argument describes a composite type, return the first, zero-based index of the field in that type that matches the given name.
Info hueristics
Search the metadata for debug info corresponding to a given type alias. This is considered a heuristic because there's no direct mapping between type aliases and debug info. The debug information must be search for a textual match.
Compared to guessTypeInfo
, this function first tries
to strip the "struct." and "union." prefixes that are
commonly added by clang before searching for the type information.
Search the metadata for debug info corresponding to a given type alias. This is considered a heuristic because there's no direct mapping between type aliases and debug info. The debug information must be search for a textual match.
Function arguments
debugInfoArgNames :: Module -> Define -> IntMap String Source #
Find source-level names of function arguments