mirror of
https://github.com/cs01/gdbgui
synced 2024-11-17 07:48:57 +01:00
Add sourceFileMap support #158
This commit is contained in:
parent
500390f3a2
commit
c5abc6588b
6 changed files with 49 additions and 22 deletions
|
@ -1,7 +1,9 @@
|
|||
# gdbgui release history
|
||||
|
||||
## 0.13.0.0
|
||||
* Pass arbitrary gdb arguments directly to gdb (also removed `-x` option, which caused major version to change) (#205)
|
||||
* Add ability to map source file paths. Added flags `--remap-sources` and `-m` to replace compile-time source paths to local source paths. i.e. `gdbgui --remap-sources='{"/buildmachine":"/home/chad"}'` (#158)
|
||||
* Pass arbitrary gdb arguments directly to gdb: added `--gdb-args` flag
|
||||
* Removed `-x` CLI option, which caused major version to change. New way to pass is `gdbgui --gdb-args='-x=FILE'` (#205)
|
||||
* Fix typo in tour (@nkirkby)
|
||||
* Add "name" to Threads (new gdb 8.1 feature) (@P4Cu)
|
||||
* Fix crash/black screen from "Python Exception <class NameError> name long is not defined" #212
|
||||
|
|
|
@ -258,11 +258,11 @@ def setup_backend(
|
|||
pass
|
||||
|
||||
|
||||
def verify_gdb_exists():
|
||||
if find_executable(app.config["gdb_path"]) is None:
|
||||
def verify_gdb_exists(gdb_path):
|
||||
if find_executable(gdb_path) is None:
|
||||
pygdbmi.printcolor.print_red(
|
||||
'gdb executable "%s" was not found. Verify the executable exists, or that it is a directory on your $PATH environment variable.'
|
||||
% app.config["gdb_path"]
|
||||
% gdb_path
|
||||
)
|
||||
if USING_WINDOWS:
|
||||
print(
|
||||
|
@ -272,7 +272,7 @@ def verify_gdb_exists():
|
|||
print('try "sudo apt-get install gdb" for Linux or "brew install gdb"')
|
||||
sys.exit(1)
|
||||
elif (
|
||||
"lldb" in app.config["gdb_path"].lower()
|
||||
"lldb" in gdb_path.lower()
|
||||
and "lldb-mi" not in app.config["gdb_path"].lower()
|
||||
):
|
||||
pygdbmi.printcolor.print_red(
|
||||
|
@ -532,18 +532,19 @@ def gdbgui():
|
|||
THEMES = ["monokai", "light"]
|
||||
# fmt: off
|
||||
initial_data = {
|
||||
"csrf_token": session["csrf_token"],
|
||||
"gdbgui_version": __version__,
|
||||
"gdbpid": gdbpid,
|
||||
"interpreter": interpreter,
|
||||
"initial_binary_and_args": app.config["initial_binary_and_args"],
|
||||
"show_gdbgui_upgrades": app.config["show_gdbgui_upgrades"],
|
||||
"themes": THEMES,
|
||||
"signals": SIGNAL_NAME_TO_OBJ,
|
||||
"gdbpid": gdbpid,
|
||||
"p": pbkdf2_hex(str(app.config.get("l")), "Feo8CJol")
|
||||
if app.config.get("l")
|
||||
else "",
|
||||
"project_home": app.config["project_home"],
|
||||
"csrf_token": session["csrf_token"],
|
||||
"remap_sources": app.config["remap_sources"],
|
||||
"show_gdbgui_upgrades": app.config["show_gdbgui_upgrades"],
|
||||
"themes": THEMES,
|
||||
"signals": SIGNAL_NAME_TO_OBJ,
|
||||
"using_windows": USING_WINDOWS,
|
||||
}
|
||||
# fmt: on
|
||||
|
@ -782,8 +783,7 @@ def save_license(license):
|
|||
print("saved license information")
|
||||
|
||||
|
||||
def main():
|
||||
"""Entry point from command line"""
|
||||
def get_parser():
|
||||
parser = argparse.ArgumentParser(description=__doc__)
|
||||
|
||||
gdb_group = parser.add_argument_group(title="gdb settings")
|
||||
|
@ -804,7 +804,7 @@ def main():
|
|||
"Arguments passed directly to gdb when gdb is invoked. "
|
||||
'For example,--gdb-args="--nx --tty=/dev/ttys002"'
|
||||
),
|
||||
default=""
|
||||
default="",
|
||||
)
|
||||
gdb_group.add_argument(
|
||||
"--rr",
|
||||
|
@ -860,7 +860,15 @@ def main():
|
|||
)
|
||||
# https://www.digitalocean.com/community/tutorials/openssl-essentials-working-with-ssl-certificates-private-keys-and-csrs
|
||||
|
||||
other.add_argument("--license", help="Store gdbgui ad-free license key.")
|
||||
other.add_argument(
|
||||
"--remap-sources",
|
||||
"-m",
|
||||
help=(
|
||||
"Replace compile-time source paths to local source paths. "
|
||||
"Pass valid JSON key/value pairs."
|
||||
"i.e. --remap-sources='{\"/buildmachine\": \"/home/chad\"}'"
|
||||
),
|
||||
)
|
||||
other.add_argument(
|
||||
"--project",
|
||||
help='Set the project directory. When viewing the "folders" pane, paths are shown relative to this directory.',
|
||||
|
@ -883,6 +891,7 @@ def main():
|
|||
help="Use the given browser executable instead of the system default.",
|
||||
default=None,
|
||||
)
|
||||
other.add_argument("--license", help="Store gdbgui ad-free license key.")
|
||||
other.add_argument(
|
||||
"--debug",
|
||||
help="The debug flag of this Flask application. "
|
||||
|
@ -909,7 +918,12 @@ def main():
|
|||
" Example: gdbgui [...] --args ./mybinary myarg -flag1 -flag2",
|
||||
default=[],
|
||||
)
|
||||
return parser
|
||||
|
||||
|
||||
def main():
|
||||
"""Entry point from command line"""
|
||||
parser = get_parser()
|
||||
args = parser.parse_args()
|
||||
|
||||
initialize_preferences()
|
||||
|
@ -933,12 +947,21 @@ def main():
|
|||
args.auth_file, args.user, args.password
|
||||
)
|
||||
app.config["project_home"] = args.project
|
||||
if args.remap_sources:
|
||||
try:
|
||||
app.config["remap_sources"] = json.loads(args.remap_sources)
|
||||
except json.decoder.JSONDecodeError as e:
|
||||
print("The '--remap-sources' argument must be valid JSON. See gdbgui --help.")
|
||||
print(e)
|
||||
exit(1)
|
||||
else:
|
||||
app.config["remap_sources"] = {}
|
||||
|
||||
if args.license:
|
||||
print("saving license information")
|
||||
save_license(args.license)
|
||||
|
||||
verify_gdb_exists()
|
||||
verify_gdb_exists(app.config["gdb_path"])
|
||||
if args.remote:
|
||||
args.host = "0.0.0.0"
|
||||
args.no_browser = True
|
||||
|
|
|
@ -114,7 +114,12 @@ const GdbApi = {
|
|||
GdbApi.run_gdb_command("-exec-run");
|
||||
},
|
||||
run_initial_commands: function() {
|
||||
GdbApi.run_gdb_command("set breakpoint pending on");
|
||||
const cmds = ["set breakpoint pending on"]
|
||||
for(const src in initial_data.remap_sources){
|
||||
const dst = initial_data.remap_sources[src]
|
||||
cmds.push(`set substitute-path "${src}" "${dst}"`)
|
||||
}
|
||||
GdbApi.run_gdb_command(cmds);
|
||||
},
|
||||
inferior_is_paused: function() {
|
||||
return (
|
||||
|
|
|
@ -53,7 +53,9 @@ class StateManager(object):
|
|||
logger.info("new sid", client_id)
|
||||
|
||||
gdb_args = (
|
||||
deepcopy(self.config["initial_binary_and_args"]) + deepcopy(self.config["gdb_args"]) + REQUIRED_GDB_FLAGS
|
||||
deepcopy(self.config["initial_binary_and_args"])
|
||||
+ deepcopy(self.config["gdb_args"])
|
||||
+ REQUIRED_GDB_FLAGS
|
||||
)
|
||||
|
||||
if startup_with_shell_off:
|
||||
|
|
|
@ -24,7 +24,6 @@ def on_connect():
|
|||
|
||||
|
||||
class TestWebsockets(unittest.TestCase):
|
||||
|
||||
@classmethod
|
||||
def setUp(self):
|
||||
pass
|
||||
|
@ -41,7 +40,6 @@ class TestWebsockets(unittest.TestCase):
|
|||
|
||||
|
||||
class Test(unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
"""Built-in to unittest.TestCase"""
|
||||
self.app = backend.app.test_client()
|
||||
|
@ -58,7 +56,6 @@ class Test(unittest.TestCase):
|
|||
|
||||
|
||||
class TestSocketError(unittest.TestCase):
|
||||
|
||||
def test_same_port(self):
|
||||
backend.setup_backend(testing=True)
|
||||
|
||||
|
|
|
@ -24,7 +24,6 @@ def on_connect():
|
|||
|
||||
|
||||
class TestWebsockets(unittest.TestCase):
|
||||
|
||||
@classmethod
|
||||
def setUp(self):
|
||||
pass
|
||||
|
@ -41,7 +40,6 @@ class TestWebsockets(unittest.TestCase):
|
|||
|
||||
|
||||
class Test(unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
"""Built-in to unittest.TestCase"""
|
||||
self.app = backend.app.test_client()
|
||||
|
|
Loading…
Reference in a new issue