Index: gdb/c-exp.y =================================================================== RCS file: /cvs/src/src/gdb/c-exp.y,v retrieving revision 1.42 diff -u -r1.42 c-exp.y --- gdb/c-exp.y 9 Jan 2008 19:27:15 -0000 1.42 +++ gdb/c-exp.y 13 Jan 2008 20:22:26 -0000 @@ -208,6 +208,8 @@ %token TRUEKEYWORD %token FALSEKEYWORD +/* $in_scope opperator */ +%left IN_SCOPE %left ',' %left ABOVE_COMMA @@ -251,6 +253,32 @@ ; /* Expressions, not including the comma operator. */ +exp : IN_SCOPE '(' name_not_typename ')' + { + struct type *int_type; + + /* If there are no symbols then just stop right away */ + if (!have_full_symbols () && !have_partial_symbols ()) + error ("No symbol table is loaded. Use the \"file\" command."); + + /* Otherwise, prepare to write out the value */ + int_type = builtin_type (current_gdbarch)->builtin_int; + write_exp_elt_opcode (OP_LONG); + write_exp_elt_type (int_type); + + if ($3.sym || lookup_minimal_symbol(copy_name($3.stoken), NULL, NULL)) + { + write_exp_elt_longcst ((LONGEST) 1); + } + else + { + write_exp_elt_longcst ((LONGEST) 0); + } + + write_exp_elt_opcode (OP_LONG); + } + ; + exp : '*' exp %prec UNARY { write_exp_elt_opcode (UNOP_IND); } ; @@ -1678,6 +1706,9 @@ /* Catch specific keywords. Should be done with a data structure. */ switch (namelen) { + case 9: + if (strncmp (tokstart, "$in_scope", 9) == 0) + return IN_SCOPE; case 8: if (strncmp (tokstart, "unsigned", 8) == 0) return UNSIGNED;