* lib/gdb.exp (get_hexadecimal_valueof): New procedure.
[deliverable/binutils-gdb.git] / gdb / tracepoint.c
index 4f5c56a66a48fe8d6f512174cd8f54c7a969bcf4..bb3e3e80033d8840e34d6ca0f05c9d2069637c31 100644 (file)
@@ -1,7 +1,7 @@
 /* Tracing functionality for remote targets in custom GDB protocol
 
    Copyright (C) 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
-   2007, 2008 Free Software Foundation, Inc.
+   2007, 2008, 2009 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -38,6 +38,7 @@
 #include "dictionary.h"
 #include "observer.h"
 #include "user-regs.h"
+#include "valprint.h"
 
 #include "ax.h"
 #include "ax-gdb.h"
@@ -67,7 +68,6 @@
 extern void (*deprecated_readline_begin_hook) (char *, ...);
 extern char *(*deprecated_readline_hook) (char *);
 extern void (*deprecated_readline_end_hook) (void);
-extern int addressprint;       /* Print machine addresses? */
 
 /* GDB commands implemented in other modules:
  */  
@@ -434,9 +434,11 @@ trace_command (char *arg, int from_tty)
 static void
 trace_mention (struct tracepoint *tp)
 {
+  struct value_print_options opts;
   printf_filtered ("Tracepoint %d", tp->number);
 
-  if (addressprint || (tp->source_file == NULL))
+  get_user_print_options (&opts);
+  if (opts.addressprint || (tp->source_file == NULL))
     {
       printf_filtered (" at ");
       printf_filtered ("%s", paddress (tp->address));
@@ -467,12 +469,12 @@ tracepoints_info (char *tpnum_exp, int from_tty)
   ALL_TRACEPOINTS (t)
     if (tpnum == -1 || tpnum == t->number)
     {
-      extern int addressprint; /* Print machine addresses?  */
-
+      struct value_print_options opts;
+      get_user_print_options (&opts);
       if (!found_a_tracepoint++)
        {
          printf_filtered ("Num Enb ");
-         if (addressprint)
+         if (opts.addressprint)
            {
              if (gdbarch_addr_bit (current_gdbarch) <= 32)
                printf_filtered ("Address    ");
@@ -482,7 +484,7 @@ tracepoints_info (char *tpnum_exp, int from_tty)
          printf_filtered ("PassC StepC What\n");
        }
       strcpy (wrap_indent, "                           ");
-      if (addressprint)
+      if (opts.addressprint)
        {
          if (gdbarch_addr_bit (current_gdbarch) <= 32)
            strcat (wrap_indent, "           ");
@@ -492,7 +494,7 @@ tracepoints_info (char *tpnum_exp, int from_tty)
 
       printf_filtered ("%-3d %-3s ", t->number,
                       t->enabled_p ? "y" : "n");
-      if (addressprint)
+      if (opts.addressprint)
        {
          char *tmp;
 
@@ -2292,6 +2294,7 @@ tracepoint_save_command (char *args, int from_tty)
   char *i1 = "    ", *i2 = "      ";
   char *indent, *actionline, *pathname;
   char tmp[40];
+  struct cleanup *cleanup;
 
   if (args == 0 || *args == 0)
     error (_("Argument required (file name in which to save tracepoints)"));
@@ -2303,10 +2306,11 @@ tracepoint_save_command (char *args, int from_tty)
     }
 
   pathname = tilde_expand (args);
+  cleanup = make_cleanup (xfree, pathname);
   if (!(fp = fopen (pathname, "w")))
     error (_("Unable to open file '%s' for saving tracepoints (%s)"),
           args, safe_strerror (errno));
-  xfree (pathname);
+  make_cleanup_fclose (fp);
   
   ALL_TRACEPOINTS (tp)
   {
@@ -2348,7 +2352,7 @@ tracepoint_save_command (char *args, int from_tty)
          }
       }
   }
-  fclose (fp);
+  do_cleanups (cleanup);
   if (from_tty)
     printf_filtered ("Tracepoints saved to file '%s'.\n", args);
   return;
This page took 0.024383 seconds and 4 git commands to generate.