Skip to content

Commit

Permalink
fix: ipsw class-dump --proto prevent showing duplicates
Browse files Browse the repository at this point in the history
  • Loading branch information
blacktop committed Apr 18, 2024
1 parent 667effc commit 10ef073
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 15 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ require (
github.com/aymanbagabas/go-udiff v0.2.0
github.com/blacktop/arm64-cgo v1.0.57
github.com/blacktop/go-dwarf v1.0.10
github.com/blacktop/go-macho v1.1.198
github.com/blacktop/go-macho v1.1.199
github.com/blacktop/go-plist v1.0.2
github.com/blacktop/lzfse-cgo v1.1.19
github.com/blacktop/lzss v0.1.1
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ github.com/blacktop/cast v1.5.1 h1:gwXxBZ2XlcNnU57Ws+pTDFYHKKtLdxwBqvUI2wS31wg=
github.com/blacktop/cast v1.5.1/go.mod h1:SpXXQ5YoyJw6s3/6cMTQuxvgRl3PCJiyaX9p6b155UU=
github.com/blacktop/go-dwarf v1.0.10 h1:i9zYgcIROETsNZ6V+zZn3uDH21FCG5BLLZ837GitxS0=
github.com/blacktop/go-dwarf v1.0.10/go.mod h1:4W2FKgSFYcZLDwnR7k+apv5i3nrau4NGl9N6VQ9DSTo=
github.com/blacktop/go-macho v1.1.198 h1:XzLkto28L186FboxM7c7IUhQJvxCK/6J/RdQ6/SPOW4=
github.com/blacktop/go-macho v1.1.198/go.mod h1:dtlW2AJKQpFzImBVPWiUKZ6OxrQ2MLfWi/BPPe0EONE=
github.com/blacktop/go-macho v1.1.199 h1:z5zmm03r4fEObjpI45cgfiktjtTvkuBvLHQCP0N4cuI=
github.com/blacktop/go-macho v1.1.199/go.mod h1:dtlW2AJKQpFzImBVPWiUKZ6OxrQ2MLfWi/BPPe0EONE=
github.com/blacktop/go-plist v1.0.2 h1:DMX8uBiE308HWZkO9o37j7Z2b0neI3GSzN2caNa2zXk=
github.com/blacktop/go-plist v1.0.2/go.mod h1:fqVhCVVXVJWsIGY9QPgdK0mDWZD82HrRMfU5PanvdTA=
github.com/blacktop/lzfse-cgo v1.1.19 h1:1I/1y9/sjyDLomACLrR4f7GFJ1fTaIjhWb1PQrEtKiw=
Expand Down
26 changes: 14 additions & 12 deletions internal/commands/macho/objc.go
Original file line number Diff line number Diff line change
Expand Up @@ -220,21 +220,23 @@ func (o *ObjC) DumpProtocol(pattern string) error {

for _, proto := range protos {
if re.MatchString(proto.Name) {
if o.conf.Color {
if o.conf.Addrs {
quick.Highlight(os.Stdout, swift.DemangleBlob(proto.WithAddrs()), "objc", "terminal256", o.conf.Theme)
} else {
quick.Highlight(os.Stdout, swift.DemangleBlob(proto.Verbose()), "objc", "terminal256", o.conf.Theme)
}
quick.Highlight(os.Stdout, "\n/****************************************/\n\n", "objc", "terminal256", o.conf.Theme)
} else {
if o.conf.Addrs {
fmt.Println(swift.DemangleBlob(proto.WithAddrs()))
if _, ok := seen[proto.Ptr]; !ok { // prevent displaying duplicates
if o.conf.Color {
if o.conf.Addrs {
quick.Highlight(os.Stdout, swift.DemangleBlob(proto.WithAddrs()), "objc", "terminal256", o.conf.Theme)
} else {
quick.Highlight(os.Stdout, swift.DemangleBlob(proto.Verbose()), "objc", "terminal256", o.conf.Theme)
}
quick.Highlight(os.Stdout, "\n/****************************************/\n\n", "objc", "terminal256", o.conf.Theme)
} else {
fmt.Println(swift.DemangleBlob(proto.Verbose()))
if o.conf.Addrs {
fmt.Println(swift.DemangleBlob(proto.WithAddrs()))
} else {
fmt.Println(swift.DemangleBlob(proto.Verbose()))
}
}
seen[proto.Ptr] = true
}
seen[proto.Ptr] = true
}
}
}
Expand Down

0 comments on commit 10ef073

Please sign in to comment.