Skip to content

Commit

Permalink
fix: read AttrName safe
Browse files Browse the repository at this point in the history
Closes: #240
Signed-off-by: Zxilly <[email protected]>
  • Loading branch information
Zxilly committed Oct 17, 2024
1 parent 01cd149 commit f60f97e
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion internal/knowninfo/dwarf.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,11 @@ func (k *KnownInfo) AddDwarfVariable(entry *dwarf.Entry, d *dwarf.Data, pkg *ent
return
}

entryName := utils.Deduplicate(entry.Val(dwarf.AttrName).(string))
entryName, ok := safeGetEntryVal[string](entry, dwarf.AttrName, "variable name")
if !ok {
slog.Debug(fmt.Sprintf("Failed to load DWARF var name: %s", dwarfutil.EntryPrettyPrint(entry)))
return
}

symbol := entity.NewSymbol(entryName, uint64(addr), typSize, entity.AddrTypeData)

Expand Down

0 comments on commit f60f97e

Please sign in to comment.