Skip to content

Commit

Permalink
Merge branch 'master' into refactor-matching
Browse files Browse the repository at this point in the history
  • Loading branch information
cs01 committed Aug 10, 2022
2 parents 124e78d + 72897f8 commit 402b83d
Show file tree
Hide file tree
Showing 8 changed files with 182 additions and 65 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: "3.8"
python-version: "3.10"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
Expand All @@ -58,7 +58,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: "3.8"
python-version: "3.10"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
Expand Down
126 changes: 77 additions & 49 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,103 +1,131 @@
# pygdbmi release history

## 0.10.0.3
* Fixed a bug where notifications without a payload were not recognized as such
* [dev] Refactored the code to parse MI records to decrease the number of regex matches to perform
## dev

- Fixed a bug where notifications without a payload were not recognized as such
- Invalid octal sequences produced by GDB are left unchanged instead of causing a `UnicodeDecodeError` (#64)

Internal changes

- Update and freeze dependencies for documentation generation
- Refactored the code to parse MI records to decrease the number of regex matches to perform


## 0.10.0.2
* Strings containing escapes are now unescaped, both for messages in error records, which were previously mangled (#57), and textual records, which were previously left escaped (#58)
* Dropped support for Python 3.6 and added explicit support for Python 3.9 and 3.10.

- Strings containing escapes are now unescaped, both for messages in error records, which were previously mangled (#57), and textual records, which were previously left escaped (#58)
- Dropped support for Python 3.6 and added explicit support for Python 3.9 and 3.10.

## 0.10.0.1
* Fix bug with `time_to_check_for_additional_output_sec`, as it was not being used when passed to `GdbController`

- Fix bug with `time_to_check_for_additional_output_sec`, as it was not being used when passed to `GdbController`

## 0.10.0.0

**Breaking Changes**
**Breaking Changes**

* Drop support for Python 3.5
* Update `GdbController()` API. New API is `GdbController(command: Optional[List[str]], time_to_check_for_additional_output_sec: Optional[int])`.
* `GdbController.verify_valid_gdb_subprocess()` was removed
* Remove `NoGdbProcessError` error
- Drop support for Python 3.5
- Update `GdbController()` API. New API is `GdbController(command: Optional[List[str]], time_to_check_for_additional_output_sec: Optional[int])`.
- `GdbController.verify_valid_gdb_subprocess()` was removed
- Remove `NoGdbProcessError` error

Other Changes

* Add new `IoManager` class to handle more generic use-cases
* [dev] use pytest for testing
* gdb mi parsing remains unchanged
- Add new `IoManager` class to handle more generic use-cases
- [dev] use pytest for testing
- gdb mi parsing remains unchanged

## 0.9.0.3

* Drop support for 2.7, 3.4
* Add support for 3.7, 3.8
* Add `py.typed` file so mypy can enforce type hints on `pygdbmi`
* Do not log in StringStream (#36)
* Updates to build and CI tests (use nox)
* Use mkdocs and mkdocstrings
* Doc updates
- Drop support for 2.7, 3.4
- Add support for 3.7, 3.8
- Add `py.typed` file so mypy can enforce type hints on `pygdbmi`
- Do not log in StringStream (#36)
- Updates to build and CI tests (use nox)
- Use mkdocs and mkdocstrings
- Doc updates

## 0.9.0.2
* More doc updates

- More doc updates

## 0.9.0.1
* Update docs

- Update docs

## 0.9.0.0
* Stop buffering output
* Use logger in GdbController; modify `verbose` arguments.
* Remove support for Python 3.3

- Stop buffering output
- Use logger in GdbController; modify `verbose` arguments.
- Remove support for Python 3.3

## 0.8.4.0
* Add method `get_subprocess_cmd` to view the gdb command run in the shell

- Add method `get_subprocess_cmd` to view the gdb command run in the shell

## 0.8.3.0
* Improve reading gdb responses on unix (performance, bugfix) (@mouuff)

- Improve reading gdb responses on unix (performance, bugfix) (@mouuff)

## 0.8.2.0
* Add support for [record and replay (rr) gdb supplement](http://rr-project.org/)

- Add support for [record and replay (rr) gdb supplement](http://rr-project.org/)

## 0.8.1.1
* Discard unexpected text from gdb

- Discard unexpected text from gdb

## 0.8.1.0
* Add native Windows support

- Add native Windows support

## 0.8.0.0
* Make parsing more efficient when gdb outputs large strings
* Add new methods to GdbController class: `spawn_new_gdb_subprocess`, `send_signal_to_gdb`, and `interrupt_gdb`

- Make parsing more efficient when gdb outputs large strings
- Add new methods to GdbController class: `spawn_new_gdb_subprocess`, `send_signal_to_gdb`, and `interrupt_gdb`

## 0.7.4.5
* Update setup.py

- Update setup.py

## 0.7.4.4
* Fix windows ctypes import (#23, @rudolfwalter)

- Fix windows ctypes import (#23, @rudolfwalter)

## 0.7.4.3
* Workaround gdb bug with repeated dictionary keys

- Workaround gdb bug with repeated dictionary keys

## 0.7.4.2
* Improved buffering of incomplete gdb mi output (@trapito)
* Remove support of Python 3.2

- Improved buffering of incomplete gdb mi output (@trapito)
- Remove support of Python 3.2

## 0.7.4.1
* Preserve leading and trailing spaces in gdb/mi output (plus unit tests)
* Add unit test for buffering of gdb/mi output
* Documentation updates
* Refactoring

- Preserve leading and trailing spaces in gdb/mi output (plus unit tests)
- Add unit test for buffering of gdb/mi output
- Documentation updates
- Refactoring

## 0.7.4.0
* Add more exception types (`NoGdbProcessError`, `GdbTimeoutError`)
* Add logic fixes for Windows (@johncf)
* Use codecs.open() to open the readme.rst, to prevent locale related bugs (@mariusmue)

- Add more exception types (`NoGdbProcessError`, `GdbTimeoutError`)
- Add logic fixes for Windows (@johncf)
- Use codecs.open() to open the readme.rst, to prevent locale related bugs (@mariusmue)

## 0.7.3.3
* Add alternate pipe implementation for Windows

- Add alternate pipe implementation for Windows

## 0.7.3.2
* Replace `epoll` with `select` for osx compatibility (@felipesere)

- Replace `epoll` with `select` for osx compatibility (@felipesere)

## 0.7.3.1
* Fix README

- Fix README

## 0.7.3.0
* Add support for gdb/mi (optional) tokens (@mariusmue)

- Add support for gdb/mi (optional) tokens (@mariusmue)
2 changes: 2 additions & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ exclude example.py
exclude .flake8
exclude noxfile.py
exclude mkdocs.yml
exclude *.in
exclude *.txt

prune tests
prune docs
5 changes: 5 additions & 0 deletions mkdoc_requirements.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.
mkdocstrings[python]
mkdocs
mkdocs-material
pygments
78 changes: 78 additions & 0 deletions mkdoc_requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
#
# This file is autogenerated by pip-compile with python 3.10
# To update, run:
#
# pip-compile mkdoc_requirements.in
#
click==8.1.3
# via mkdocs
ghp-import==2.1.0
# via mkdocs
griffe==0.22.0
# via mkdocstrings-python
importlib-metadata==4.12.0
# via mkdocs
jinja2==3.1.2
# via
# mkdocs
# mkdocs-material
# mkdocstrings
markdown==3.3.7
# via
# mkdocs
# mkdocs-autorefs
# mkdocs-material
# mkdocstrings
# pymdown-extensions
markupsafe==2.1.1
# via
# jinja2
# mkdocstrings
mergedeep==1.3.4
# via mkdocs
mkdocs==1.3.1
# via
# -r mkdoc_requirements.in
# mkdocs-autorefs
# mkdocs-material
# mkdocstrings
mkdocs-autorefs==0.4.1
# via mkdocstrings
mkdocs-material==8.3.9
# via -r mkdoc_requirements.in
mkdocs-material-extensions==1.0.3
# via mkdocs-material
mkdocstrings[python]==0.19.0
# via
# -r mkdoc_requirements.in
# mkdocstrings-python
mkdocstrings-python==0.7.1
# via mkdocstrings
packaging==21.3
# via mkdocs
.
# via -r mkdoc_requirements.in
pygments==2.12.0
# via
# -r mkdoc_requirements.in
# mkdocs-material
pymdown-extensions==9.5
# via
# mkdocs-material
# mkdocstrings
pyparsing==3.0.9
# via packaging
python-dateutil==2.8.2
# via ghp-import
pyyaml==6.0
# via
# mkdocs
# pyyaml-env-tag
pyyaml-env-tag==0.1
# via mkdocs
six==1.16.0
# via python-dateutil
watchdog==2.1.9
# via mkdocs
zipp==3.8.1
# via importlib-metadata
21 changes: 8 additions & 13 deletions noxfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,30 +26,25 @@ def lint(session):
session.run("python", "setup.py", "check", "--metadata", "--strict")


doc_dependencies = [
".",
"mkdocstrings",
"mkdocs",
"mkdocs-material",
"pygments",
]
def install_mkdoc_dependencies(session):
session.install("-r", "mkdoc_requirements.txt")


@nox.session(python="3.7")
@nox.session
def docs(session):
session.install(*doc_dependencies)
install_mkdoc_dependencies(session)
session.run("mkdocs", "build")


@nox.session(python="3.7")
@nox.session
def serve_docs(session):
session.install(*doc_dependencies)
install_mkdoc_dependencies(session)
session.run("mkdocs", "serve")


@nox.session(python="3.7")
@nox.session
def publish_docs(session):
session.install(*doc_dependencies)
install_mkdoc_dependencies(session)
session.run("mkdocs", "gh-deploy")


Expand Down
8 changes: 7 additions & 1 deletion pygdbmi/gdbescapes.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,13 @@ def _unescape_internal(
raise ValueError(
f"Invalid octal number {octal_number!r} in {escaped_str!r}"
) from exc
replaced = octal_sequence_bytes.decode("utf-8")
try:
replaced = octal_sequence_bytes.decode("utf-8")
except UnicodeDecodeError:
# GDB should never generate invalid sequences but, according to #64,
# it can do that on Windows. In this case we just keep the sequence
# unchanged.
replaced = f"\\{escaped_octal}"

elif escaped_char is not None:
# We found a single escaped character.
Expand Down
3 changes: 3 additions & 0 deletions tests/test_pygdbmi.py
Original file line number Diff line number Diff line change
Expand Up @@ -502,6 +502,9 @@ def test_unescape(self) -> None:
with self.assertRaisesRegex(ValueError, "Invalid escape character"):
unescape(bad)

# An octal sequence that is not valid UTF-8 doesn't get changes, see #64.
assert_match(unescape(r"254 '\376'"), r"254 '\376'")

def test_advance_past_string_with_gdb_escapes(self) -> None:
"""Test the advance_past_string_with_gdb_escapes function"""

Expand Down

0 comments on commit 402b83d

Please sign in to comment.