@@ -1645,20 +1645,24 @@ func (f *File) GetCString(addr uint64) (string, error) {
1645
1645
return "" , fmt .Errorf ("string not found at address %#x" , addr )
1646
1646
}
1647
1647
1648
- func (f * File ) GetCStrings () (map [uint64 ] string , error ) {
1649
- strs := make (map [uint64 ] string )
1648
+ func (f * File ) GetCStrings () (map [string ] map [ string ] uint64 , error ) {
1649
+ strs := make (map [string ] map [ string ] uint64 )
1650
1650
1651
1651
for _ , sec := range f .Sections {
1652
- if sec .Flags .IsCstringLiterals () && sec .Name == "__cstring " {
1652
+ if sec .Flags .IsCstringLiterals () || sec .Name == "__os_log " {
1653
1653
off , err := f .GetOffset (sec .Addr )
1654
1654
if err != nil {
1655
1655
return nil , fmt .Errorf ("failed to get offset for %s.%s: %v" , sec .Seg , sec .Name , err )
1656
1656
}
1657
1657
dat := make ([]byte , sec .Size )
1658
1658
if _ , err = f .ReadAt (dat , int64 (off )); err != nil {
1659
1659
return nil , fmt .Errorf ("failed to read cstring data in %s.%s: %v" , sec .Seg , sec .Name , err )
1660
+
1660
1661
}
1661
1662
1663
+ section := fmt .Sprintf ("%s.%s" , sec .Seg , sec .Name )
1664
+ strs [section ] = make (map [string ]uint64 )
1665
+
1662
1666
csr := bytes .NewBuffer (dat )
1663
1667
1664
1668
for {
@@ -1682,7 +1686,7 @@ func (f *File) GetCStrings() (map[uint64]string, error) {
1682
1686
continue // skip non-ascii strings
1683
1687
}
1684
1688
}
1685
- strs [pos ] = s
1689
+ strs [section ][ s ] = pos
1686
1690
}
1687
1691
}
1688
1692
}
0 commit comments