public inbox for frysk-cvs@sourceware.org help / color / mirror / Atom feed
From: pmachata@sourceware.org To: frysk-cvs@sourceware.org Subject: [SCM] master: Get rid of FtraceLogger, define loggers per-class Date: Wed, 02 Apr 2008 06:32:00 -0000 [thread overview] Message-ID: <20080402063233.8063.qmail@sourceware.org> (raw) The branch, master has been updated via ff2a266581b1fe1c8120849b6bdb5f372151ad4d (commit) from 72dcfe41b8fc7c1fbc546d25cd5f8ae96353b042 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email. - Log ----------------------------------------------------------------- commit ff2a266581b1fe1c8120849b6bdb5f372151ad4d Author: Petr Machata <pmachata@redhat.com> Date: Wed Apr 2 06:54:15 2008 +0200 Get rid of FtraceLogger, define loggers per-class ----------------------------------------------------------------------- Summary of changes: frysk-core/frysk/ftrace/ChangeLog | 9 ++- frysk-core/frysk/ftrace/Ftrace.java | 31 ++++--- frysk-core/frysk/ftrace/FtraceController.java | 28 ++++--- frysk-core/frysk/ftrace/FtraceLogger.java | 50 ----------- frysk-core/frysk/ftrace/ObjectFile.java | 112 ++++++++++++------------- 5 files changed, 96 insertions(+), 134 deletions(-) delete mode 100644 frysk-core/frysk/ftrace/FtraceLogger.java First 500 lines of diff: diff --git a/frysk-core/frysk/ftrace/ChangeLog b/frysk-core/frysk/ftrace/ChangeLog index 7f86c59..27bc300 100644 --- a/frysk-core/frysk/ftrace/ChangeLog +++ b/frysk-core/frysk/ftrace/ChangeLog @@ -1,5 +1,12 @@ -2008-03-31 Andrew Cagney <cagney@redhat.com> +2008-04-02 Petr Machata <pmachata@redhat.com> + + * FtraceLogger.java: Deleted. + * Ftrace.java: Likewise. + * FtraceController.java: Introduce local loggers, use them. + * ObjectFile.java: Likewise. +2008-03-31 Andrew Cagney <cagney@redhat.com> + * Ftrace.java (trace(Proc)): Replace trace(String[]). 2008-03-28 Petr Machata <pmachata@redhat.com> diff --git a/frysk-core/frysk/ftrace/Ftrace.java b/frysk-core/frysk/ftrace/Ftrace.java index 87776b0..80073b5 100644 --- a/frysk-core/frysk/ftrace/Ftrace.java +++ b/frysk-core/frysk/ftrace/Ftrace.java @@ -56,8 +56,13 @@ import java.util.Set; import java.util.Iterator; import frysk.proc.TaskAttachedObserverXXX; import frysk.debuginfo.PrintStackOptions; +import frysk.rsl.Log; +import frysk.rsl.LogFactory; public class Ftrace { + private static final Log finest = LogFactory.finest(FtraceController.class); + private static final Log fine = LogFactory.fine(FtraceController.class); + private final PrintStackOptions stackPrintOptions; public Ftrace(PrintStackOptions stackPrintOptions) { @@ -146,13 +151,13 @@ public class Ftrace { public void setTraceSyscalls (TracedSyscallProvider tracedSyscallProvider) { - FtraceLogger.finest.log("syscall tracing requested"); + fine.log("syscall tracing requested"); this.tracedSyscallProvider = tracedSyscallProvider; } public void setTraceSignals (TracedSignalProvider tracedSignalProvider) { - FtraceLogger.finest.log("signal tracing requested"); + fine.log("signal tracing requested"); this.tracedSignalProvider = tracedSignalProvider; } @@ -229,7 +234,7 @@ public class Ftrace { Proc proc = task.getProc(); if (tracedSyscallProvider != null) { - FtraceLogger.finest.log("requesting syscall observer"); + finest.log("requesting syscall observer"); task.requestAddSyscallsObserver(new MySyscallObserver(reporter)); observationRequested(task); Map workingSet @@ -238,7 +243,7 @@ public class Ftrace { } if (tracedSignalProvider != null) { - FtraceLogger.finest.log("requesting signal observer"); + finest.log("requesting signal observer"); task.requestAddSignaledObserver(new MySignaledObserver()); observationRequested(task); Map workingSet @@ -294,7 +299,6 @@ public class Ftrace { public void tracePoint(Task task, TracePoint tp) { - FtraceLogger.info.log("Request for tracing `" + tp.symbol.name + "'"); tracePoints.add(tp); } @@ -305,7 +309,7 @@ public class Ftrace { TracePoint tp = (TracePoint)it.next(); if (tp.offset >= part.offset && tp.offset < part.offset + part.addressHigh - part.addressLow) { - FtraceLogger.finest.log( + finest.log( "Will trace `" + tp.symbol.name + "', " + "address=0x" + Long.toHexString(tp.address) + "; " + "offset=0x" + Long.toHexString(tp.offset) + "; " @@ -315,7 +319,7 @@ public class Ftrace { long actualAddress = tp.offset - part.offset + part.addressLow; TracePoint.Instance tpi = new TracePoint.Instance(tp, actualAddress); - FtraceLogger.info.log( + fine.log( "Will trace `" + tpi.tracePoint.symbol.name + "' at 0x" + Long.toHexString(tpi.address)); @@ -336,7 +340,7 @@ public class Ftrace { long actualAddress = tp.offset - part.offset + part.addressLow; TracePoint.Instance tpi = new TracePoint.Instance(tp, actualAddress); - FtraceLogger.info.log( + fine.log( "Stopping tracing of `" + tpi.tracePoint.symbol.name + "' at 0x" + Long.toHexString(tpi.address)); @@ -476,7 +480,7 @@ public class Ftrace { public void addedTo (Object observable) { - FtraceLogger.finest.log("syscall observer realized"); + finest.log("syscall observer realized"); Task task = (Task) observable; observationRealized(task); } @@ -572,7 +576,7 @@ public class Ftrace { class MySignaledObserver implements TaskObserver.Signaled { public Action updateSignaled(Task task, Signal signal) { - FtraceLogger.finest.log("signal hit " + signal); + finest.log("signal hit " + signal); String name = signal.getName(); Map signalWorkingSet = (Map)signalSetForTask.get(task); Boolean stackTrace = (Boolean)signalWorkingSet.get(signal); @@ -588,16 +592,15 @@ public class Ftrace { } public void addedTo (Object observable) { - FtraceLogger.finest.log("signal observer realized for " + observable); + finest.log("signal observer realized for " + observable); Task task = (Task) observable; observationRealized(task); } public void deletedFrom (Object observable) { - FtraceLogger.finest.log("signal observer deleted from " + observable); + finest.log("signal observer deleted from " + observable); } public void addFailed (Object observable, Throwable w) { - FtraceLogger.finest.log("signal observer failure for " - + observable + " with " + w); + finest.log("signal observer failure for", observable, "with", w); } } diff --git a/frysk-core/frysk/ftrace/FtraceController.java b/frysk-core/frysk/ftrace/FtraceController.java index dc8048c..e2e41a5 100644 --- a/frysk-core/frysk/ftrace/FtraceController.java +++ b/frysk-core/frysk/ftrace/FtraceController.java @@ -46,6 +46,9 @@ import java.util.Iterator; import java.util.List; import java.util.Map; import java.util.Set; + +import frysk.rsl.Log; +import frysk.rsl.LogFactory; import frysk.isa.signals.SignalTable; import frysk.isa.syscalls.SyscallTable; import frysk.proc.Task; @@ -56,6 +59,9 @@ public class FtraceController Ftrace.TracedSyscallProvider, Ftrace.TracedSignalProvider { + private static final Log warning = LogFactory.warning(FtraceController.class); + private static final Log fine = LogFactory.fine(FtraceController.class); + // ArrayList<SymbolRule> private final List pltRules = new ArrayList(); private final List dynRules = new ArrayList(); @@ -79,27 +85,27 @@ public class FtraceController public FtraceController() { } public void gotPltRules(List rules) { - FtraceLogger.fine.log("Got " + rules.size() + " PLT rules."); + fine.log("Got " + rules.size() + " PLT rules."); this.pltRules.addAll(rules); } public void gotDynRules(List rules) { - FtraceLogger.fine.log("Got " + rules.size() + " DYNAMIC rules."); + fine.log("Got " + rules.size() + " DYNAMIC rules."); this.dynRules.addAll(rules); } public void gotSymRules(List rules) { - FtraceLogger.fine.log("Got " + rules.size() + " SYMTAB rules."); + fine.log("Got " + rules.size() + " SYMTAB rules."); this.symRules.addAll(rules); } public void gotSysRules(List rules) { - FtraceLogger.fine.log("Got " + rules.size() + " syscall rules."); + fine.log("Got " + rules.size() + " syscall rules."); this.sysRules.addAll(rules); } public void gotSigRules(List rules) { - FtraceLogger.fine.log("Got " + rules.size() + " signal rules."); + fine.log("Got " + rules.size() + " signal rules."); this.sigRules.addAll(rules); } @@ -111,9 +117,9 @@ public class FtraceController for (Iterator it = rules.iterator(); it.hasNext(); ) { final Rule rule = (Rule)it.next(); - FtraceLogger.fine.log("Considering " + what + " rule `" + rule + "'."); + fine.log("Considering " + what + " rule `" + rule + "'."); if (!rule.apply(candidates, workingSet, stackTraceSet)) - FtraceLogger.warning.log("Rule `" + rule + "' didn't match any " + what + "."); + warning.log("Rule `" + rule + "' didn't match any " + what + "."); } // Apply the two sets. @@ -164,7 +170,7 @@ public class FtraceController final List rules, final TracePointOrigin origin) throws lib.dwfl.ElfException { - FtraceLogger.fine.log("Building working set for origin " + origin + "."); + fine.log("Building working set for origin " + origin + "."); // Skip the set if it's empty... if (rules.isEmpty()) @@ -186,7 +192,7 @@ public class FtraceController // lazily inside the loop. for (Iterator it = rules.iterator(); it.hasNext(); ) { final SymbolRule rule = (SymbolRule)it.next(); - FtraceLogger.fine.log("Considering symbol rule " + rule + "."); + fine.log("Considering symbol rule " + rule + "."); // MAIN is meta-soname meaning "main executable". if ((rule.sonamePattern.pattern().equals("MAIN") @@ -200,7 +206,7 @@ public class FtraceController objf.eachTracePoint(new ObjectFile.TracePointIterator() { public void tracePoint(TracePoint tp) { if (candidates.add(tp)) - FtraceLogger.fine.log("candidate `" + tp.symbol.name + "'."); + fine.log("candidate `" + tp.symbol.name + "'."); } }, origin); } @@ -210,7 +216,7 @@ public class FtraceController } // Finally, apply constructed working set. - FtraceLogger.fine.log("Applying working set for origin " + origin + "."); + fine.log("Applying working set for origin " + origin + "."); for (Iterator it = workingSet.iterator(); it.hasNext(); ) driver.tracePoint(task, (TracePoint)it.next()); diff --git a/frysk-core/frysk/ftrace/FtraceLogger.java b/frysk-core/frysk/ftrace/FtraceLogger.java deleted file mode 100644 index 693ed54..0000000 --- a/frysk-core/frysk/ftrace/FtraceLogger.java +++ /dev/null @@ -1,50 +0,0 @@ -// This file is part of the program FRYSK. -// -// Copyright 2007, Red Hat Inc. -// -// FRYSK is free software; you can redistribute it and/or modify it -// under the terms of the GNU General Public License as published by -// the Free Software Foundation; version 2 of the License. -// -// FRYSK is distributed in the hope that it will be useful, but -// WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with FRYSK; if not, write to the Free Software Foundation, -// Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. -// -// In addition, as a special exception, Red Hat, Inc. gives You the -// additional right to link the code of FRYSK with code not covered -// under the GNU General Public License ("Non-GPL Code") and to -// distribute linked combinations including the two, subject to the -// limitations in this paragraph. Non-GPL Code permitted under this -// exception must only link to the code of FRYSK through those well -// defined interfaces identified in the file named EXCEPTION found in -// the source code files (the "Approved Interfaces"). The files of -// Non-GPL Code may instantiate templates or use macros or inline -// functions from the Approved Interfaces without causing the -// resulting work to be covered by the GNU General Public -// License. Only Red Hat, Inc. may make changes or additions to the -// list of Approved Interfaces. You must obey the GNU General Public -// License in all respects for all of the FRYSK code and other code -// used in conjunction with FRYSK except the Non-GPL Code covered by -// this exception. If you modify this file, you may extend this -// exception to your version of the file, but you are not obligated to -// do so. If you do not wish to provide this exception without -// modification, you must delete this exception statement from your -// version and license this file solely under the GPL without -// exception. - -package frysk.ftrace; -import frysk.rsl.Log; -import frysk.rsl.LogFactory; - -class FtraceLogger -{ - static final Log warning = LogFactory.warning(Ftrace.class); - static final Log info = LogFactory.info(Ftrace.class); - static final Log fine = LogFactory.fine(Ftrace.class); - static final Log finest = LogFactory.finest(Ftrace.class); -} diff --git a/frysk-core/frysk/ftrace/ObjectFile.java b/frysk-core/frysk/ftrace/ObjectFile.java index 2860589..9c08f7e 100644 --- a/frysk-core/frysk/ftrace/ObjectFile.java +++ b/frysk-core/frysk/ftrace/ObjectFile.java @@ -46,11 +46,15 @@ import java.util.Iterator; import java.util.List; import java.util.Map; +import frysk.rsl.Log; +import frysk.rsl.LogFactory; import lib.dwfl.Elf; import lib.dwfl.ElfCommand; import lib.dwfl.ElfData; import lib.dwfl.ElfDynamic; import lib.dwfl.ElfEHeader; +import lib.dwfl.ElfException; +import lib.dwfl.ElfFileException; import lib.dwfl.ElfPHeader; import lib.dwfl.ElfRel; import lib.dwfl.ElfSection; @@ -59,8 +63,6 @@ import lib.dwfl.ElfSymbol; import lib.dwfl.ElfSymbolBinding; import lib.dwfl.ElfSymbolType; import lib.dwfl.ElfSymbolVisibility; -import lib.dwfl.ElfFileException; -import lib.dwfl.ElfException; import lib.stdcpp.Demangler; /** @@ -69,6 +71,10 @@ import lib.stdcpp.Demangler; */ public class ObjectFile { + private static final Log warning = LogFactory.warning(ObjectFile.class); + private static final Log fine = LogFactory.fine(ObjectFile.class); + private static final Log finest = LogFactory.finest(ObjectFile.class); + private File filename; private String soname = null; private String interp = null; @@ -158,7 +164,7 @@ public class ObjectFile /// indicate we want a mapping of (name x verdefs) -> symbol. String dName = Demangler.demangle(name); - FtraceLogger.finest.log("Got new symbol `" + dName + "' with origin " + this.origin + "."); + finest.log("Got new symbol `" + dName + "' with origin " + this.origin + "."); Long valueL = null; Symbol sym = null; @@ -169,7 +175,7 @@ public class ObjectFile } if (sym != null) { - FtraceLogger.finest.log("... aliasing `" + sym.name + "'."); + finest.log("... aliasing `" + sym.name + "'."); sym.addAlias(dName); recordDynamicSymbol(index, sym); } @@ -200,7 +206,7 @@ public class ObjectFile public void addNewTracepoint(long address, long offset, Symbol symbol) { - FtraceLogger.fine.log( + fine.log( "New tracepoint for `" + symbol + "', origin " + this.origin + ", address=0x" + Long.toHexString(address) + ", offset=0x" + Long.toHexString(offset) + "."); @@ -211,13 +217,13 @@ public class ObjectFile public synchronized ArrayList getTracePoints(TracePointOrigin origin) { ArrayList tracePoints = (ArrayList)this.tracePointMap.get(origin); if (tracePoints != null) { - FtraceLogger.fine.log( + fine.log( "" + tracePoints.size() + " tracepoints for origin " + origin + " retrieved from cache."); return tracePoints; } - FtraceLogger.fine.log("Loading tracepoints for origin " + origin + "."); + fine.log("Loading tracepoints for origin " + origin + "."); if ((origin == TracePointOrigin.PLT || origin == TracePointOrigin.DYNAMIC) && this.haveDynamic) { @@ -234,7 +240,7 @@ public class ObjectFile if (origin == TracePointOrigin.DYNAMIC) { // Load dynamic symtab and PLT entries. - FtraceLogger.finest.log("Loading dynamic symtab."); + finest.log("Loading dynamic symtab."); this.origin = TracePointOrigin.DYNAMIC; this.tracePoints = new ArrayList(); this.tracePointMap.put(this.origin, this.tracePoints); @@ -244,7 +250,7 @@ public class ObjectFile if (origin == TracePointOrigin.PLT) { int pltCount = ObjectFile.this.pltRelocs.length; - FtraceLogger.finest.log("Loading " + pltCount + " PLT entries."); + finest.log("Loading " + pltCount + " PLT entries."); ArrayList tracePointsPlt = new ArrayList(); this.tracePointMap.put(TracePointOrigin.PLT, tracePointsPlt); @@ -267,7 +273,7 @@ public class ObjectFile assertFitsToInt(symbolIndex, "Symbol associated with PLT entry"); Symbol symbol = this.dynamicSymbolList[(int)symbolIndex]; if (symbol == null) { - FtraceLogger.finest.log("Lazy loading symbol #" + symbolIndex); + finest.log("Lazy loading symbol #" + symbolIndex); this.origin = TracePointOrigin.DYNAMIC; this.tracePoints = tracePointsDynamic; this.dynamicLoader.load(symbolIndex, this); @@ -276,7 +282,7 @@ public class ObjectFile if (symbol == null) throw new AssertionError("Dynamic symbol still not initialized."); - FtraceLogger.finest.log( + finest.log( "Got plt entry for `" + symbol.name + "' at 0x" + Long.toHexString(pltEntryAddr) + "."); this.origin = TracePointOrigin.PLT; @@ -289,7 +295,7 @@ public class ObjectFile else if (origin == TracePointOrigin.SYMTAB && ObjectFile.this.staticSymtab != null) { // Load static symtab. - FtraceLogger.finest.log("Loading static symtab."); + finest.log("Loading static symtab."); this.origin = TracePointOrigin.SYMTAB; this.tracePoints = new ArrayList(); this.tracePointMap.put(this.origin, this.tracePoints); @@ -320,13 +326,13 @@ public class ObjectFile if (ph.type == ElfPHeader.PTYPE_DYNAMIC) { builder.haveDynamic = true; offDynamic = ph.offset; - FtraceLogger.finest.log("Found DYNAMIC segment."); + finest.log("Found DYNAMIC segment."); } else if (ph.type == ElfPHeader.PTYPE_LOAD && ph.offset == 0) { haveLoadable = true; this.baseAddress = ph.vaddr; - FtraceLogger.finest.log( + finest.log( "Found LOADABLE segment, base address = 0x" + Long.toHexString(this.baseAddress)); } @@ -334,21 +340,21 @@ public class ObjectFile ElfData interpData = elfFile.getRawData(ph.offset, ph.filesz - 1); // -1 for trailing zero String interp = new String(interpData.getBytes()); this.setInterp(interp); - FtraceLogger.finest.log("Found INTERP `" + interp + "'."); + finest.log("Found INTERP `" + interp + "'."); } } if (!haveLoadable) { - FtraceLogger.fine.log("Failed, didn't find any loadable segments."); + fine.log("Failed, didn't find any loadable segments."); throw new ElfFileException(file, "Failed, didn't find any loadable segments."); } if (eh.type == ElfEHeader.PHEADER_ET_EXEC) - FtraceLogger.finest.log("This file is EXECUTABLE."); + finest.log("This file is EXECUTABLE."); else if (eh.type == ElfEHeader.PHEADER_ET_DYN) - FtraceLogger.finest.log("This file is DSO or PIE EXECUTABLE."); + finest.log("This file is DSO or PIE EXECUTABLE."); else { - FtraceLogger.fine.log("Failed, unsupported ELF file type."); + fine.log("Failed, unsupported ELF file type."); throw new ElfFileException(file, "Failed, unsupported ELF file type."); } @@ -365,43 +371,43 @@ public class ObjectFile section = elfFile.getNextSection(section)) { ElfSectionHeader sheader = section.getSectionHeader(); if (builder.haveDynamic && sheader.offset == offDynamic) { - FtraceLogger.finest.log("Processing DYNAMIC section."); + finest.log("Processing DYNAMIC section."); foundDynamic = true; ElfDynamic.loadFrom(section, new ElfDynamic.Builder() { public void entry (int tag, long value) { if (tag == ElfDynamic.ELF_DT_STRTAB) { - FtraceLogger.finest.log(" * dynamic strtab at 0x" + Long.toHexString(value)); + finest.log(" * dynamic strtab at 0x" + Long.toHexString(value)); ObjectFile.this.dynamicStrtab = getElfSectionWithAddr(elfFile, value); } else if (tag == ElfDynamic.ELF_DT_SONAME) { - FtraceLogger.finest.log(" * soname index = 0x" + Long.toHexString(value)); + finest.log(" * soname index = 0x" + Long.toHexString(value)); assertFitsToInt(value, "SONAME index"); locals.dynamicSonameIdx = (int)value; } else if (tag == ElfDynamic.ELF_DT_SYMTAB) { - FtraceLogger.finest.log(" * dynamic symtab = 0x" + Long.toHexString(value)); + finest.log(" * dynamic symtab = 0x" + Long.toHexString(value)); ObjectFile.this.dynamicSymtab = getElfSectionWithAddr(elfFile, value); hooks/post-receive -- frysk system monitor/debugger
reply other threads:[~2008-04-02 6:32 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20080402063233.8063.qmail@sourceware.org \ --to=pmachata@sourceware.org \ --cc=frysk-cvs@sourceware.org \ --cc=frysk@sourceware.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).