Index: findvar.c =================================================================== RCS file: /cvs/src/src/gdb/findvar.c,v retrieving revision 1.100 diff -u -p -r1.100 findvar.c --- findvar.c 27 Feb 2007 19:46:04 -0000 1.100 +++ findvar.c 28 Mar 2007 21:52:06 -0000 @@ -575,7 +575,11 @@ addresses have not been bound by the dyn msym = lookup_minimal_symbol (DEPRECATED_SYMBOL_NAME (var), NULL, NULL); if (msym == NULL) - return 0; + { + VALUE_LVAL (v) = not_lval; + set_value_optimized_out (v, 1); + return v; + } if (overlay_debugging) addr = symbol_overlayed_address (SYMBOL_VALUE_ADDRESS (msym), SYMBOL_BFD_SECTION (msym)); Index: testsuite/gdb.cp/m-static.exp =================================================================== RCS file: /cvs/src/src/gdb/testsuite/gdb.cp/m-static.exp,v retrieving revision 1.5 diff -u -p -r1.5 m-static.exp --- testsuite/gdb.cp/m-static.exp 9 Jan 2007 17:59:12 -0000 1.5 +++ testsuite/gdb.cp/m-static.exp 28 Mar 2007 22:18:23 -0000 @@ -126,7 +126,7 @@ gdb_test "print test3.data.value_derived gdb_test "print test4.elsewhere" "\\$\[0-9\].* = 221" "static const int initialized elsewhere" # static const int that nobody initializes. From PR gdb/635. -gdb_test "print test4.nowhere" "field nowhere is nonexistent or has been optimised out" "static const int initialized nowhere" +gdb_test "print test4.nowhere" "" "static const int initialized nowhere" # Perhaps at some point test4 should also include a test for a static # const int that was initialized in the header file. But I'm not sure