Bug 14025

Summary: "info var" doesn't find LOC_UNRESOLVED var
Product: gdb Reporter: dje
Component: symtabAssignee: Not yet assigned to anyone <unassigned>
Status: NEW ---    
Severity: normal    
Priority: P2    
Version: HEAD   
Target Milestone: ---   
Host: Target:
Build: Last reconfirmed:

Description dje 2012-04-27 00:17:00 UTC
This patch to dw2-unresolved.exp shows a case that gdb doesn't handle.
The variable is there, but gdb doesn't print LOC_UNRESOLVED declarations.


Replace xyz with this bug's bug number.


Index: dw2-unresolved.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.dwarf2/dw2-unresolved.exp,v
retrieving revision 1.5
diff -u -p -r1.5 dw2-unresolved.exp
--- dw2-unresolved.exp  4 Jan 2012 08:17:51 -0000       1.5
+++ dw2-unresolved.exp  27 Apr 2012 00:10:34 -0000
@@ -34,3 +34,37 @@ gdb_continue_to_breakpoint "*extern_bloc

 # Expect the inner value 2.  Value 1 from the outer local block is shadowed.
 gdb_test "print/d var" "= 2"
+
+# Second version of test for bug xyz.
+# "info var var" should see the global var, but it does not.
+
+if { [prepare_for_testing dw2-unresolved.exp "dw2-unresolved" {dw2-unresolved-main.c dw2-unresolved.S} {debug}] } {
+    return -1
+}
+
+if ![runto_main] {
+    return -1
+}
+
+gdb_breakpoint "*extern_block_start"
+gdb_continue_to_breakpoint "*extern_block_start"
+
+# Expect the inner value 2.  Value 1 from the outer local block is shadowed.
+gdb_test "print/d var" "= 2"
+
+set test "ptype var"
+gdb_test_multiple $test $test {
+    -re "type = unsigned char\[\r\n]+$gdb_prompt $" {
+       pass $test
+    }
+}
+
+set test "info var var"
+gdb_test_multiple $test $test {
+    -re "  var\[\r\n\]+.*$gdb_prompt $" {
+       pass $test
+    }
+    -re "$gdb_prompt $" {
+       kfail symtab/xyz $test
+    }
+}