-
-
Notifications
You must be signed in to change notification settings - Fork 339
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve popup content scrollview interaction
Closes #572
- Loading branch information
Showing
9 changed files
with
214 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
LNPopupController/LNPopupController/Private/LNAddressInfo.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// | ||
// LNAddressInfo.h | ||
// LNPopupController | ||
// | ||
// Created by Léo Natan on 9/8/24. | ||
// Copyright © 2024 Léo Natan. All rights reserved. | ||
// | ||
|
||
#import <Foundation/Foundation.h> | ||
|
||
NS_ASSUME_NONNULL_BEGIN | ||
|
||
@interface LNAddressInfo : NSObject | ||
|
||
- (instancetype)initWithAddress:(NSUInteger)address; | ||
|
||
@property (nonatomic, readonly) NSUInteger address; | ||
@property (nonatomic, copy, readonly) NSString* image; | ||
@property (nonatomic, copy, readonly) NSString* symbol; | ||
@property (nonatomic, readonly) NSUInteger offset; | ||
|
||
- (NSString*)formattedDescriptionForIndex:(NSUInteger)index; | ||
|
||
@end | ||
|
||
NS_ASSUME_NONNULL_END |
86 changes: 86 additions & 0 deletions
86
LNPopupController/LNPopupController/Private/LNAddressInfo.mm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
// | ||
// LNAddressInfo.mm | ||
// LNPopupController | ||
// | ||
// Created by Léo Natan on 9/8/24. | ||
// Copyright © 2024 Léo Natan. All rights reserved. | ||
// | ||
|
||
#import "LNAddressInfo.h" | ||
#include <dlfcn.h> | ||
#include <cxxabi.h> | ||
|
||
@implementation LNAddressInfo | ||
{ | ||
Dl_info _info; | ||
} | ||
|
||
@synthesize image, symbol, offset, address; | ||
|
||
- (instancetype)initWithAddress:(NSUInteger)_address | ||
{ | ||
self = [super init]; | ||
|
||
if(self) | ||
{ | ||
address = _address; | ||
dladdr((void*)address, &_info); | ||
} | ||
|
||
return self; | ||
} | ||
|
||
- (NSString *)image | ||
{ | ||
if(_info.dli_fname != NULL) | ||
{ | ||
NSString* potentialImage = [NSString stringWithUTF8String:_info.dli_fname]; | ||
|
||
if([potentialImage containsString:@"/"]) | ||
{ | ||
return potentialImage.lastPathComponent; | ||
} | ||
} | ||
|
||
return @"???"; | ||
} | ||
|
||
- (NSString *)symbol | ||
{ | ||
if(_info.dli_sname != NULL) | ||
{ | ||
return [NSString stringWithUTF8String:_info.dli_sname]; | ||
} | ||
else if(_info.dli_fname != NULL) | ||
{ | ||
return self.image; | ||
} | ||
|
||
return [NSString stringWithFormat:@"0x%1lx", (unsigned long)_info.dli_saddr]; | ||
} | ||
|
||
- (NSUInteger)offset | ||
{ | ||
NSString* str = nil; | ||
if(_info.dli_sname != NULL && (str = [NSString stringWithUTF8String:_info.dli_sname]) != nil) | ||
{ | ||
return address - (NSUInteger)_info.dli_saddr; | ||
} | ||
else if(_info.dli_fname != NULL && (str = [NSString stringWithUTF8String:_info.dli_fname]) != nil) | ||
{ | ||
return address - (NSUInteger)_info.dli_fbase; | ||
} | ||
|
||
return address - (NSUInteger)_info.dli_saddr; | ||
} | ||
|
||
- (NSString*)description | ||
{ | ||
#if __LP64__ | ||
return [NSString stringWithFormat:@"%-35s 0x%016llx %@ + %ld", self.image.UTF8String, (uint64_t)address, self.symbol, self.offset]; | ||
#else | ||
return [NSString stringWithFormat:@"%-35s 0x%08lx %@ + %d", self.image.UTF8String, (unsigned long)address, self.symbol, self.offset]; | ||
#endif | ||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters