From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11417 invoked by alias); 20 Jun 2008 13:55:06 -0000 Received: (qmail 11387 invoked by uid 9697); 20 Jun 2008 13:55:06 -0000 Date: Fri, 20 Jun 2008 13:55:00 -0000 Message-ID: <20080620135506.11372.qmail@sourceware.org> From: pmachata@sourceware.org To: frysk-cvs@sourceware.org Subject: [SCM] master: Fix chained tracing X-Git-Refname: refs/heads/master X-Git-Reftype: branch X-Git-Oldrev: 0f35edb5f6c7423f39c875d47182ff3708419e7d X-Git-Newrev: c69c6ceede39e0ffa06f94321447a25e0d0e2b4d Mailing-List: contact frysk-cvs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: frysk-cvs-owner@sourceware.org Reply-To: frysk@sourceware.org X-SW-Source: 2008-q2/txt/msg00389.txt.bz2 The branch, master has been updated via c69c6ceede39e0ffa06f94321447a25e0d0e2b4d (commit) from 0f35edb5f6c7423f39c875d47182ff3708419e7d (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email. - Log ----------------------------------------------------------------- commit c69c6ceede39e0ffa06f94321447a25e0d0e2b4d Author: Petr Machata Date: Fri Jun 20 15:54:16 2008 +0200 Fix chained tracing * i.e. the case when regular entry is hit right after PLT entry for the same symbol is hit. In such a case these two entry points share the same return breakpoint, and the situation has to be handled specially. This used to be implemented, but got lost during the migration to Frysk breakpoint structures. ----------------------------------------------------------------------- Summary of changes: frysk-core/frysk/ftrace/ChangeLog | 10 +++++++++- frysk-core/frysk/ftrace/Ftrace.java | 22 +++++++--------------- frysk-core/frysk/ftrace/TaskTracer.java | 18 +++++++++++++++++- 3 files changed, 33 insertions(+), 17 deletions(-) First 500 lines of diff: diff --git a/frysk-core/frysk/ftrace/ChangeLog b/frysk-core/frysk/ftrace/ChangeLog index 3fe6e9b..e2943d3 100644 --- a/frysk-core/frysk/ftrace/ChangeLog +++ b/frysk-core/frysk/ftrace/ChangeLog @@ -1,6 +1,14 @@ 2008-06-20 Petr Machata - * Ftrace.java: Keep a list of event entry tokens, and align + * Ftrace.java (getDriversForTask): Drop. + (driversForTask): Actually use it as a map(task->driver), instead + of map(task->map(mapping_path->driver)). + * TaskTracer.java (FunctionReturnObserver.add): Compare symbol + names via .equals, instead of comparing symbol pointers. + +2008-06-20 Petr Machata + + * Reporter.java: Keep a list of event entry tokens, and align eventLeave with matching eventEntry. 2008-06-10 Andrew Cagney diff --git a/frysk-core/frysk/ftrace/Ftrace.java b/frysk-core/frysk/ftrace/Ftrace.java index 17d81ba..b19c39e 100644 --- a/frysk-core/frysk/ftrace/Ftrace.java +++ b/frysk-core/frysk/ftrace/Ftrace.java @@ -654,15 +654,6 @@ public class Ftrace { return ObjectFile.buildFromFile(mapping.path); } - private Map getDriversForTask(Task task) { - Map drivers = (Map)driversForTask.get(task); - if (drivers == null) { - drivers = new HashMap(); - driversForTask.put(task, drivers); - } - return drivers; - } - public Action updateMappedFile(Task task, MemoryMapping mapping) { if (traceMmapUnmap) @@ -677,10 +668,12 @@ public class Ftrace { DwflModule module = getModuleForFile(task, mapping.path); - Map drivers = getDriversForTask(task); - Driver driver = new TaskTracer(Ftrace.this, task); - drivers.put(mapping.path, driver); - this.tracingController.fileMapped(task, objf, module, driver); + Driver driver = (Driver)driversForTask.get(task); + if (driver == null) { + driver = new TaskTracer(Ftrace.this, task); + driversForTask.put(task, driver); + } + tracingController.fileMapped(task, objf, module, driver); task.requestUnblock(this); return Action.BLOCK; @@ -700,8 +693,7 @@ public class Ftrace { DwflModule module = getModuleForFile(task, mapping.path); - Map drivers = getDriversForTask(task); - Driver driver = (Driver)drivers.get(mapping.path); + Driver driver = (Driver)driversForTask.get(task); if (driver == null) throw new AssertionError("There should be a driver for `" + mapping.path + "'."); diff --git a/frysk-core/frysk/ftrace/TaskTracer.java b/frysk-core/frysk/ftrace/TaskTracer.java index 0ae6b0f..1aff7b6 100644 --- a/frysk-core/frysk/ftrace/TaskTracer.java +++ b/frysk-core/frysk/ftrace/TaskTracer.java @@ -81,6 +81,7 @@ class TaskTracer private final Ftrace ftrace; public TaskTracer(Ftrace ftrace, Task task) { + fine.log("New TaskTracer for", task); this.arch = ArchFactory.instance.getArch(task); this.ftrace = ftrace; } @@ -89,7 +90,20 @@ class TaskTracer { private final DwflSymbol symbol; private final boolean isPlt; + + /** + * TracePoint is chained when it shares return breakpoint with + * other breakpoint. When such a breakpoint is hit, it is + * assumed that both tracepoints have "left". This is used + * when both PLT and regular entry point are traced for one + * symbol. If PLT entry point hits, and regular entry point + * for the same symbol hits immediately after that, the two + * are chained. + */ private boolean chained = false; + + // When the TracePoint is frozen, it can't be chained to + // another TracePoint anymore. private boolean frozen = false; public TracePoint(DwflSymbol symbol) { @@ -119,6 +133,7 @@ class TaskTracer } public void setChained() { + fine.log("chained tracePoint", this); this.chained = true; } @@ -169,7 +184,8 @@ class TaskTracer TracePoint previous = (TracePoint)symbolList.getLast(); if (!previous.isFrozen() && previous.isPlt() && !tracePoint.isPlt() - && previous.getSymbol() == tracePoint.getSymbol()) + && previous.getSymbol().getName().equals + (tracePoint.getSymbol().getName())) tracePoint.setChained(); previous.freeze(); hooks/post-receive -- frysk system monitor/debugger