]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blobdiff - gdb/parse.c
sim: bfin: initial bf60x support
[thirdparty/binutils-gdb.git] / gdb / parse.c
index 2f014dd2172eb7f892595096041e1d31f85d5519..b57d112fafd9515ff9d2ea09af6e0be7ccdd2d74 100644 (file)
@@ -41,7 +41,7 @@
 #include "language.h"
 #include "parser-defs.h"
 #include "gdbcmd.h"
-#include "symfile.h"           /* for overlay functions */
+#include "symfile.h"
 #include "inferior.h"
 #include "target-float.h"
 #include "block.h"
@@ -49,7 +49,7 @@
 #include "objfiles.h"
 #include "user-regs.h"
 #include <algorithm>
-#include "gdbsupport/gdb_optional.h"
+#include <optional>
 #include "c-exp.h"
 
 static unsigned int expressiondebug = 0;
@@ -62,7 +62,7 @@ show_expressiondebug (struct ui_file *file, int from_tty,
 
 
 /* True if an expression parser should set yydebug.  */
-bool parser_debug;
+static bool parser_debug;
 
 static void
 show_parserdebug (struct ui_file *file, int from_tty,
@@ -344,26 +344,31 @@ parse_exp_in_context (const char **stringptr, CORE_ADDR pc,
   if (tracker == nullptr)
     tracker = &local_tracker;
 
-  /* If no context specified, try using the current frame, if any.  */
-  if (!expression_context_block)
-    expression_context_block = get_selected_block (&expression_context_pc);
-  else if (pc == 0)
-    expression_context_pc = expression_context_block->entry_pc ();
-  else
-    expression_context_pc = pc;
+  if ((flags & PARSER_LEAVE_BLOCK_ALONE) == 0)
+    {
+      /* If no context specified, try using the current frame, if any.  */
+      if (!expression_context_block)
+       expression_context_block
+         = get_selected_block (&expression_context_pc);
+      else if (pc == 0)
+       expression_context_pc = expression_context_block->entry_pc ();
+      else
+       expression_context_pc = pc;
 
-  /* Fall back to using the current source static context, if any.  */
+      /* Fall back to using the current source static context, if any.  */
 
-  if (!expression_context_block)
-    {
-      struct symtab_and_line cursal = get_current_source_symtab_and_line ();
+      if (!expression_context_block)
+       {
+         struct symtab_and_line cursal
+           = get_current_source_symtab_and_line ();
 
-      if (cursal.symtab)
-       expression_context_block
-         = cursal.symtab->compunit ()->blockvector ()->static_block ();
+         if (cursal.symtab)
+           expression_context_block
+             = cursal.symtab->compunit ()->blockvector ()->static_block ();
 
-      if (expression_context_block)
-       expression_context_pc = expression_context_block->entry_pc ();
+         if (expression_context_block)
+           expression_context_pc = expression_context_block->entry_pc ();
+       }
     }
 
   if (language_mode == language_mode_auto && block != NULL)
@@ -466,7 +471,7 @@ parse_expression (const char *string, innermost_block_tracker *tracker,
 expression_up
 parse_expression_with_language (const char *string, enum language lang)
 {
-  gdb::optional<scoped_restore_current_language> lang_saver;
+  std::optional<scoped_restore_current_language> lang_saver;
   if (current_language->la_language != lang)
     {
       lang_saver.emplace ();