From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 22747 invoked by alias); 2 Mar 2012 01:00:46 -0000 Received: (qmail 22582 invoked by uid 22791); 2 Mar 2012 01:00:43 -0000 X-SWARE-Spam-Status: No, hits=-1.3 required=5.0 tests=AWL,BAYES_00,FROM_12LTRDOM X-Spam-Check-By: sourceware.org Received: from relay1.mentorg.com (HELO relay1.mentorg.com) (192.94.38.131) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 02 Mar 2012 01:00:26 +0000 Received: from svr-orw-fem-01.mgc.mentorg.com ([147.34.98.93]) by relay1.mentorg.com with esmtp id 1S3GrC-0001qd-2p from Yao_Qi@mentor.com for gdb-patches@sourceware.org; Thu, 01 Mar 2012 17:00:26 -0800 Received: from SVR-ORW-FEM-05.mgc.mentorg.com ([147.34.97.43]) by svr-orw-fem-01.mgc.mentorg.com over TLS secured channel with Microsoft SMTPSVC(6.0.3790.4675); Thu, 1 Mar 2012 17:00:25 -0800 Received: from localhost.localdomain (147.34.91.1) by svr-orw-fem-05.mgc.mentorg.com (147.34.97.43) with Microsoft SMTP Server id 14.1.289.1; Thu, 1 Mar 2012 17:00:23 -0800 From: Yao Qi To: Subject: [PATCH 1/2] New field stop_pc in tracepoint_hit_ctx Date: Fri, 02 Mar 2012 01:00:00 -0000 Message-ID: <1330650011-31899-2-git-send-email-yao@codesourcery.com> In-Reply-To: <1330650011-31899-1-git-send-email-yao@codesourcery.com> References: <1330650011-31899-1-git-send-email-yao@codesourcery.com> MIME-Version: 1.0 Content-Type: text/plain X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2012-03/txt/msg00064.txt.bz2 This patch is to add a new field `stop_pc' in tracepoint_hit_ctx, so parameter `stop_pc' used here and there can be removed. This change allows us to give a clean interface in next patch. Note the name `tracepoint_hit_ctx' is not very accurate, because it has been used in collect_data_at_step for "while-stepping" action also. It may be renamed to `tracepoint_action_ctx', which is about the context of doing tracepoint actions. I don't rename `tracepoint_hit_ctx' to keep this patch as readable as possible. I can send a follow-up patch to rename it if this change is reasonable. As `tracepoint_hit_ctx' is about the context of doing tracepoint actions, it is natural to add field `stop_pc' to show the pc value when to do tracepoint actions. gdb/gdbserver: * tracepoint (struct tracepoint_hit_ctx) : New field. (collect_data_at_tracepoint): Remove parameter `stop_pc'. Update callers. (collect_data_at_step): Remove parameter `stop_pc'. Update callers. (do_action_at_tracepoint): Remove parameter `stop_pc'. --- gdb/gdbserver/tracepoint.c | 29 +++++++++++++++-------------- 1 files changed, 15 insertions(+), 14 deletions(-) diff --git a/gdb/gdbserver/tracepoint.c b/gdb/gdbserver/tracepoint.c index 7167876..5dcc7a4 100644 --- a/gdb/gdbserver/tracepoint.c +++ b/gdb/gdbserver/tracepoint.c @@ -1125,6 +1125,7 @@ char *tracing_stop_note; struct tracepoint_hit_ctx { enum tracepoint_type type; + CORE_ADDR stop_pc; }; #ifdef IN_PROCESS_AGENT @@ -1205,17 +1206,14 @@ static void clear_installed_tracepoints (void); #endif static void collect_data_at_tracepoint (struct tracepoint_hit_ctx *ctx, - CORE_ADDR stop_pc, struct tracepoint *tpoint); #ifndef IN_PROCESS_AGENT static void collect_data_at_step (struct tracepoint_hit_ctx *ctx, - CORE_ADDR stop_pc, struct tracepoint *tpoint, int current_step); static void compile_tracepoint_condition (struct tracepoint *tpoint, CORE_ADDR *jump_entry); #endif static void do_action_at_tracepoint (struct tracepoint_hit_ctx *ctx, - CORE_ADDR stop_pc, struct tracepoint *tpoint, struct traceframe *tframe, struct tracepoint_action *taction); @@ -4051,6 +4049,7 @@ tracepoint_finished_step (struct thread_info *tinfo, CORE_ADDR stop_pc) wstep->tp_number, paddress (wstep->tp_address)); ctx.base.type = trap_tracepoint; + ctx.base.stop_pc = stop_pc; ctx.regcache = get_thread_regcache (tinfo, 1); while (wstep != NULL) @@ -4074,7 +4073,7 @@ tracepoint_finished_step (struct thread_info *tinfo, CORE_ADDR stop_pc) /* Collect data. */ collect_data_at_step ((struct tracepoint_hit_ctx *) &ctx, - stop_pc, tpoint, wstep->current_step); + tpoint, wstep->current_step); if (wstep->current_step >= tpoint->step_count) { @@ -4213,6 +4212,7 @@ tracepoint_was_hit (struct thread_info *tinfo, CORE_ADDR stop_pc) return 0; ctx.base.type = trap_tracepoint; + ctx.base.stop_pc = stop_pc; ctx.regcache = get_thread_regcache (tinfo, 1); for (tpoint = tracepoints; tpoint; tpoint = tpoint->next) @@ -4235,7 +4235,7 @@ tracepoint_was_hit (struct thread_info *tinfo, CORE_ADDR stop_pc) || (condition_true_at_tracepoint ((struct tracepoint_hit_ctx *) &ctx, tpoint))) collect_data_at_tracepoint ((struct tracepoint_hit_ctx *) &ctx, - stop_pc, tpoint); + tpoint); if (stopping_tracepoint || trace_buffer_is_full @@ -4271,7 +4271,7 @@ static void collect_ust_data_at_tracepoint (struct tracepoint_hit_ctx *ctx, given thread. */ static void -collect_data_at_tracepoint (struct tracepoint_hit_ctx *ctx, CORE_ADDR stop_pc, +collect_data_at_tracepoint (struct tracepoint_hit_ctx *ctx, struct tracepoint *tpoint) { struct traceframe *tframe; @@ -4305,7 +4305,7 @@ collect_data_at_tracepoint (struct tracepoint_hit_ctx *ctx, CORE_ADDR stop_pc, tpoint->actions_str[acti]); #endif - do_action_at_tracepoint (ctx, stop_pc, tpoint, tframe, + do_action_at_tracepoint (ctx, tpoint, tframe, tpoint->actions[acti]); } @@ -4320,7 +4320,6 @@ collect_data_at_tracepoint (struct tracepoint_hit_ctx *ctx, CORE_ADDR stop_pc, static void collect_data_at_step (struct tracepoint_hit_ctx *ctx, - CORE_ADDR stop_pc, struct tracepoint *tpoint, int current_step) { struct traceframe *tframe; @@ -4342,7 +4341,7 @@ collect_data_at_step (struct tracepoint_hit_ctx *ctx, tpoint->number, paddress (tpoint->address), tpoint->step_actions_str[acti]); - do_action_at_tracepoint (ctx, stop_pc, tpoint, tframe, + do_action_at_tracepoint (ctx, tpoint, tframe, tpoint->step_actions[acti]); } @@ -4409,7 +4408,6 @@ get_context_regcache (struct tracepoint_hit_ctx *ctx) static void do_action_at_tracepoint (struct tracepoint_hit_ctx *ctx, - CORE_ADDR stop_pc, struct tracepoint *tpoint, struct traceframe *tframe, struct tracepoint_action *taction) @@ -4473,11 +4471,11 @@ do_action_at_tracepoint (struct tracepoint_hit_ctx *ctx, preemptively), since the PC had already been adjusted to contain the tracepoint's address by the jump pad. */ trace_debug ("Storing stop pc (0x%s) in regblock", - paddress (stop_pc)); + paddress (ctx->stop_pc)); /* This changes the regblock, not the thread's regcache. */ - regcache_write_pc (&tregcache, stop_pc); + regcache_write_pc (&tregcache, ctx->stop_pc); #endif } break; @@ -5411,6 +5409,7 @@ gdb_collect (struct tracepoint *tpoint, unsigned char *regs) return; ctx.base.type = fast_tracepoint; + ctx.base.stop_pc = tpoint->address; ctx.regs = regs; ctx.regcache_initted = 0; /* Wrap the regblock in a register cache (in the stack, we don't @@ -5440,7 +5439,7 @@ gdb_collect (struct tracepoint *tpoint, unsigned char *regs) ctx.tpoint)) { collect_data_at_tracepoint ((struct tracepoint_hit_ctx *) &ctx, - ctx.tpoint->address, ctx.tpoint); + ctx.tpoint); /* Note that this will cause original insns to be written back to where we jumped from, but that's OK because we're jumping @@ -6280,6 +6279,8 @@ gdb_probe (const struct marker *mdata, void *probe_private, } tpoint = ust_marker_to_static_tracepoint (mdata); + ctx.base.stop_pc = tpoint->address; + if (tpoint == NULL) { trace_debug ("gdb_probe: marker not known: " @@ -6308,7 +6309,7 @@ gdb_probe (const struct marker *mdata, void *probe_private, tpoint)) { collect_data_at_tracepoint ((struct tracepoint_hit_ctx *) &ctx, - tpoint->address, tpoint); + tpoint); if (stopping_tracepoint || trace_buffer_is_full -- 1.7.0.4