This is the mail archive of the frysk-cvs@sources.redhat.com mailing list for the frysk project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[SCM] master: Pass symbol in DwflModule::getSymbol*


The branch, master has been updated
       via  ea8c6c869e6a411e1c7c056e37cbdc9841b85e71 (commit)
       via  ef94730feb3793946147117c5a63578447337ba2 (commit)
      from  5905c69d5cb178a73eb2d130c448eb0c2b91fba4 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email.

- Log -----------------------------------------------------------------
commit ea8c6c869e6a411e1c7c056e37cbdc9841b85e71
Author: Petr Machata <pmachata@redhat.com>
Date:   Fri Mar 21 17:11:33 2008 +0100

    Pass symbol in DwflModule::getSymbol*

commit ef94730feb3793946147117c5a63578447337ba2
Author: Petr Machata <pmachata@redhat.com>
Date:   Fri Mar 21 16:25:36 2008 +0100

    Merge frysk.symtab.Symbol with lib.dwfl.ElfSymbol
    
    * ... and replace Symbol uses across the code.

-----------------------------------------------------------------------

Summary of changes:
 frysk-core/frysk/debuginfo/ChangeLog               |    5 +
 .../frysk/debuginfo/TestDebugInfoStackTrace.java   |    5 +-
 frysk-core/frysk/hpd/ChangeLog                     |    5 +
 frysk-core/frysk/hpd/DisassembleCommand.java       |    6 +-
 frysk-core/frysk/stack/ChangeLog                   |    9 ++
 frysk-core/frysk/stack/Frame.java                  |    6 +-
 frysk-core/frysk/stack/FrameDecorator.java         |    4 +-
 frysk-core/frysk/stack/LibunwindFrame.java         |    6 +-
 frysk-core/frysk/stack/TestFrameSymbol.java        |    4 +-
 .../frysk/stack/TestLibFunctionStepFrame.java      |    4 +-
 frysk-core/frysk/symtab/ChangeLog                  |    9 ++
 frysk-core/frysk/symtab/DwflSymbol.java            |    4 +-
 frysk-core/frysk/symtab/Symbol.java                |  112 --------------------
 frysk-core/frysk/symtab/SymbolFactory.java         |    5 +-
 frysk-core/frysk/symtab/TestSymbol.java            |    3 +-
 frysk-core/frysk/symtab/UnknownSymbol.java         |    8 +-
 frysk-core/frysk/testbed/ChangeLog                 |    5 +
 frysk-core/frysk/testbed/RegsCase.java             |    6 +-
 frysk-core/frysk/util/AuxvStringBuilder.java       |    6 +-
 frysk-core/frysk/util/ChangeLog                    |    5 +
 frysk-gui/frysk/gui/ChangeLog                      |    5 +
 .../frysk/gui/disassembler/DisassemblyWindow.java  |    4 +-
 frysk-sys/lib/dwfl/ChangeLog                       |   10 ++
 frysk-sys/lib/dwfl/ElfSymbol.java                  |   69 ++++++++++++-
 frysk-sys/lib/dwfl/cni/DwflModule.cxx              |   16 ++--
 25 files changed, 166 insertions(+), 155 deletions(-)
 delete mode 100644 frysk-core/frysk/symtab/Symbol.java

First 500 lines of diff:
diff --git a/frysk-core/frysk/debuginfo/ChangeLog b/frysk-core/frysk/debuginfo/ChangeLog
index 4c1bf54..65a7859 100644
--- a/frysk-core/frysk/debuginfo/ChangeLog
+++ b/frysk-core/frysk/debuginfo/ChangeLog
@@ -1,3 +1,8 @@
+2008-03-21  Petr Machata  <pmachata@redhat.com>
+
+	* TestDebugInfoStackTrace: Use lib.dwfl.ElfSymbol instead of
+	frysk.symtab.Symbol.
+
 2008-03-19  Mark Wielaard  <mwielaard@redhat.com>
 
 	* TestDebugInfoStackTrace (frameAssertions): Also check for function
diff --git a/frysk-core/frysk/debuginfo/TestDebugInfoStackTrace.java b/frysk-core/frysk/debuginfo/TestDebugInfoStackTrace.java
index e932858..31e3a6c 100644
--- a/frysk-core/frysk/debuginfo/TestDebugInfoStackTrace.java
+++ b/frysk-core/frysk/debuginfo/TestDebugInfoStackTrace.java
@@ -54,12 +54,13 @@ import frysk.stack.Frame;
 import frysk.stack.StackFactory;
 import frysk.stepping.SteppingEngine;
 import frysk.stepping.TaskStepEngine;
-import frysk.symtab.Symbol;
 import frysk.sys.Pid;
 import frysk.sys.Signal;
 import frysk.testbed.SynchronizedOffspring;
 import frysk.testbed.TestLib;
 
+import lib.dwfl.ElfSymbol;
+
 public class TestDebugInfoStackTrace
     extends TestLib
 {
@@ -147,7 +148,7 @@ public class TestDebugInfoStackTrace
   {
     DebugInfoFrame frame = DebugInfoStackFactory.createDebugInfoStackTrace(myTask);
     SourceLocation line;
-    Symbol symbol;
+    ElfSymbol symbol;
 
     assertNotNull(frame);
     assertNull(frame.getInner());
diff --git a/frysk-core/frysk/hpd/ChangeLog b/frysk-core/frysk/hpd/ChangeLog
index 60da6c0..e431b70 100644
--- a/frysk-core/frysk/hpd/ChangeLog
+++ b/frysk-core/frysk/hpd/ChangeLog
@@ -22,6 +22,11 @@
 	* TestListCommand.java (testListReverse): Test 'list -length' around PC.
 	* TestSysRoot.java (testHaveSysRoot()): Reactivate.
 
+2008-03-21  Petr Machata  <pmachata@redhat.com>
+
+	* DisassembleCommand.java: Use lib.dwfl.ElfSymbol instead of
+	frysk.symtab.Symbol.
+
 2008-03-20  Andrew Cagney  <cagney@redhat.com>
 
 	* StartRun.java: Use ProcTasksAction and ProcTasksObserver.
diff --git a/frysk-core/frysk/hpd/DisassembleCommand.java b/frysk-core/frysk/hpd/DisassembleCommand.java
index 19f19e0..bab2cad 100644
--- a/frysk-core/frysk/hpd/DisassembleCommand.java
+++ b/frysk-core/frysk/hpd/DisassembleCommand.java
@@ -43,10 +43,10 @@ import java.util.Iterator;
 import java.util.List;
 import frysk.debuginfo.DebugInfoFrame;
 import frysk.proc.Task;
-import frysk.symtab.Symbol;
 import frysk.symtab.SymbolFactory;
 import lib.opcodes.Disassembler;
 import lib.opcodes.Instruction;
+import lib.dwfl.ElfSymbol;
 
 public class DisassembleCommand extends ParameterizedCommand {
 
@@ -108,7 +108,7 @@ public class DisassembleCommand extends ParameterizedCommand {
 		continue;
 	    DebugInfoFrame frame = cli.getTaskFrame(task);
 	    long currentInstruction = frame.getAddress();
-	    Symbol symbol = frame.getSymbol();
+	    ElfSymbol symbol = frame.getSymbol();
 
 	    Disassembler disassembler = new Disassembler(task.getMemory());
 	    cli.outWriter.println("[" + data.getParentID() + "." + data.getID()
@@ -257,7 +257,7 @@ public class DisassembleCommand extends ParameterizedCommand {
 	}
 
 	public String toPrint(Instruction instruction) {
-	    Symbol symbol = SymbolFactory.getSymbol(task, instruction.address);
+	    ElfSymbol symbol = SymbolFactory.getSymbol(task, instruction.address);
 	    return printer.toPrint(instruction)
 		    + "<"
 		    + symbol.getName()
diff --git a/frysk-core/frysk/stack/ChangeLog b/frysk-core/frysk/stack/ChangeLog
index 1f1a2a9..f429c93 100644
--- a/frysk-core/frysk/stack/ChangeLog
+++ b/frysk-core/frysk/stack/ChangeLog
@@ -1,3 +1,12 @@
+2008-03-21  Petr Machata  <pmachata@redhat.com>
+
+	* Frame.java: Use lib.dwfl.ElfSymbol instead of
+	frysk.symtab.Symbol.
+	* FrameDecorator.java: Likewise.
+	* LibunwindFrame.java: Likewise.
+	* TestFrameSymbol.java: Likewise.
+	* TestLibFunctionStepFrame.java: Likewise.
+
 2008-03-19  Mark Wielaard  <mwielaard@redhat.com>
 
 	* TestLibFunctionStepFrame.java: No longer unresolved on x86_64.
diff --git a/frysk-core/frysk/stack/Frame.java b/frysk-core/frysk/stack/Frame.java
index bee5511..9c16552 100644
--- a/frysk-core/frysk/stack/Frame.java
+++ b/frysk-core/frysk/stack/Frame.java
@@ -45,11 +45,11 @@ import java.io.StringWriter;
 
 import lib.dwfl.Dwfl;
 import lib.dwfl.DwflModule;
+import lib.dwfl.ElfSymbol;
 import frysk.dwfl.DwflCache;
 import frysk.isa.registers.Register;
 import frysk.proc.Task;
 import frysk.rsl.Log;
-import frysk.symtab.Symbol;
 import frysk.symtab.SymbolFactory;
 import frysk.value.ScratchLocation;
 import frysk.value.Value;
@@ -165,7 +165,7 @@ public abstract class Frame {
 	    writer.write('0');
 	writer.write(addr);
 	// the symbol, if known append (), ..
-	Symbol symbol = getSymbol();
+	ElfSymbol symbol = getSymbol();
 	writer.write(" in ");
 	writer.write(symbol.getDemangledName());
 	if (symbol != SymbolFactory.UNKNOWN)
@@ -245,6 +245,6 @@ public abstract class Frame {
     /**
      * Return this frame's symbol; UNKNOWN if there is no symbol.
      */
-    public abstract Symbol getSymbol ();
+    public abstract ElfSymbol getSymbol ();
   
 }
diff --git a/frysk-core/frysk/stack/FrameDecorator.java b/frysk-core/frysk/stack/FrameDecorator.java
index 38c6f09..7b35f49 100644
--- a/frysk-core/frysk/stack/FrameDecorator.java
+++ b/frysk-core/frysk/stack/FrameDecorator.java
@@ -39,7 +39,7 @@
 
 package frysk.stack;
 
-import frysk.symtab.Symbol;
+import lib.dwfl.ElfSymbol;
 import frysk.isa.registers.Register;
 
 /**
@@ -81,7 +81,7 @@ public abstract class FrameDecorator extends Frame {
 	return undecoratedFrame.getFrameIdentifier();
     }
 
-    public Symbol getSymbol() {
+    public ElfSymbol getSymbol() {
 	return undecoratedFrame.getSymbol();
     }
     
diff --git a/frysk-core/frysk/stack/LibunwindFrame.java b/frysk-core/frysk/stack/LibunwindFrame.java
index 08ee6d3..ae016ed 100644
--- a/frysk-core/frysk/stack/LibunwindFrame.java
+++ b/frysk-core/frysk/stack/LibunwindFrame.java
@@ -42,16 +42,16 @@ package frysk.stack;
 import frysk.rsl.Log;
 import frysk.isa.registers.Register;
 import lib.unwind.Cursor;
+import lib.dwfl.ElfSymbol;
 import frysk.isa.ISA;
 import frysk.proc.Task;
-import frysk.symtab.Symbol;
 import frysk.symtab.SymbolFactory;
 import frysk.isa.registers.RegisterMap;
 
 class LibunwindFrame extends Frame {  
     private static final Log fine = Log.fine(LibunwindFrame.class);
 
-    private Symbol symbol;
+    private ElfSymbol symbol;
   
     /* Identifies this frame by its CFA and frame start address */
     private FrameIdentifier frameIdentifier;
@@ -177,7 +177,7 @@ class LibunwindFrame extends Frame {
     /**
      * Return this frame's symbol; UNKNOWN if there is no symbol.
      */
-    public Symbol getSymbol() {
+    public ElfSymbol getSymbol() {
 	if (symbol == null) {
 	    symbol = SymbolFactory.getSymbol(getTask(), getAdjustedAddress());
 	}
diff --git a/frysk-core/frysk/stack/TestFrameSymbol.java b/frysk-core/frysk/stack/TestFrameSymbol.java
index c5a8bde..818d6ec 100644
--- a/frysk-core/frysk/stack/TestFrameSymbol.java
+++ b/frysk-core/frysk/stack/TestFrameSymbol.java
@@ -39,7 +39,7 @@
 
 package frysk.stack;
 
-import frysk.symtab.Symbol;
+import lib.dwfl.ElfSymbol;
 import frysk.proc.Task;
 import frysk.stack.Frame;
 import frysk.stack.StackFactory;
@@ -66,7 +66,7 @@ public class TestFrameSymbol
 	// the inner-most frame's symbol matches the expected.
 	Frame frame = StackFactory.createFrame(task);
 
-	Symbol symbol = frame.getSymbol ();
+	ElfSymbol symbol = frame.getSymbol ();
 	assertEquals ("symbol's demangled name", "global_st_size",
 		      symbol.getDemangledName ());
 	assertTrue ("symbol address valid", symbol.getAddress() != 0);
diff --git a/frysk-core/frysk/stack/TestLibFunctionStepFrame.java b/frysk-core/frysk/stack/TestLibFunctionStepFrame.java
index 2a746a0..f052830 100644
--- a/frysk-core/frysk/stack/TestLibFunctionStepFrame.java
+++ b/frysk-core/frysk/stack/TestLibFunctionStepFrame.java
@@ -47,8 +47,8 @@ import frysk.config.*;
 import frysk.testbed.*;
 
 import frysk.proc.*;
-import frysk.symtab.*;
 import frysk.rt.*;
+import lib.dwfl.ElfSymbol;
 
 /**
  * Test making sure all frames are available when stepping (twice)
@@ -166,7 +166,7 @@ public class TestLibFunctionStepFrame
   // frame.
   private void assertFooAndMainOuterFrames(String message, Frame frame)
   {
-    Symbol sym = frame.getSymbol();
+    ElfSymbol sym = frame.getSymbol();
     String name = sym.getName();
     boolean ok = name.indexOf("foo") == -1 && name.indexOf("main") == -1;
     if (! ok)
diff --git a/frysk-core/frysk/symtab/ChangeLog b/frysk-core/frysk/symtab/ChangeLog
index 1617f89..b79633d 100644
--- a/frysk-core/frysk/symtab/ChangeLog
+++ b/frysk-core/frysk/symtab/ChangeLog
@@ -1,5 +1,14 @@
 2008-03-21  Petr Machata  <pmachata@redhat.com>
 
+	* Symbol.java: Merged with lib.dwfl.ElfSymbol, dropped.
+	* SymbolFactory.java: Use lib.dwfl.ElfSymbol instead of
+	frysk.symtab.Symbol.
+	* TestSymbol.java: Likewise.
+	* UnknownSymbol.java: Likewise.
+	* DwflSymbol.java: Likewise.
+
+2008-03-21  Petr Machata  <pmachata@redhat.com>
+
 	* Symbol.java: Straighten dataflow here: internal data are set via
 	ctor and are final, instead of using "symbol" method for that.
 	(symbol): Two methods of that name erased.
diff --git a/frysk-core/frysk/symtab/DwflSymbol.java b/frysk-core/frysk/symtab/DwflSymbol.java
index eab98cf..1374bd3 100644
--- a/frysk-core/frysk/symtab/DwflSymbol.java
+++ b/frysk-core/frysk/symtab/DwflSymbol.java
@@ -46,8 +46,10 @@ package frysk.symtab;
  * function names, obtained from debug information such as DWARF.
  */
 
+import lib.dwfl.ElfSymbol;
+
 class DwflSymbol
-    extends Symbol
+    extends ElfSymbol
 {
     // package private constructor.
     DwflSymbol(long address, long size, String name) {
diff --git a/frysk-core/frysk/symtab/Symbol.java b/frysk-core/frysk/symtab/Symbol.java
deleted file mode 100644
index 767ac5e..0000000
--- a/frysk-core/frysk/symtab/Symbol.java
+++ /dev/null
@@ -1,112 +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.symtab;
-
-import lib.stdcpp.Demangler;
-
-/**
- * The object-file symbol.  Typically obtained by reading ELF
- * information.
- *
- * Do not confuse this with higher-level symbolic information, such as
- * function names, obtained from debug information such as DWARF.
- */
-
-public class Symbol
-{
-    // The symbol's fields.
-    private final long address;
-    private final long size;
-    private final String name;
-    private String demangledName;
-
-    // package private constructor.
-    Symbol(long address, long size, String name) {
-	this.address = address;
-	this.size = size;
-	this.name = name;
-    }
-
-    /**
-     * Return the address of the symbol.
-     */
-    public long getAddress ()
-    {
-	return address;
-    }
-    
-    /**
-     * Return the size of the symbol (possibly zero).
-     */
-    public long getSize ()
-    {
-	return size;
-    }
-
-    /**
-     * Return the mangled name (the raw string found in the symbol
-     * table).  Or NULL, of the name is unknown.
-     */
-    public String getName ()
-    {
-	return name;
-    }
-
-    /**
-     * Return the demangled name, or "" of the name isn't known.
-     *
-     * XXX: Is returning "" better than null?  Sounds like a cheat for
-     * code that should be conditional on the symbol being known.
-     */
-    public String getDemangledName ()
-    {
-	if (demangledName == null)
-	    demangledName = Demangler.demangle (name);
-	return demangledName;
-    }
-
-    /**
-     * Dump the symbol's contents.
-     */
-    public String toString ()
-    {
-	return name + "@" + Long.toHexString (address) + ":" + size;
-    }
-}
diff --git a/frysk-core/frysk/symtab/SymbolFactory.java b/frysk-core/frysk/symtab/SymbolFactory.java
index 81e4f9e..3cae10e 100644
--- a/frysk-core/frysk/symtab/SymbolFactory.java
+++ b/frysk-core/frysk/symtab/SymbolFactory.java
@@ -50,6 +50,7 @@ import frysk.rsl.LogFactory;
 import lib.dwfl.Dwfl;
 import lib.dwfl.DwflModule;
 import lib.dwfl.SymbolBuilder;
+import lib.dwfl.ElfSymbol;
 
 /**
  * The object-file symbol.  Typically obtained by reading ELF
@@ -66,12 +67,12 @@ public class SymbolFactory
     /**
      * A special unknown symbol.
      */
-    public static final Symbol UNKNOWN = new UnknownSymbol ();
+    public static final ElfSymbol UNKNOWN = new UnknownSymbol ();
 
    /**
     * Return the symbol at the specified address within task.
     */
-    public static Symbol getSymbol(Task task, long address) {
+    public static ElfSymbol getSymbol(Task task, long address) {
 	Dwfl dwfl = DwflCache.getDwfl(task);
 	if (dwfl == null)
 	    return UNKNOWN;
diff --git a/frysk-core/frysk/symtab/TestSymbol.java b/frysk-core/frysk/symtab/TestSymbol.java
index 79bf39a..8058b4d 100644
--- a/frysk-core/frysk/symtab/TestSymbol.java
+++ b/frysk-core/frysk/symtab/TestSymbol.java
@@ -42,6 +42,7 @@ package frysk.symtab;
 import frysk.proc.Task;
 import frysk.testbed.TestLib;
 import frysk.testbed.DaemonBlockedAtSignal;
+import lib.dwfl.ElfSymbol;
 
 public class TestSymbol
     extends TestLib
@@ -62,7 +63,7 @@ public class TestSymbol
     	Task task = daemon.getMainTask();
 
 	long pc = task.getPC();
-	Symbol symbol = SymbolFactory.getSymbol(task, pc);
+	ElfSymbol symbol = SymbolFactory.getSymbol(task, pc);
 	assertEquals ("symbol name", name, symbol.getDemangledName ());
 	assertEquals ("symbol address valid", addressValid,
 		      symbol.getAddress() != 0);
diff --git a/frysk-core/frysk/symtab/UnknownSymbol.java b/frysk-core/frysk/symtab/UnknownSymbol.java
index 314c437..ebdbf98 100644
--- a/frysk-core/frysk/symtab/UnknownSymbol.java
+++ b/frysk-core/frysk/symtab/UnknownSymbol.java
@@ -39,17 +39,17 @@
 
 package frysk.symtab;
 
+import lib.dwfl.ElfSymbol;
+
 /**
  * An unknown-symbol; a singleton.
  */
 
 class UnknownSymbol
-    extends Symbol
+    extends ElfSymbol
 {
     UnknownSymbol() {
 	super(0, -1, "[unknown]");
-    }
-    public String getDemangledName () {
-	return "[unknown]";
+	demangledName = getName();
     }
 }
diff --git a/frysk-core/frysk/testbed/ChangeLog b/frysk-core/frysk/testbed/ChangeLog
index 9c2d310..06ad371 100644
--- a/frysk-core/frysk/testbed/ChangeLog
+++ b/frysk-core/frysk/testbed/ChangeLog
@@ -1,3 +1,8 @@
+2008-03-21  Petr Machata  <pmachata@redhat.com>
+
+	* RegsCase.java: Use lib.dwfl.ElfSymbol instead of
+	frysk.symtab.Symbol.
+
 2008-03-17  Andrew Cagney  <cagney@redhat.com>
 
 	* CoredumpAction.java: Extend ProcBlockObserver.
diff --git a/frysk-core/frysk/testbed/RegsCase.java b/frysk-core/frysk/testbed/RegsCase.java
index ca97ca0..8acaf14 100644
--- a/frysk-core/frysk/testbed/RegsCase.java
+++ b/frysk-core/frysk/testbed/RegsCase.java
@@ -56,7 +56,7 @@ import java.util.LinkedHashMap;
 import java.util.Iterator;
 import java.math.BigInteger;
 import inua.eio.ByteOrder;
-import frysk.symtab.Symbol;
+import lib.dwfl.ElfSymbol;
 import frysk.symtab.SymbolFactory;
 
 /**
@@ -245,8 +245,8 @@ public abstract class RegsCase extends TestLib {
 	void checkValue(Register register) { }
 	void checkRegister(RegsCase c, Register register) {
 	    BigInteger value = registerValue(c, register);
-	    Symbol check = SymbolFactory.getSymbol(c.task(),
-						   value.longValue());


hooks/post-receive
--
frysk system monitor/debugger


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]