| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
|
| 29 |
|
| 30 |
#include "../../src/makeint.h" |
| 31 |
#include "../../src/debug.h" |
| 32 |
#include "../../src/expand.h" |
| 33 |
#include "../../src/filedef.h" |
| 34 |
#include "../../src/trace.h" |
| 35 |
|
| 36 |
#include "../break.h" |
| 37 |
#include "../cmd.h" |
| 38 |
#include "../file2line.h" |
| 39 |
#include "../fns.h" |
| 40 |
#include "../msg.h" |
| 41 |
#include "../stack.h" |
| 42 |
|
| 43 |
extern debug_return_t |
| 44 |
dbg_cmd_break (char *psz_args) |
| 45 |
{ |
| 46 |
if (!psz_args || !*psz_args) { |
| 47 |
list_breakpoints(); |
| 48 |
return debug_readloop; |
| 49 |
} else { |
| 50 |
char *psz_target = get_word(&psz_args); |
| 51 |
char *psz_break_type; |
| 52 |
file_t *p_target; |
| 53 |
unsigned int i_brkpt_mask = BRK_NONE; |
| 54 |
|
| 55 |
|
| 56 |
if (p_stack && p_stack->p_target) { |
| 57 |
unsigned int u_lineno=0; |
| 58 |
f2l_entry_t entry_type; |
| 59 |
if (get_uint(psz_target, &u_lineno, false)) { |
| 60 |
p_target = target_for_file_and_line(p_stack->p_target->floc.filenm, |
| 61 |
u_lineno, &entry_type); |
| 62 |
if (F2L_TARGET == entry_type) { |
| 63 |
if (!p_target) { |
| 64 |
dbg_errmsg("Can't find target or pattern on line %s.\n" |
| 65 |
"Use 'info lines' to get a list of breakpoint lines.", |
| 66 |
psz_target); |
| 67 |
return debug_cmd_error; |
| 68 |
} |
| 69 |
} else { |
| 70 |
dbg_errmsg("No support of breakpoints on target patterns yet."); |
| 71 |
return debug_cmd_error; |
| 72 |
} |
| 73 |
} else |
| 74 |
p_target = |
| 75 |
lookup_file(variable_expand_set(psz_target, |
| 76 |
p_stack->p_target->variables)); |
| 77 |
} else { |
| 78 |
p_target = lookup_file(psz_target); |
| 79 |
} |
| 80 |
|
| 81 |
if (!p_target) { |
| 82 |
dbg_errmsg("Can't find target %s; breakpoint not set.", psz_target); |
| 83 |
return debug_cmd_error; |
| 84 |
} |
| 85 |
|
| 86 |
|
| 87 |
if (!(psz_args && *psz_args)) |
| 88 |
i_brkpt_mask = BRK_ALL; |
| 89 |
else { |
| 90 |
while ((psz_break_type = get_word(&psz_args))) { |
| 91 |
if (!(psz_break_type && *psz_break_type)) break; |
| 92 |
i_brkpt_mask |= get_brkpt_option(psz_break_type) ; |
| 93 |
} |
| 94 |
} |
| 95 |
add_breakpoint(p_target, i_brkpt_mask); |
| 96 |
} |
| 97 |
|
| 98 |
return debug_readloop; |
| 99 |
}; |
| 100 |
|
| 101 |
|
| 102 |
|
| 103 |
|
| 104 |
|
| 105 |
|
| 106 |
|