From 2b6fd0d87d374675c1cba32ce24cf5c34870d956 Mon Sep 17 00:00:00 2001 From: Andrew Cagney Date: Thu, 1 May 2003 23:21:08 +0000 Subject: 2003-05-01 Andrew Cagney * disasm.c (gdb_disassemble_from_exec): Delete global variable. (gdb_disassembly): Make "di" non static, always initialize and cleanup. Always use dis_asm_read_memory. (gdb_dis_asm_read_memory): Delete function. 2003-05-01 Andrew Cagney * gdb.asm/asm-source.exp: Check that "disassm" and "x/i" of a variable do not give memory errors. --- gdb/testsuite/gdb.asm/asm-source.exp | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) (limited to 'gdb/testsuite/gdb.asm') diff --git a/gdb/testsuite/gdb.asm/asm-source.exp b/gdb/testsuite/gdb.asm/asm-source.exp index ac1bcd2..96b7991 100644 --- a/gdb/testsuite/gdb.asm/asm-source.exp +++ b/gdb/testsuite/gdb.asm/asm-source.exp @@ -293,11 +293,35 @@ gdb_test "next" "17\[ \t\]+gdbasm_leave" "next over foo3" gdb_test "return" "\#0 main .*37\[ \t\]+gdbasm_exit0" "return from foo2" \ "Make (foo2|selected stack frame) return now\?.*" "y" -# See if we can look at a global variable +# Disassemble something, check the output +proc test_dis { command var } { + global gdb_prompt + send_gdb "${command}\n" + gdb_expect { + -re "${var}.*:.*Cannot access" { + # The "disassembler" was only accessing the local + # executable and that would cause attempts to disassemble + # variables to fail (memory not valid). + fail "${command} (memory read error)" + } + -re "${var}.*:.*${gdb_prompt}" { + pass "${command}" + } + timeout { + fail "${command} (timeout)" + } + } +} + +# See if we can look at a global variable, three ways gdb_test "print globalvar" ".* = 11" "look at global variable" +test_dis "x/i globalvar" "globalvar" +test_dis "disassem &globalvar &globalvar+1" "globalvar" -# See if we can look at a static variable +# See if we can look at a static variable, three ways gdb_test "print staticvar" ".* = 5" "look at static variable" +test_dis "x/i &staticvar" "staticvar" +test_dis "disassem &staticvar &staticvar+1" "staticvar" # See if we can look at a static function gdb_test "disassem foostatic" ".*:.*End of assembler dump." \ -- cgit v1.1