Skip to content

Commit

Permalink
Type hinting fixes - part 2 (#839)
Browse files Browse the repository at this point in the history
* make `@deprecated` more informative on what must be changed

* - `gef.binary` is being set only from the `newobjfile` handler
- removed useless `get_elf_headers`
- more pythonic gef.doc

* simplified command/function registration

* fixed `functions` command

* [ci] roper was never executing correctly

* Don't delete the `gef` object on `exit_handler` so we can still use it to get info even when the current debugging has exited

* more type hinting fixes, now down to 75

* - make all tests run in a tempdir (in tmp)
- fixed gef install to use the tempdir config setting, not gef-extras dir

* Formatting issues

* add the possibility to specify read/write callbacks to `GefSetting`

* [gef] updated unicode code strings to glyphs

* allow directories inside `extra_plugin_dir` to act as python package

* command examples can be provided as a list of strings

* Allowing context disassembler to be monkey-patched
  • Loading branch information
hugsy committed Jun 19, 2022
1 parent dbf2372 commit bf959a3
Show file tree
Hide file tree
Showing 4 changed files with 418 additions and 280 deletions.
24 changes: 11 additions & 13 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,26 @@ PYLINT_SUGGEST_FIX := y
PYLINT_PY_VERSION := 3.6
PYLINT_PARAMETERS := --jobs=$(PYLINT_JOBS) --suggestion-mode=$(PYLINT_SUGGEST_FIX) --py-version=$(PYLINT_PY_VERSION) --rcfile=$(PYLINT_RC)
TARGET := $(shell lscpu | head -1 | sed -e 's/Architecture:\s*//g')
COVERAGE_DIR ?= /tmp/cov
TMPDIR ?= $(shell mktemp -d)
WORKING_DIR := $(TMPDIR)
COVERAGE_DIR := $(WORKING_DIR)/coverage
GEF_PATH ?= $(shell readlink -f gef.py)
TMPDIR ?= /tmp
PYTEST_PARAMETERS := --verbose --forked --numprocesses=$(NB_CORES)

.PHONY: test test_% Test% testbins clean lint

test: $(TMPDIR) testbins
TMPDIR=$(TMPDIR) python3 -m pytest $(PYTEST_PARAMETERS) -k "not benchmark"
test: testbins
TMPDIR=$(WORKING_DIR) python3 -m pytest $(PYTEST_PARAMETERS) -k "not benchmark"

test_%: $(TMPDIR) testbins
TMPDIR=$(TMPDIR) python3 -m pytest $(PYTEST_PARAMETERS) -k $@
test_%: testbins
TMPDIR=$(WORKING_DIR) python3 -m pytest $(PYTEST_PARAMETERS) -k $@

testbins: $(TMPDIR) $(wildcard tests/binaries/*.c)
@TMPDIR=$(TMPDIR) $(MAKE) -j $(NB_CORES) -C tests/binaries TARGET=$(TARGET) all
testbins: $(wildcard tests/binaries/*.c)
@TMPDIR=$(WORKING_DIR) $(MAKE) -j $(NB_CORES) -C tests/binaries TARGET=$(TARGET) TMPDIR=$(WORKING_DIR) all

clean:
TMPDIR=$(TMPDIR) $(MAKE) -j $(NB_CORES) -C tests/binaries clean
@rm -rf $(TMPDIR)/gef-* $(TMPDIR)/gef.py || true
TMPDIR=$(WORKING_DIR) $(MAKE) -j $(NB_CORES) -C tests/binaries clean
@rm -rf $(WORKING_DIR)/gef-* $(WORKING_DIR)/gef.py || true

lint:
python3 -m pylint $(PYLINT_PARAMETERS) $(GEF_PATH)
Expand All @@ -39,6 +40,3 @@ coverage:
@coverage html --include "*/gef.py"
@rm -rf $(COVERAGE_DIR)

$(TMPDIR):
mkdir -p $@

Loading

0 comments on commit bf959a3

Please sign in to comment.