* defs.h (struct gdbarch): Add forward declaration.
authorUlrich Weigand <uweigand@de.ibm.com>
Thu, 11 Sep 2008 14:21:49 +0000 (14:21 +0000)
committerUlrich Weigand <uweigand@de.ibm.com>
Thu, 11 Sep 2008 14:21:49 +0000 (14:21 +0000)
(set_next_address): Add GDBARCH argument.
* printcmd.c (set_next_address): Use it to find pointer type.
* breakpoint.c (breakpoint_1): Update call.
* source.c (line_info): Likewise.
* findcmd.c (find_command): Use current_gdbarch to find pointer type.

* breakpoint.c (set_breakpoint_count): Use platform-neutral
types for internal variable values.
* infrun.c (handle_inferior_event): Likewise.
* source.c (forward_search_command, reverse_search_command): Likewise.
* tracepoint.c (set_tracepoint_count, set_traceframe_num,
set_tracepoint_num, set_traceframe_context): Likewise.

gdb/breakpoint.c
gdb/defs.h
gdb/findcmd.c
gdb/infrun.c
gdb/printcmd.c
gdb/source.c
gdb/tracepoint.c

index fa7fb6947761bbef7ab2dd399ba55bef262062a3..9454428522324f83dfa355d92d28f291226e4a32 100644 (file)
@@ -401,7 +401,7 @@ set_breakpoint_count (int num)
 {
   breakpoint_count = num;
   set_internalvar (lookup_internalvar ("bpnum"),
-                  value_from_longest (builtin_type_int, (LONGEST) num));
+                  value_from_longest (builtin_type_int32, (LONGEST) num));
 }
 
 /* Used in run_command to zero the hit count when a new run starts. */
@@ -4031,7 +4031,7 @@ breakpoint_1 (int bnum, int allflag)
       /* Compare against (CORE_ADDR)-1 in case some compiler decides
         that a comparison of an unsigned with -1 is always false.  */
       if (last_addr != (CORE_ADDR) -1 && !server_command)
-       set_next_address (last_addr);
+       set_next_address (current_gdbarch, last_addr);
     }
 
   /* FIXME? Should this be moved up so that it is only called when
index 8d7e0e4bf0528952fe1535d46e2791cf035ed224..b0d18d2cd34842c5da6df773d49aaf4ca99ae15a 100644 (file)
@@ -298,6 +298,7 @@ struct cleanup
 struct symtab;
 struct breakpoint;
 struct frame_info;
+struct gdbarch;
 
 /* From utils.c */
 
@@ -572,7 +573,7 @@ extern int info_verbose;
 
 /* From printcmd.c */
 
-extern void set_next_address (CORE_ADDR);
+extern void set_next_address (struct gdbarch *, CORE_ADDR);
 
 extern void print_address_symbolic (CORE_ADDR, struct ui_file *, int,
                                    char *);
index a1dfaf3bb2cfe97ce74c7c054cd13d8ad60891c2..2996fb02bfa773206d2f2ae5e8c1400daf2001a1 100644 (file)
@@ -292,13 +292,14 @@ find_command (char *args, int from_tty)
   /* Record and print the results.  */
 
   set_internalvar (lookup_internalvar ("numfound"),
-                  value_from_longest (builtin_type_int,
+                  value_from_longest (builtin_type_int32,
                                       (LONGEST) found_count));
   if (found_count > 0)
     {
+      struct gdbarch *gdbarch = current_gdbarch;
+      struct type *ptr_type = builtin_type (gdbarch)->builtin_data_ptr;
       set_internalvar (lookup_internalvar ("_"),
-                      value_from_pointer (builtin_type_void_data_ptr,
-                                          last_found_addr));
+                      value_from_pointer (ptr_type, last_found_addr));
     }
 
   if (found_count == 0)
index 62c4ab3e84689b0f1df32e9259481782bd7d1f84..d914f0adaf68b041293ea8c785491cd1c7ff4b7a 100644 (file)
@@ -2006,7 +2006,7 @@ handle_inferior_event (struct execution_control_state *ecs)
       /* Record the exit code in the convenience variable $_exitcode, so
          that the user can inspect this again later.  */
       set_internalvar (lookup_internalvar ("_exitcode"),
-                      value_from_longest (builtin_type_int,
+                      value_from_longest (builtin_type_int32,
                                           (LONGEST) ecs->ws.value.integer));
       gdb_flush (gdb_stdout);
       target_mourn_inferior ();
index 131099475c6e1a28fa2fb9984485fdaaddadc71f..fae39fe5b9734276779dc5d1c96433baae7bfbab 100644 (file)
@@ -503,13 +503,15 @@ print_scalar_formatted (const void *valaddr, struct type *type,
    The `info lines' command uses this.  */
 
 void
-set_next_address (CORE_ADDR addr)
+set_next_address (struct gdbarch *gdbarch, CORE_ADDR addr)
 {
+  struct type *ptr_type = builtin_type (gdbarch)->builtin_data_ptr;
+
   next_address = addr;
 
   /* Make address available to the user as $_.  */
   set_internalvar (lookup_internalvar ("_"),
-                  value_from_pointer (builtin_type_void_data_ptr, addr));
+                  value_from_pointer (ptr_type, addr));
 }
 
 /* Optionally print address ADDR symbolically as <SYMBOL+OFFSET> on STREAM,
index e0ae0b179fd8c3221b0c09ce10d7200629fa65c7..9493fd1dce87c01046124dd525c327ea5e24db22 100644 (file)
@@ -1511,7 +1511,7 @@ line_info (char *arg, int from_tty)
            }
 
          /* x/i should display this line's code.  */
-         set_next_address (start_pc);
+         set_next_address (current_gdbarch, start_pc);
 
          /* Repeating "info line" should do the following line.  */
          last_line_listed = sal.line + 1;
@@ -1614,7 +1614,7 @@ forward_search_command (char *regex, int from_tty)
          fclose (stream);
          print_source_lines (current_source_symtab, line, line + 1, 0);
          set_internalvar (lookup_internalvar ("_"),
-                          value_from_longest (builtin_type_int,
+                          value_from_longest (builtin_type_int32,
                                               (LONGEST) line));
          current_source_line = max (line - lines_to_list / 2, 1);
          return;
@@ -1696,7 +1696,7 @@ reverse_search_command (char *regex, int from_tty)
          fclose (stream);
          print_source_lines (current_source_symtab, line, line + 1, 0);
          set_internalvar (lookup_internalvar ("_"),
-                          value_from_longest (builtin_type_int,
+                          value_from_longest (builtin_type_int32,
                                               (LONGEST) line));
          current_source_line = max (line - lines_to_list / 2, 1);
          return;
index 671a63a9585d5d16f748bd12ffbd8fec1d933d3f..690eba3104502adb2605a4fc8f276046cc4ff1c2 100644 (file)
@@ -220,7 +220,7 @@ set_tracepoint_count (int num)
 {
   tracepoint_count = num;
   set_internalvar (lookup_internalvar ("tpnum"),
-                  value_from_longest (builtin_type_int, (LONGEST) num));
+                  value_from_longest (builtin_type_int32, (LONGEST) num));
 }
 
 /* Set traceframe number to NUM.  */
@@ -229,7 +229,7 @@ set_traceframe_num (int num)
 {
   traceframe_number = num;
   set_internalvar (lookup_internalvar ("trace_frame"),
-                  value_from_longest (builtin_type_int, (LONGEST) num));
+                  value_from_longest (builtin_type_int32, (LONGEST) num));
 }
 
 /* Set tracepoint number to NUM.  */
@@ -238,8 +238,7 @@ set_tracepoint_num (int num)
 {
   tracepoint_number = num;
   set_internalvar (lookup_internalvar ("tracepoint"),
-                  value_from_longest (builtin_type_int, 
-                                      (LONGEST) num));
+                  value_from_longest (builtin_type_int32, (LONGEST) num));
 }
 
 /* Set externally visible debug variables for querying/printing
@@ -252,23 +251,19 @@ set_traceframe_context (CORE_ADDR trace_pc)
   static struct type *func_range, *file_range;
   struct value *func_val;
   struct value *file_val;
-  static struct type *charstar;
   int len;
 
-  if (charstar == (struct type *) NULL)
-    charstar = lookup_pointer_type (builtin_type_char);
-
   if (trace_pc == -1)          /* Cease debugging any trace buffers.  */
     {
       traceframe_fun = 0;
       traceframe_sal.pc = traceframe_sal.line = 0;
       traceframe_sal.symtab = NULL;
       set_internalvar (lookup_internalvar ("trace_func"),
-                      value_from_pointer (charstar, (LONGEST) 0));
+                      allocate_value (builtin_type_void));
       set_internalvar (lookup_internalvar ("trace_file"),
-                      value_from_pointer (charstar, (LONGEST) 0));
+                      allocate_value (builtin_type_void));
       set_internalvar (lookup_internalvar ("trace_line"),
-                      value_from_longest (builtin_type_int
+                      value_from_longest (builtin_type_int32,
                                           (LONGEST) - 1));
       return;
     }
@@ -280,7 +275,7 @@ set_traceframe_context (CORE_ADDR trace_pc)
   /* Save linenumber as "$trace_line", a debugger variable visible to
      users.  */
   set_internalvar (lookup_internalvar ("trace_line"),
-                  value_from_longest (builtin_type_int,
+                  value_from_longest (builtin_type_int32,
                                       (LONGEST) traceframe_sal.line));
 
   /* Save func name as "$trace_func", a debugger variable visible to
@@ -288,14 +283,14 @@ set_traceframe_context (CORE_ADDR trace_pc)
   if (traceframe_fun == NULL ||
       SYMBOL_LINKAGE_NAME (traceframe_fun) == NULL)
     set_internalvar (lookup_internalvar ("trace_func"),
-                    value_from_pointer (charstar, (LONGEST) 0));
+                    allocate_value (builtin_type_void));
   else
     {
       len = strlen (SYMBOL_LINKAGE_NAME (traceframe_fun));
       func_range = create_range_type (func_range,
-                                     builtin_type_int, 0, len - 1);
+                                     builtin_type_int32, 0, len - 1);
       func_string = create_array_type (func_string,
-                                      builtin_type_char, func_range);
+                                      builtin_type_true_char, func_range);
       func_val = allocate_value (func_string);
       deprecated_set_value_type (func_val, func_string);
       memcpy (value_contents_raw (func_val),
@@ -310,14 +305,14 @@ set_traceframe_context (CORE_ADDR trace_pc)
   if (traceframe_sal.symtab == NULL ||
       traceframe_sal.symtab->filename == NULL)
     set_internalvar (lookup_internalvar ("trace_file"),
-                    value_from_pointer (charstar, (LONGEST) 0));
+                    allocate_value (builtin_type_void));
   else
     {
       len = strlen (traceframe_sal.symtab->filename);
       file_range = create_range_type (file_range,
-                                     builtin_type_int, 0, len - 1);
+                                     builtin_type_int32, 0, len - 1);
       file_string = create_array_type (file_string,
-                                      builtin_type_char, file_range);
+                                      builtin_type_true_char, file_range);
       file_val = allocate_value (file_string);
       deprecated_set_value_type (file_val, file_string);
       memcpy (value_contents_raw (file_val),