]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blobdiff - gdb/testsuite/gdb.python/py-inferior.exp
Fix gdb.Inferior.read_memory without execution (PR dap/30644)
[thirdparty/binutils-gdb.git] / gdb / testsuite / gdb.python / py-inferior.exp
index 13beebd08cc09878efa6ebda82e32b85d3e50ef0..6fbcdd6822f02fd050cf3cc6347be310b656f8bb 100644 (file)
@@ -34,6 +34,16 @@ switch [get_endianness] {
     big { set python_pack_char ">" }
 }
 
+# Test memory read operations without execution.
+
+gdb_py_test_silent_cmd "python addr = gdb.lookup_global_symbol ('int8_global').value().address" \
+  "get global variable address" 0
+gdb_test "python \
+           int8_global_mv = gdb.selected_inferior().read_memory (addr, 1); \
+           print(int.from_bytes(int8_global_mv\[0\], byteorder='little'))" \
+    "\r\n42" \
+    "read memory without execution"
+
 # The following tests require execution.
 
 if {![runto_main]} {