From 25abf97969e50190cb5532b25b8e1deef3ab3bde Mon Sep 17 00:00:00 2001 From: Yao Qi Date: Fri, 17 Jul 2015 14:32:40 +0100 Subject: Use debug_printf to print debug message Some functions in aarch64-linux-nat.c and linux-aarch64-low.c looks the same except for the code printing debug message. In GDB, we use fprintf_unfiltered (gdb_stdlog, ...) while in GDBserver, we use fprintf (stderr, ...). This patch is to change them to use debug_printf so that these functions are the same, and I can move them to a common place in the following patch. gdb: 2015-07-17 Yao Qi * aarch64-linux-nat.c (aarch64_show_debug_reg_state): Use debug_printf. (aarch64_handle_unaligned_watchpoint): Likewise. gdb/gdbserver: 2015-07-17 Yao Qi * linux-aarch64-low.c (aarch64_show_debug_reg_state): Use debug_printf. (aarch64_handle_unaligned_watchpoint): Likewise. --- gdb/ChangeLog | 6 ++++++ gdb/aarch64-linux-nat.c | 40 +++++++++++++++++++-------------------- gdb/gdbserver/ChangeLog | 6 ++++++ gdb/gdbserver/linux-aarch64-low.c | 38 ++++++++++++++++++------------------- 4 files changed, 50 insertions(+), 40 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 6f068b5e3c7..987db387a7b 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,9 @@ +2015-07-17 Yao Qi + + * aarch64-linux-nat.c (aarch64_show_debug_reg_state): Use + debug_printf. + (aarch64_handle_unaligned_watchpoint): Likewise. + 2015-07-17 Yao Qi * aarch64-linux-nat.c (aarch64_dr_state_insert_one_point): Change diff --git a/gdb/aarch64-linux-nat.c b/gdb/aarch64-linux-nat.c index 5b20f803abd..7dc0a6e1f2c 100644 --- a/gdb/aarch64-linux-nat.c +++ b/gdb/aarch64-linux-nat.c @@ -429,30 +429,28 @@ aarch64_show_debug_reg_state (struct aarch64_debug_reg_state *state, { int i; - fprintf_unfiltered (gdb_stdlog, "%s", func); + debug_printf ("%s", func); if (addr || len) - fprintf_unfiltered (gdb_stdlog, " (addr=0x%08lx, len=%d, type=%s)", - (unsigned long) addr, len, - type == hw_write ? "hw-write-watchpoint" - : (type == hw_read ? "hw-read-watchpoint" - : (type == hw_access ? "hw-access-watchpoint" - : (type == hw_execute ? "hw-breakpoint" - : "??unknown??")))); - fprintf_unfiltered (gdb_stdlog, ":\n"); - - fprintf_unfiltered (gdb_stdlog, "\tBREAKPOINTs:\n"); + debug_printf (" (addr=0x%08lx, len=%d, type=%s)", + (unsigned long) addr, len, + type == hw_write ? "hw-write-watchpoint" + : (type == hw_read ? "hw-read-watchpoint" + : (type == hw_access ? "hw-access-watchpoint" + : (type == hw_execute ? "hw-breakpoint" + : "??unknown??")))); + debug_printf (":\n"); + + debug_printf ("\tBREAKPOINTs:\n"); for (i = 0; i < aarch64_num_bp_regs; i++) - fprintf_unfiltered (gdb_stdlog, - "\tBP%d: addr=0x%08lx, ctrl=0x%08x, ref.count=%d\n", - i, state->dr_addr_bp[i], - state->dr_ctrl_bp[i], state->dr_ref_count_bp[i]); + debug_printf ("\tBP%d: addr=0x%08lx, ctrl=0x%08x, ref.count=%d\n", + i, state->dr_addr_bp[i], + state->dr_ctrl_bp[i], state->dr_ref_count_bp[i]); - fprintf_unfiltered (gdb_stdlog, "\tWATCHPOINTs:\n"); + debug_printf ("\tWATCHPOINTs:\n"); for (i = 0; i < aarch64_num_wp_regs; i++) - fprintf_unfiltered (gdb_stdlog, - "\tWP%d: addr=0x%08lx, ctrl=0x%08x, ref.count=%d\n", - i, state->dr_addr_wp[i], - state->dr_ctrl_wp[i], state->dr_ref_count_wp[i]); + debug_printf ("\tWP%d: addr=0x%08lx, ctrl=0x%08x, ref.count=%d\n", + i, state->dr_addr_wp[i], + state->dr_ctrl_wp[i], state->dr_ref_count_wp[i]); } /* Fill GDB's register array with the general-purpose register values @@ -1421,7 +1419,7 @@ aarch64_handle_unaligned_watchpoint (int type, CORE_ADDR addr, int len, aligned_len); if (show_debug_regs) - fprintf_unfiltered (gdb_stdlog, + debug_printf ( "handle_unaligned_watchpoint: is_insert: %d\n" " aligned_addr: 0x%08lx, aligned_len: %d\n" " next_addr: 0x%08lx, next_len: %d\n", diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog index 73cb392b7ea..e46d2f89866 100644 --- a/gdb/gdbserver/ChangeLog +++ b/gdb/gdbserver/ChangeLog @@ -1,3 +1,9 @@ +2015-07-17 Yao Qi + + * linux-aarch64-low.c (aarch64_show_debug_reg_state): Use + debug_printf. + (aarch64_handle_unaligned_watchpoint): Likewise. + 2015-07-15 Jan Kratochvil Revert the previous 3 commits: diff --git a/gdb/gdbserver/linux-aarch64-low.c b/gdb/gdbserver/linux-aarch64-low.c index 4534a474772..8a505467d73 100644 --- a/gdb/gdbserver/linux-aarch64-low.c +++ b/gdb/gdbserver/linux-aarch64-low.c @@ -313,28 +313,28 @@ aarch64_show_debug_reg_state (struct aarch64_debug_reg_state *state, { int i; - fprintf (stderr, "%s", func); + debug_printf ("%s", func); if (addr || len) - fprintf (stderr, " (addr=0x%08lx, len=%d, type=%s)", - (unsigned long) addr, len, - type == hw_write ? "hw-write-watchpoint" - : (type == hw_read ? "hw-read-watchpoint" - : (type == hw_access ? "hw-access-watchpoint" - : (type == hw_execute ? "hw-breakpoint" - : "??unknown??")))); - fprintf (stderr, ":\n"); - - fprintf (stderr, "\tBREAKPOINTs:\n"); + debug_printf (" (addr=0x%08lx, len=%d, type=%s)", + (unsigned long) addr, len, + type == hw_write ? "hw-write-watchpoint" + : (type == hw_read ? "hw-read-watchpoint" + : (type == hw_access ? "hw-access-watchpoint" + : (type == hw_execute ? "hw-breakpoint" + : "??unknown??")))); + debug_printf (":\n"); + + debug_printf ("\tBREAKPOINTs:\n"); for (i = 0; i < aarch64_num_bp_regs; i++) - fprintf (stderr, "\tBP%d: addr=0x%s, ctrl=0x%08x, ref.count=%d\n", - i, paddress (state->dr_addr_bp[i]), - state->dr_ctrl_bp[i], state->dr_ref_count_bp[i]); + debug_printf ("\tBP%d: addr=0x%s, ctrl=0x%08x, ref.count=%d\n", + i, paddress (state->dr_addr_bp[i]), + state->dr_ctrl_bp[i], state->dr_ref_count_bp[i]); - fprintf (stderr, "\tWATCHPOINTs:\n"); + debug_printf ("\tWATCHPOINTs:\n"); for (i = 0; i < aarch64_num_wp_regs; i++) - fprintf (stderr, "\tWP%d: addr=0x%s, ctrl=0x%08x, ref.count=%d\n", - i, paddress (state->dr_addr_wp[i]), - state->dr_ctrl_wp[i], state->dr_ref_count_wp[i]); + debug_printf ("\tWP%d: addr=0x%s, ctrl=0x%08x, ref.count=%d\n", + i, paddress (state->dr_addr_wp[i]), + state->dr_ctrl_wp[i], state->dr_ref_count_wp[i]); } static void @@ -911,7 +911,7 @@ aarch64_handle_unaligned_watchpoint (enum target_hw_bp_type type, aligned_len); if (show_debug_regs) - fprintf (stderr, + debug_printf ( "handle_unaligned_watchpoint: is_insert: %d\n" " aligned_addr: 0x%s, aligned_len: %d\n" " next_addr: 0x%s, next_len: %d\n", -- cgit v1.2.1