[PATCH] insert_breakpoints

Michael Snyder msnyder@redhat.com
Mon Aug 26 18:24:00 GMT 2002


Grace, 

A few minor clean-ups, most notably, tweaking the protection of 
'process_warning'.

Michael
-------------- next part --------------
2002-08-26  Michael Snyder  <msnyder@redhat.com>

	* breakpoint.c (insert_breakpoints): Protect all references
	to 'process_warning'.  Shorten long lines.

Index: breakpoint.c
===================================================================
RCS file: /cvs/src/src/gdb/breakpoint.c,v
retrieving revision 1.83
diff -p -r1.83 breakpoint.c
*** breakpoint.c	27 Aug 2002 01:09:08 -0000	1.83
--- breakpoint.c	27 Aug 2002 01:09:47 -0000
*************** insert_breakpoints (void)
*** 716,730 ****
    int val = 0;
    int disabled_breaks = 0;
    int hw_breakpoint_error = 0;
    int process_warning = 0;
  
    static char message1[] = "Error inserting catchpoint %d:\n";
    static char message[sizeof (message1) + 30];
  
- #ifdef ONE_PROCESS_WRITETEXT
-   process_warning = 1;
- #endif
- 
    struct ui_file *tmp_error_stream = mem_fileopen ();
    make_cleanup_ui_file_delete (tmp_error_stream);
  
--- 716,728 ----
    int val = 0;
    int disabled_breaks = 0;
    int hw_breakpoint_error = 0;
+ #ifdef ONE_PROCESS_WRITETEXT
    int process_warning = 0;
+ #endif
  
    static char message1[] = "Error inserting catchpoint %d:\n";
    static char message[sizeof (message1) + 30];
  
    struct ui_file *tmp_error_stream = mem_fileopen ();
    make_cleanup_ui_file_delete (tmp_error_stream);
  
*************** insert_breakpoints (void)
*** 824,840 ****
  		if (!disabled_breaks)
  		  {
  		    fprintf_unfiltered (tmp_error_stream, 
! 					"Cannot insert breakpoint %d.\n", b->number);
  		    fprintf_unfiltered (tmp_error_stream, 
  					"Temporarily disabling shared library breakpoints:\n");
  		  }
  		disabled_breaks = 1;
! 		fprintf_unfiltered (tmp_error_stream, "breakpoint #%d\n", b->number);
  	      }
  	    else
  #endif
  	      {
  		process_warning = 1;
  		if (b->type == bp_hardware_breakpoint)
  		  {
  		    hw_breakpoint_error = 1;
--- 822,842 ----
  		if (!disabled_breaks)
  		  {
  		    fprintf_unfiltered (tmp_error_stream, 
! 					"Cannot insert breakpoint %d.\n", 
! 					b->number);
  		    fprintf_unfiltered (tmp_error_stream, 
  					"Temporarily disabling shared library breakpoints:\n");
  		  }
  		disabled_breaks = 1;
! 		fprintf_unfiltered (tmp_error_stream, 
! 				    "breakpoint #%d\n", b->number);
  	      }
  	    else
  #endif
  	      {
+ #ifdef ONE_PROCESS_WRITETEXT
  		process_warning = 1;
+ #endif
  		if (b->type == bp_hardware_breakpoint)
  		  {
  		    hw_breakpoint_error = 1;
*************** insert_breakpoints (void)
*** 844,851 ****
  		  }
  		else
  		  {
! 		    fprintf_unfiltered (tmp_error_stream, "Cannot insert breakpoint %d.\n", b->number);
! 		    fprintf_filtered (tmp_error_stream, "Error accessing memory address ");
  		    print_address_numeric (b->address, 1, tmp_error_stream);
  		    fprintf_filtered (tmp_error_stream, ": %s.\n",
  				      safe_strerror (val));
--- 846,856 ----
  		  }
  		else
  		  {
! 		    fprintf_unfiltered (tmp_error_stream, 
! 					"Cannot insert breakpoint %d.\n", 
! 					b->number);
! 		    fprintf_filtered (tmp_error_stream, 
! 				      "Error accessing memory address ");
  		    print_address_numeric (b->address, 1, tmp_error_stream);
  		    fprintf_filtered (tmp_error_stream, ": %s.\n",
  				      safe_strerror (val));
*************** insert_breakpoints (void)
*** 880,886 ****
  	    fprintf_unfiltered (tmp_error_stream, 
  				"Cannot insert catchpoint %d; disabling it.\n",
  				b->number);
! 	    fprintf_filtered (tmp_error_stream, "Error accessing memory address ");
  	    print_address_numeric (b->address, 1, tmp_error_stream);
  	    fprintf_filtered (tmp_error_stream, ": %s.\n",
  			      safe_strerror (val));
--- 885,892 ----
  	    fprintf_unfiltered (tmp_error_stream, 
  				"Cannot insert catchpoint %d; disabling it.\n",
  				b->number);
! 	    fprintf_filtered (tmp_error_stream, 
! 			      "Error accessing memory address ");
  	    print_address_numeric (b->address, 1, tmp_error_stream);
  	    fprintf_filtered (tmp_error_stream, ": %s.\n",
  			      safe_strerror (val));
*************** insert_breakpoints (void)
*** 1009,1019 ****
  	       value chain brings us here.  */
  	    if (!b->inserted)
  	      {
- 		process_warning = 1;
  		remove_breakpoint (b, mark_uninserted);
  		hw_breakpoint_error = 1;
  		fprintf_unfiltered (tmp_error_stream,
! 				    "Cannot insert hardware watchpoint %d.\n", b->number);
  		val = -1;
  	      }               
  	  }
--- 1015,1025 ----
  	       value chain brings us here.  */
  	    if (!b->inserted)
  	      {
  		remove_breakpoint (b, mark_uninserted);
  		hw_breakpoint_error = 1;
  		fprintf_unfiltered (tmp_error_stream,
! 				    "Could not insert hardware watchpoint %d.\n", 
! 				    b->number);
  		val = -1;
  	      }               
  	  }
*************** insert_breakpoints (void)
*** 1060,1066 ****
  	  }
  	if (val < 0)
  	  {
! 	    fprintf_unfiltered (tmp_error_stream, "Cannot insert catchpoint %d.", b->number);
  	  }
  	else
  	  b->inserted = 1;
--- 1066,1073 ----
  	  }
  	if (val < 0)
  	  {
! 	    fprintf_unfiltered (tmp_error_stream, 
! 				"Cannot insert catchpoint %d.", b->number);
  	  }
  	else
  	  b->inserted = 1;
*************** insert_breakpoints (void)
*** 1076,1088 ****
           message about possibly exhausted resources.  */
        if (hw_breakpoint_error)  
  	{
! 	  fprintf_unfiltered (tmp_error_stream, "Could not insert hardware breakpoints:\n" 
! 			      "You may have requested too many hardware breakpoints/watchpoints.\n");
  	}
! 
        if (process_warning)
! 	fprintf_unfiltered (tmp_error_stream,"The same program may be running in another process.");
! 
        target_terminal_ours_for_output ();
        error_stream (tmp_error_stream);
      }
--- 1083,1097 ----
           message about possibly exhausted resources.  */
        if (hw_breakpoint_error)  
  	{
! 	  fprintf_unfiltered (tmp_error_stream, 
! 			      "Could not insert hardware breakpoints:\n\
! You may have requested too many hardware breakpoints/watchpoints.\n");
  	}
! #ifdef ONE_PROCESS_WRITETEXT
        if (process_warning)
! 	fprintf_unfiltered (tmp_error_stream,
! 			    "The same program may be running in another process.");
! #endif
        target_terminal_ours_for_output ();
        error_stream (tmp_error_stream);
      }


More information about the Gdb-patches mailing list