Skip to content
Snippets Groups Projects
Commit 7a24c2f5 authored by Louis-Francis Ratté-Boulianne's avatar Louis-Francis Ratté-Boulianne Committed by Sjoerd Simons
Browse files

Add --no-interactive option to the debug command


When we only want the GDB server running

Signed-off-by: default avatarLouis-Francis Ratté-Boulianne <lfrb@collabora.com>
Reviewed-by: default avatarSjoerd Simons <sjoerd.simons@collabora.co.uk>
Differential Revision: https://phabricator.apertis.org/D5328
parent 3077eac9
No related branches found
No related tags found
No related merge requests found
......@@ -32,6 +32,12 @@ point is used when found\&.
.sp
.RE
.PP
\fI\-\-no-interactive\fR
.RS 4
Only start the GDB server without entering the GDB interactive mode\&.
.sp
.RE
.PP
\fI\-\-device\fR
.RS 4
Use device as target (e.g. user@apertis)\&.
......
......@@ -218,6 +218,7 @@ class DebuggerServer:
self.app = app
self.args = args
self.port = DEFAULT_GDBSERVER_PORT
self.host = self.target.host
self._thread = None
def __enter__(self):
......@@ -278,6 +279,7 @@ class Debugger:
class Simulator:
def __init__(self):
self.host = 'localhost'
try:
with open('/etc/image_version') as f:
self.version = SysrootVersion.from_string(f.read())
......@@ -527,6 +529,7 @@ class Sysroot:
class SDK:
def __init__(self):
self.host = 'localhost'
try:
with open('/etc/image_version') as f:
self.version = SysrootVersion.from_string(f.read())
......@@ -1056,6 +1059,7 @@ class Ade:
self.force = False
self.debug = False
self.verbose = False
self.no_interactive = False
def get_sdk(self):
try:
......@@ -1453,8 +1457,19 @@ class Ade:
self.app = project.get_main_executable()
with DebuggerServer(target, self.app, *self.args) as server:
gdb = Debugger(self.unpack_sysroot(target), project)
gdb.connect(server)
if self.no_interactive:
self.info("* Gdb Server host is {0}".format(server.host))
self.info("* Gdb Server port is {0}".format(server.port))
self.info("* Gdb Server is ready")
if self.format == 'parseable':
print("GdbServerHost:{0}".format(server.host))
print("GdbServerPort:{0}".format(server.port))
print("GdbServerReady:true")
while True:
pass
else:
gdb = Debugger(self.unpack_sysroot(target), project)
gdb.connect(server)
def info(self, message):
if self.format == 'friendly':
......@@ -1575,6 +1590,7 @@ if __name__ == '__main__':
# Debug parser
debug_parser = subparsers.add_parser('debug', help="Debug application")
debug_parser.add_argument('--app', help="Remote path to application to debug")
debug_parser.add_argument('--no-interactive', help="Don't start GDB interactive mode", action='store_true')
group = debug_parser.add_mutually_exclusive_group()
group.add_argument('--device', help="Use device as target (e.g. user@apertis)")
debug_parser.add_argument('args', help="Arguments to pass to application", nargs=argparse.REMAINDER)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment