[1/2,gdb/dap] Move send_gdb_with_response to server module
Checks
Context |
Check |
Description |
linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 |
success
|
Testing passed
|
linaro-tcwg-bot/tcwg_gdb_build--master-arm |
success
|
Testing passed
|
linaro-tcwg-bot/tcwg_gdb_check--master-arm |
fail
|
Testing failed
|
linaro-tcwg-bot/tcwg_gdb_check--master-aarch64 |
fail
|
Testing failed
|
Commit Message
Separated out to make the following patch easier to read.
Tested on aarch64-linux.
---
gdb/python/lib/gdb/dap/next.py | 4 ++--
gdb/python/lib/gdb/dap/server.py | 26 +++++++++++++++++++++++++-
gdb/python/lib/gdb/dap/startup.py | 25 -------------------------
3 files changed, 27 insertions(+), 28 deletions(-)
base-commit: e433bca4847acd34b6178a392335ed10060639ec
@@ -16,8 +16,8 @@
import gdb
from .events import exec_and_expect_stop
-from .server import capability, request
-from .startup import in_gdb_thread, send_gdb, send_gdb_with_response
+from .server import capability, request, send_gdb_with_response
+from .startup import in_gdb_thread, send_gdb
from .state import set_thread
@@ -28,7 +28,6 @@ from .startup import (
in_dap_thread,
in_gdb_thread,
send_gdb,
- send_gdb_with_response,
start_thread,
log,
log_stack,
@@ -421,3 +420,28 @@ def cancel(**args):
# ... which gdb takes to mean that it is fine for all cancel
# requests to report success.
return None
+
+
+def send_gdb_with_response(fn):
+ """Send FN to the gdb thread and return its result.
+ If FN is a string, it is passed to gdb.execute and None is
+ returned as the result.
+ If FN throws an exception, this function will throw the
+ same exception in the calling thread.
+ """
+ if isinstance(fn, str):
+ fn = Invoker(fn)
+ result_q = DAPQueue()
+
+ def message():
+ try:
+ val = fn()
+ result_q.put(val)
+ except (Exception, KeyboardInterrupt) as e:
+ result_q.put(e)
+
+ send_gdb(message)
+ val = result_q.get()
+ if isinstance(val, (Exception, KeyboardInterrupt)):
+ raise val
+ return val
@@ -235,28 +235,3 @@ def send_gdb(cmd):
if isinstance(cmd, str):
cmd = Invoker(cmd)
gdb.post_event(cmd)
-
-
-def send_gdb_with_response(fn):
- """Send FN to the gdb thread and return its result.
- If FN is a string, it is passed to gdb.execute and None is
- returned as the result.
- If FN throws an exception, this function will throw the
- same exception in the calling thread.
- """
- if isinstance(fn, str):
- fn = Invoker(fn)
- result_q = DAPQueue()
-
- def message():
- try:
- val = fn()
- result_q.put(val)
- except (Exception, KeyboardInterrupt) as e:
- result_q.put(e)
-
- send_gdb(message)
- val = result_q.get()
- if isinstance(val, (Exception, KeyboardInterrupt)):
- raise val
- return val