Handle non-ASCII identifiers in Ada
[binutils-gdb.git] / gdb / tracepoint.c
index 016bce0bf9b6c132004c20b74309039a8100c84e..67b3118288006a9a949766c04ccc84a2e765a673 100644 (file)
@@ -696,14 +696,14 @@ validate_actionline (const char *line, struct breakpoint *b)
                       (exp->op.get ()));
                  sym = vvop->get_symbol ();
 
-                 if (SYMBOL_CLASS (sym) == LOC_CONST)
+                 if (sym->aclass () == LOC_CONST)
                    {
                      error (_("constant `%s' (value %s) "
                               "will not be collected."),
                             sym->print_name (),
                             plongest (SYMBOL_VALUE (sym)));
                    }
-                 else if (SYMBOL_CLASS (sym) == LOC_OPTIMIZED_OUT)
+                 else if (sym->aclass () == LOC_OPTIMIZED_OUT)
                    {
                      error (_("`%s' is optimized away "
                               "and cannot be collected."),
@@ -927,12 +927,12 @@ collection_list::collect_symbol (struct symbol *sym,
   bfd_signed_vma offset;
   int treat_as_expr = 0;
 
-  len = TYPE_LENGTH (check_typedef (SYMBOL_TYPE (sym)));
-  switch (SYMBOL_CLASS (sym))
+  len = TYPE_LENGTH (check_typedef (sym->type ()));
+  switch (sym->aclass ())
     {
     default:
       printf_filtered ("%s: don't know symbol class %d\n",
-                      sym->print_name (), SYMBOL_CLASS (sym));
+                      sym->print_name (), sym->aclass ());
       break;
     case LOC_CONST:
       printf_filtered ("constant %s (value %s) will not be collected.\n",
@@ -948,7 +948,7 @@ collection_list::collect_symbol (struct symbol *sym,
        }
       /* A struct may be a C++ class with static fields, go to general
         expression handling.  */
-      if (SYMBOL_TYPE (sym)->code () == TYPE_CODE_STRUCT)
+      if (sym->type ()->code () == TYPE_CODE_STRUCT)
        treat_as_expr = 1;
       else
        add_memrange (gdbarch, memrange_absolute, offset, len, scope);
@@ -960,7 +960,7 @@ collection_list::collect_symbol (struct symbol *sym,
       add_local_register (gdbarch, reg, scope);
       /* Check for doubles stored in two registers.  */
       /* FIXME: how about larger types stored in 3 or more regs?  */
-      if (SYMBOL_TYPE (sym)->code () == TYPE_CODE_FLT &&
+      if (sym->type ()->code () == TYPE_CODE_FLT &&
          len > register_size (gdbarch, reg))
        add_local_register (gdbarch, reg + 1, scope);
       break;
@@ -1041,36 +1041,6 @@ collection_list::collect_symbol (struct symbol *sym,
     }
 }
 
-/* Data to be passed around in the calls to the locals and args
-   iterators.  */
-
-struct add_local_symbols_data
-{
-  struct collection_list *collect;
-  struct gdbarch *gdbarch;
-  CORE_ADDR pc;
-  long frame_regno;
-  long frame_offset;
-  int count;
-  int trace_string;
-};
-
-/* The callback for the locals and args iterators.  */
-
-static void
-do_collect_symbol (const char *print_name,
-                  struct symbol *sym,
-                  void *cb_data)
-{
-  struct add_local_symbols_data *p = (struct add_local_symbols_data *) cb_data;
-
-  p->collect->collect_symbol (sym, p->gdbarch, p->frame_regno,
-                             p->frame_offset, p->pc, p->trace_string);
-  p->count++;
-
-  p->collect->add_wholly_collected (print_name);
-}
-
 void
 collection_list::add_wholly_collected (const char *print_name)
 {
@@ -1085,15 +1055,16 @@ collection_list::add_local_symbols (struct gdbarch *gdbarch, CORE_ADDR pc,
                                    int trace_string)
 {
   const struct block *block;
-  struct add_local_symbols_data cb_data;
+  int count = 0;
 
-  cb_data.collect = this;
-  cb_data.gdbarch = gdbarch;
-  cb_data.pc = pc;
-  cb_data.frame_regno = frame_regno;
-  cb_data.frame_offset = frame_offset;
-  cb_data.count = 0;
-  cb_data.trace_string = trace_string;
+  auto do_collect_symbol = [&] (const char *print_name,
+                               struct symbol *sym)
+    {
+      collect_symbol (sym, gdbarch, frame_regno,
+                     frame_offset, pc, trace_string);
+      count++;
+      add_wholly_collected (print_name);
+    };
 
   if (type == 'L')
     {
@@ -1105,8 +1076,8 @@ collection_list::add_local_symbols (struct gdbarch *gdbarch, CORE_ADDR pc,
          return;
        }
 
-      iterate_over_block_local_vars (block, do_collect_symbol, &cb_data);
-      if (cb_data.count == 0)
+      iterate_over_block_local_vars (block, do_collect_symbol);
+      if (count == 0)
        warning (_("No locals found in scope."));
     }
   else
@@ -1119,8 +1090,8 @@ collection_list::add_local_symbols (struct gdbarch *gdbarch, CORE_ADDR pc,
          return;
        }
 
-      iterate_over_block_arg_vars (block, do_collect_symbol, &cb_data);
-      if (cb_data.count == 0)
+      iterate_over_block_arg_vars (block, do_collect_symbol);
+      if (count == 0)
        warning (_("No args found in scope."));
     }
 }
@@ -2395,10 +2366,10 @@ tfind_line_command (const char *args, int from_tty)
          printf_filtered ("Line %d of \"%s\"",
                           sal.line,
                           symtab_to_filename_for_display (sal.symtab));
-         wrap_here (2);
+         gdb_stdout->wrap_here (2);
          printf_filtered (" is at address ");
          print_address (get_current_arch (), start_pc, gdb_stdout);
-         wrap_here (2);
+         gdb_stdout->wrap_here (2);
          printf_filtered (" but contains no code.\n");
          sal = find_pc_line (start_pc, 0);
          if (sal.line > 0
@@ -2410,14 +2381,14 @@ tfind_line_command (const char *args, int from_tty)
            error (_("Cannot find a good line."));
        }
       }
-    else
-      {
-       /* Is there any case in which we get here, and have an address
-          which the user would want to see?  If we have debugging
-          symbols and no line numbers?  */
-       error (_("Line number %d is out of range for \"%s\"."),
-              sal.line, symtab_to_filename_for_display (sal.symtab));
-      }
+  else
+    {
+      /* Is there any case in which we get here, and have an address
+        which the user would want to see?  If we have debugging
+        symbols and no line numbers?  */
+      error (_("Line number %d is out of range for \"%s\"."),
+            sal.line, symtab_to_filename_for_display (sal.symtab));
+    }
 
   /* Find within range of stated line.  */
   if (args && *args)
@@ -2550,12 +2521,12 @@ info_scope_command (const char *args_in, int from_tty)
                                                          gdb_stdout);
          else
            {
-             switch (SYMBOL_CLASS (sym))
+             switch (sym->aclass ())
                {
                default:
                case LOC_UNDEF: /* Messed up symbol?  */
                  printf_filtered ("a bogus symbol, class %d.\n",
-                                  SYMBOL_CLASS (sym));
+                                  sym->aclass ());
                  count--;              /* Don't count this one.  */
                  continue;
                case LOC_CONST:
@@ -2565,8 +2536,8 @@ info_scope_command (const char *args_in, int from_tty)
                  break;
                case LOC_CONST_BYTES:
                  printf_filtered ("constant bytes: ");
-                 if (SYMBOL_TYPE (sym))
-                   for (j = 0; j < TYPE_LENGTH (SYMBOL_TYPE (sym)); j++)
+                 if (sym->type ())
+                   for (j = 0; j < TYPE_LENGTH (sym->type ()); j++)
                      printf_filtered (" %02x",
                                       (unsigned) SYMBOL_VALUE_BYTES (sym)[j]);
                  break;
@@ -2586,7 +2557,7 @@ info_scope_command (const char *args_in, int from_tty)
                  regno = SYMBOL_REGISTER_OPS (sym)->register_number (sym,
                                                                      gdbarch);
 
-                 if (SYMBOL_IS_ARGUMENT (sym))
+                 if (sym->is_argument ())
                    printf_filtered ("an argument in register $%s",
                                     gdbarch_register_name (gdbarch, regno));
                  else
@@ -2645,9 +2616,9 @@ info_scope_command (const char *args_in, int from_tty)
                  gdb_assert_not_reached ("LOC_COMPUTED variable missing a method");
                }
            }
-         if (SYMBOL_TYPE (sym))
+         if (sym->type ())
            {
-             struct type *t = check_typedef (SYMBOL_TYPE (sym));
+             struct type *t = check_typedef (sym->type ());
 
              printf_filtered (", length %s.\n", pulongest (TYPE_LENGTH (t)));
            }
@@ -3985,7 +3956,6 @@ traceframe_available_memory (std::vector<mem_range> *result,
 static const struct internalvar_funcs sdata_funcs =
 {
   sdata_make_value,
-  NULL,
   NULL
 };