-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature: support fine-grained Context callbacks (#88)
* Add support for context callbacks * Feat: Support fine-grained contexts * Make it work for BinSync again * Everything working in BinSync * bump
- Loading branch information
Showing
14 changed files
with
224 additions
and
77 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
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
__version__ = "1.13.0" | ||
__version__ = "1.14.0" | ||
|
||
|
||
import logging | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
from typing import Optional | ||
|
||
from .artifact import Artifact | ||
|
||
|
||
class Context(Artifact): | ||
__slots__ = Artifact.__slots__ + ( | ||
"addr", | ||
"func_addr", | ||
"screen_name" | ||
) | ||
|
||
def __init__(self, addr: int = None, func_addr: Optional[int] = None, screen_name: str = None, **kwargs): | ||
self.addr: Optional[int] = addr | ||
self.func_addr: Optional[int] = func_addr | ||
self.screen_name: str = screen_name | ||
super().__init__(**kwargs) | ||
|
||
def __str__(self): | ||
post_text = f" screen={self.screen_name}" if self.screen_name else "" | ||
if self.func_addr is not None: | ||
post_text = f"@{hex(self.func_addr)}" + post_text | ||
if self.addr is not None: | ||
post_text = hex(self.addr) + post_text | ||
|
||
return f"<Context {post_text}>" |
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
Oops, something went wrong.