#include "annotate.h"
#include "symfile.h"
#include "objfiles.h"
+#include "source.h"
#include "linespec.h"
#include "completer.h"
#include "gdb.h"
#include "ui-out.h"
+#include "cli/cli-script.h"
#include "gdb-events.h"
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];
-#ifdef ONE_PROCESS_WRITETEXT
- process_warning = 1;
-#endif
-
struct ui_file *tmp_error_stream = mem_fileopen ();
make_cleanup_ui_file_delete (tmp_error_stream);
if (b->enable_state == bp_permanent)
/* Permanent breakpoints cannot be inserted or removed. */
continue;
- else if (b->type != bp_watchpoint
+ if ((b->type == bp_watchpoint
+ || b->type == bp_hardware_watchpoint
+ || b->type == bp_read_watchpoint
+ || b->type == bp_access_watchpoint) && (!b->val))
+ {
+ struct value *val;
+ val = evaluate_expression (b->exp);
+ release_value (val);
+ if (VALUE_LAZY (val))
+ value_fetch_lazy (val);
+ b->val = val;
+ }
+ if (b->type != bp_watchpoint
&& b->type != bp_hardware_watchpoint
&& b->type != bp_read_watchpoint
&& b->type != bp_access_watchpoint
if (!disabled_breaks)
{
fprintf_unfiltered (tmp_error_stream,
- "Cannot insert breakpoint %d.\n", b->number);
+ "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);
+ 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;
}
else
{
- fprintf_unfiltered (tmp_error_stream, "Cannot insert breakpoint %d.\n", b->number);
- fprintf_filtered (tmp_error_stream, "Error accessing memory address ");
+ 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));
fprintf_unfiltered (tmp_error_stream,
"Cannot insert catchpoint %d; disabling it.\n",
b->number);
- fprintf_filtered (tmp_error_stream, "Error accessing memory address ");
+ 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));
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);
+ "Could not insert hardware watchpoint %d.\n",
+ b->number);
val = -1;
}
}
}
if (val < 0)
{
- fprintf_unfiltered (tmp_error_stream, "Cannot insert catchpoint %d.", b->number);
+ fprintf_unfiltered (tmp_error_stream,
+ "Cannot insert catchpoint %d.", b->number);
}
else
b->inserted = 1;
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");
+ 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.");
-
+ 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);
}
/* Likewise for watchpoints on local expressions. */
if (b->exp_valid_block != NULL)
delete_breakpoint (b);
+ if (context == inf_starting)
+ {
+ /* Reset val field to force reread of starting value
+ in insert_breakpoints. */
+ if (b->val)
+ value_free (b->val);
+ b->val = NULL;
+ }
break;
default:
/* Likewise for exception catchpoints in dynamic-linked
current_source_symtab (which is decode_line_1's default). This
should produce the results we want almost all of the time while
leaving default_breakpoint_* alone. */
+
+ struct symtab_and_line cursal =
+ get_current_or_default_source_symtab_and_line ();
+
if (default_breakpoint_valid
- && (!current_source_symtab
+ && (!cursal.symtab
|| (strchr ("+-", (*address)[0]) != NULL)))
*sals = decode_line_1 (address, 1, default_breakpoint_symtab,
default_breakpoint_line, addr_string);