-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Copy tall the libraries needed for gdb to it's lib dir. - Inject uses our bundled gdb - Adds util module
- Loading branch information
Showing
4 changed files
with
75 additions
and
39 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
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,36 @@ | ||
# Copyright 2023 VMware, Inc. | ||
# SPDX-License-Identifier: Apache-2.0 | ||
""" | ||
Utility methods. | ||
""" | ||
import pathlib | ||
|
||
|
||
def find_dist_info(): | ||
"""Find relenv_gdb's dist-info directory.""" | ||
for name in pathlib.Path(__file__).parent.parent.rglob("relenv_gdb*dist-info"): | ||
return name | ||
|
||
|
||
def find_relenv_gdb(): | ||
"""Find the relenv-gdb script location.""" | ||
dist_info = find_dist_info() | ||
text = pathlib.Path(dist_info, "RECORD").read_text() | ||
for line in text.split("\n"): | ||
if "bin/relenv-gdb" in line: | ||
location, digest, size = line.rsplit(",", 2) | ||
script = (pathlib.Path(dist_info).parent / location).resolve() | ||
if script.exists(): | ||
return script | ||
|
||
|
||
def append_line(path, line): | ||
""" | ||
Append a line to the path. | ||
""" | ||
if isinstance(path, (str, pathlib.Path)): | ||
with open(path, "a") as fp: | ||
fp.write(line + "\n") | ||
else: | ||
path.write(line + "\n") | ||
path.flush() |