Skip to content

Commit

Permalink
Support handling arrays in debugutils
Browse files Browse the repository at this point in the history
  • Loading branch information
glguy committed Jul 21, 2017
1 parent 2a4a4f6 commit deaff1c
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/Text/LLVM/DebugUtils.hs
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,11 @@ llvmDbgCuKey :: String
llvmDbgCuKey = "llvm.dbg.cu"

dwarfPointer, dwarfStruct, dwarfTypedef, dwarfUnion, dwarfBasetype,
dwarfConst :: Word16
dwarfConst, dwarfArray :: Word16
dwarfPointer = 0x0f
dwarfStruct = 0x13
dwarfTypedef = 0x16
dwarfArray = 0x01
dwarfUnion = 0x17
dwarfBasetype = 0x24
dwarfConst = 0x26
Expand All @@ -57,6 +58,7 @@ data Info
= Pointer Info
| Structure [(String,Info)]
| Union [(String,Info)]
| ArrInfo Info
| BaseType String
| Unknown
deriving Show
Expand Down Expand Up @@ -114,6 +116,7 @@ debugInfoToInfo _ (DebugInfoBasicType bt)
debugInfoToInfo mdMap (DebugInfoCompositeType ct)
| dictTag ct == dwarfStruct = maybe Unknown Structure (getFields mdMap ct)
| dictTag ct == dwarfUnion = maybe Unknown Union (getFields mdMap ct)
| dictTag ct == dwarfArray = ArrInfo (valMdToInfo' mdMap (dictBaseType ct))
debugInfoToInfo _ _ = Unknown


Expand Down Expand Up @@ -185,11 +188,13 @@ findSubprogramViaCu mdMap m (Symbol sym) = listToMaybe
------------------------------------------------------------------------

-- | If the argument describes a pointer, return the information for the
-- type that it points do.
-- type that it points do. If the argument describes an array, return
-- information about the element type.
derefInfo ::
Info {- ^ pointer type information -} ->
Info {- ^ type information of pointer's base type -}
derefInfo (Pointer x) = x
derefInfo (ArrInfo x) = x
derefInfo _ = Unknown

-- | If the argument describes a composite type, returns the type of the
Expand Down

0 comments on commit deaff1c

Please sign in to comment.