diff options
author | Tom de Vries <tdevries@suse.de> | 2024-04-16 15:53:47 +0200 |
---|---|---|
committer | Tom de Vries <tdevries@suse.de> | 2024-04-16 15:53:47 +0200 |
commit | 06e967dbc9b75a4a3c1b15b54360cf1abbf9c2bd (patch) | |
tree | 6e4a4137a7b51c19937e94038188b55abf29ccc3 /gdb/testsuite/gdb.dap | |
parent | 2d4c39a885d4d12325d0a9be9e014e75a295fb25 (diff) | |
download | binutils-06e967dbc9b75a4a3c1b15b54360cf1abbf9c2bd.zip binutils-06e967dbc9b75a4a3c1b15b54360cf1abbf9c2bd.tar.gz binutils-06e967dbc9b75a4a3c1b15b54360cf1abbf9c2bd.tar.bz2 |
[gdb/python] Throw MemoryError in inferior.read_memory if malloc fails
PR python/31631 reports a gdb internal error when doing:
...
(gdb) python gdb.selected_inferior().read_memory (0, 0xffffffffffffffff)
utils.c:709: internal-error: virtual memory exhausted.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
...
Fix this by throwing a python MemoryError, such that we have instead:
...
(gdb) python gdb.selected_inferior().read_memory (0, 0xffffffffffffffff)
Python Exception <class 'MemoryError'>:
Error occurred in Python.
(gdb)
...
Likewise for DAP.
Tested on x86_64-linux.
Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31631
Diffstat (limited to 'gdb/testsuite/gdb.dap')
-rw-r--r-- | gdb/testsuite/gdb.dap/memory.exp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.dap/memory.exp b/gdb/testsuite/gdb.dap/memory.exp index 2e911f4..4e2e361 100644 --- a/gdb/testsuite/gdb.dap/memory.exp +++ b/gdb/testsuite/gdb.dap/memory.exp @@ -55,6 +55,11 @@ set obj [dap_check_request_and_response "evaluate global pointer" \ evaluate {o expression [s thirty_two_p]}] set addr [dict get [lindex $obj 0] body memoryReference] +set obj [dap_request_and_response \ + readMemory [format {o memoryReference [s %s] count [i 18446744073709551615]} $addr]] +set response [lindex $obj 0] +gdb_assert { [dict get $response success] == "false" } "read memory, count to big" + set obj [dap_check_request_and_response "read memory" \ readMemory [format {o memoryReference [s %s] count [i 4]} $addr]] |