From 495a23f22b2acfa6229375452c74bb8b26f80b78 Mon Sep 17 00:00:00 2001 From: Thiago Jung Bauermann Date: Thu, 31 Mar 2011 14:32:46 +0000 Subject: 2011-03-31 Thiago Jung Bauermann Sergio Durigan Junior Implement support for PowerPC BookE ranged breakpoints. gdb/ * NEWS: Mention support for ranged breakpoints on embedded PowerPC. * breakpoint.h (struct bp_target_info) : New member variable. (struct breakpoint_ops) : Take struct bp_location instead of struct breakpoint as argument, and also add ASPACE and BP_ADDR arguments. Update all callers. (struct breakpoint_ops) : New method. (struct breakpoint) : New member variable. * breakpoint.c (breakpoint_location_address_match): Add function prototype. (insert_bp_location): Set bl->target_info.length. (breakpoint_here_p): Call breakpoint_location_address_match. (moribund_breakpoint_here_p): Likewise. (regular_breakpoint_inserted_here_p): Likewise. (breakpoint_thread_match): Likewise. (bpstat_stop_status): Likewise. (bpstat_check_location): Move call to breakpoint_ops.breakpoint_hit to the top. (print_one_breakpoint_location): Call breakpoint_ops.print_one_detail if available. (breakpoint_address_match_range): New function. (breakpoint_location_address_match): Likewise. (breakpoint_locations_match): Compare the length field of the locations too. (hw_breakpoint_used_count): Count resources used by all locations in a breakpoint, and use breakpoint_ops.resources_needed if available. (breakpoint_hit_ranged_breakpoint): New function. (resources_needed_ranged_breakpoint): Likewise. (print_it_ranged_breakpoint): Likewise. (print_one_ranged_breakpoint): Likewise. (print_one_detail_ranged_breakpoint): Likewise. (print_mention_ranged_breakpoint): Likewise. (print_recreate_ranged_breakpoint): Likewise. (ranged_breakpoint_ops): New structure. (find_breakpoint_range_end): New function. (break_range_command): Likewise. (delete_breakpoint): Free addr_string_range_end. (update_breakpoint_locations): Add SALS_END argument. Update all callers. Calculate breakpoint length if a non-zero SALS_END is given. Call breakpoint_locations_match instead of breakpoint_address_match. (reset_breakpoint): Find SaL of the end of the range if B is a ranged breakpoint. (_initialize_breakpoint): Register break-range command. * defs.h (print_core_address): Add function prototype. * ppc-linux-nat.c (ppc_linux_ranged_break_num_registers): New function. (ppc_linux_insert_hw_breakpoint): Support ranged breakpoints. (ppc_linux_remove_hw_breakpoint): Likewise. (_initialize_ppc_linux_nat): Initialize to_ranged_break_num_registers. * target.c (update_current_target): Add comment about to_ranged_break_num_registers. (target_ranged_break_num_registers): New function. * target.h (struct target_ops) : New method. (target_ranged_break_num_registers): Add function prototype. * ui-out.c (ui_out_field_core_addr): Move address-printing logic to ... * utils.c (print_core_address): ... here. gdb/doc/ * gdb.texinfo (PowerPC Embedded): Document ranged breakpoints. --- gdb/breakpoint.h | 32 +++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) (limited to 'gdb/breakpoint.h') diff --git a/gdb/breakpoint.h b/gdb/breakpoint.h index 2cb56b74488..18a7ce791ae 100644 --- a/gdb/breakpoint.h +++ b/gdb/breakpoint.h @@ -231,6 +231,10 @@ struct bp_target_info is used to determine the type of breakpoint to insert. */ CORE_ADDR placed_address; + /* If this is a ranged breakpoint, then this field contains the + length of the range that will be watched for execution. */ + int length; + /* If the breakpoint lives in memory and reading that memory would give back the breakpoint, instead of the original contents, then the original contents are cached here. Only SHADOW_LEN bytes of @@ -339,7 +343,8 @@ struct bp_location CORE_ADDR address; /* For hardware watchpoints, the size of the memory region being - watched. */ + watched. For hardware ranged breakpoints, the size of the + breakpoint range. */ int length; /* Type of hardware watchpoint. */ @@ -397,7 +402,8 @@ struct breakpoint_ops /* Return non-zero if the debugger should tell the user that this breakpoint was hit. */ - int (*breakpoint_hit) (struct breakpoint *); + int (*breakpoint_hit) (const struct bp_location *, struct address_space *, + CORE_ADDR); /* Tell how many hardware resources (debug registers) are needed for this breakpoint. If this function is not provided, then @@ -412,6 +418,20 @@ struct breakpoint_ops breakpoints". */ void (*print_one) (struct breakpoint *, struct bp_location **); + /* Display extra information about this breakpoint, below the normal + breakpoint description in "info breakpoints". + + In the example below, the "address range" line was printed + by print_one_detail_ranged_breakpoint. + + (gdb) info breakpoints + Num Type Disp Enb Address What + 2 hw breakpoint keep y in main at test-watch.c:70 + address range: [0x10000458, 0x100004c7] + + */ + void (*print_one_detail) (const struct breakpoint *, struct ui_out *); + /* Display information about this breakpoint after setting it (roughly speaking; this is called from "mention"). */ void (*print_mention) (struct breakpoint *); @@ -502,6 +522,11 @@ struct breakpoint /* String we used to set the breakpoint (malloc'd). */ char *addr_string; + + /* For a ranged breakpoint, the string we used to find + the end of the range (malloc'd). */ + char *addr_string_range_end; + /* Architecture we used to set the breakpoint. */ struct gdbarch *gdbarch; /* Language we used to set the breakpoint. */ @@ -904,7 +929,8 @@ extern int breakpoint_thread_match (struct address_space *, extern void until_break_command (char *, int, int); extern void update_breakpoint_locations (struct breakpoint *b, - struct symtabs_and_lines sals); + struct symtabs_and_lines sals, + struct symtabs_and_lines sals_end); extern void breakpoint_re_set (void); -- cgit v1.2.1