mirror of https://github.com/Nonannet/pelfy.git
Compare commits
4 Commits
cfbc53afc6
...
c6682effc7
Author | SHA1 | Date |
---|---|---|
|
c6682effc7 | |
|
77f8b5ed44 | |
|
75bde1ed99 | |
|
8da6ab4cd2 |
|
@ -8,6 +8,7 @@ on:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
|
name: Linting, typechecking and testing code
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
strategy:
|
strategy:
|
||||||
|
|
|
@ -9,7 +9,7 @@ permissions:
|
||||||
contents: write
|
contents: write
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-and-deploy:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
|
@ -30,8 +30,22 @@ jobs:
|
||||||
rm ./source/*.rst
|
rm ./source/*.rst
|
||||||
make html
|
make html
|
||||||
touch ./build/html/.nojekyll
|
touch ./build/html/.nojekyll
|
||||||
- name: Deploy to GitHub Pages
|
- name: Upload artifact
|
||||||
uses: JamesIves/github-pages-deploy-action@v4
|
uses: actions/upload-pages-artifact@v3
|
||||||
with:
|
with:
|
||||||
branch: gh-pages
|
path: docs/build/html
|
||||||
folder: docs/build/html
|
|
||||||
|
deploy:
|
||||||
|
needs: build
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
pages: write
|
||||||
|
id-token: write
|
||||||
|
environment:
|
||||||
|
name: github-pages
|
||||||
|
url: ${{ steps.deployment.outputs.page_url }}
|
||||||
|
steps:
|
||||||
|
- name: Deploy to GitHub Pages
|
||||||
|
id: deployment
|
||||||
|
uses: actions/deploy-pages@v4
|
|
@ -9,6 +9,9 @@ jobs:
|
||||||
publish:
|
publish:
|
||||||
name: Build and publish
|
name: Build and publish
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
environment:
|
||||||
|
name: pypi
|
||||||
|
url: https://pypi.org/project/${{ github.event.repository.name }}/
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v3
|
||||||
|
|
|
@ -20,6 +20,7 @@ share/python-wheels/
|
||||||
.installed.cfg
|
.installed.cfg
|
||||||
*.egg
|
*.egg
|
||||||
MANIFEST
|
MANIFEST
|
||||||
|
.vscode
|
||||||
|
|
||||||
# Jupyter Notebook
|
# Jupyter Notebook
|
||||||
.ipynb_checkpoints
|
.ipynb_checkpoints
|
||||||
|
|
|
@ -164,7 +164,7 @@ class elf_section():
|
||||||
def symbols(self) -> 'symbol_list':
|
def symbols(self) -> 'symbol_list':
|
||||||
"""All ELF symbols associated with this section
|
"""All ELF symbols associated with this section
|
||||||
"""
|
"""
|
||||||
return symbol_list(self.file._list_symbols(self.index))
|
return symbol_list(self.file.list_symbols(self.index))
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def data_hex(self) -> str:
|
def data_hex(self) -> str:
|
||||||
|
@ -371,7 +371,7 @@ class elf_file:
|
||||||
data: binary ELF data
|
data: binary ELF data
|
||||||
"""
|
"""
|
||||||
assert isinstance(data, (bytes, bytearray)), 'Binary ELF data must be provided as bytes or bytearray.'
|
assert isinstance(data, (bytes, bytearray)), 'Binary ELF data must be provided as bytes or bytearray.'
|
||||||
self._data = data
|
self._data = bytes(data)
|
||||||
|
|
||||||
# Defaults required for function _read_int_from_elf_field
|
# Defaults required for function _read_int_from_elf_field
|
||||||
self.bit_width = 32
|
self.bit_width = 32
|
||||||
|
@ -403,7 +403,7 @@ class elf_file:
|
||||||
ret_sections = [sh for sh in self.sections if sh.name == '.strtab']
|
ret_sections = [sh for sh in self.sections if sh.name == '.strtab']
|
||||||
self.string_table_section = ret_sections[0] if ret_sections else None
|
self.string_table_section = ret_sections[0] if ret_sections else None
|
||||||
|
|
||||||
self.symbols = symbol_list(self._list_symbols())
|
self.symbols = symbol_list(self.list_symbols())
|
||||||
|
|
||||||
self.functions = symbol_list(s for s in self.symbols if s.info == 'STT_FUNC')
|
self.functions = symbol_list(s for s in self.symbols if s.info == 'STT_FUNC')
|
||||||
self.objects = symbol_list(s for s in self.symbols if s.info == 'STT_OBJECT')
|
self.objects = symbol_list(s for s in self.symbols if s.info == 'STT_OBJECT')
|
||||||
|
@ -415,7 +415,15 @@ class elf_file:
|
||||||
offs = self.fields['e_shoff'] + i * self.fields['e_shentsize']
|
offs = self.fields['e_shoff'] + i * self.fields['e_shentsize']
|
||||||
yield {fn: self._read_from_sh_field(offs, fn) for fn in fdat.section_header.keys()}
|
yield {fn: self._read_from_sh_field(offs, fn) for fn in fdat.section_header.keys()}
|
||||||
|
|
||||||
def _list_symbols(self, section_index: Optional[int] = None) -> Generator[elf_symbol, None, None]:
|
def list_symbols(self, section_index: Optional[int] = None) -> Generator[elf_symbol, None, None]:
|
||||||
|
"""List ELF symbols.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
section_index: If provided, only symbols from the specified section are returned.
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
List of ELF symbols
|
||||||
|
"""
|
||||||
if self.symbol_table_section:
|
if self.symbol_table_section:
|
||||||
offs = self.symbol_table_section['sh_offset']
|
offs = self.symbol_table_section['sh_offset']
|
||||||
|
|
||||||
|
|
1087
tests/notebook.ipynb
1087
tests/notebook.ipynb
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue