public inbox for frysk@sourceware.org
 help / color / mirror / Atom feed
From: Mark Wielaard <mark@klomp.org>
To: frysk@sourceware.org
Subject: Re: frysk vs libunwind symbol lookup
Date: Fri, 23 Nov 2007 13:51:00 -0000	[thread overview]
Message-ID: <1195825850.2981.40.camel@dijkstra.wildebeest.org> (raw)
In-Reply-To: <1195472746.3047.33.camel@dijkstra.wildebeest.org>

[-- Attachment #1: Type: text/plain, Size: 2337 bytes --]

On Mon, 2007-11-19 at 12:45 +0100, Mark Wielaard wrote:
> I will clean up the libunwind interfaces up next to purge the stuff we
> aren't using anymore and out custom patches to some of the symbol lookup
> stuff in libunwind itself.

Here is the bulk. Now we really aren't doing any ProcName symbol lookups
through libunwind anymore. Hurray! This also gets rid of some of our
local libunwind patches that aren't needed anymore.

frysk-imports/libunwind/ChangeLog
2007-11-23  Mark Wielaard  <mwielaard@redhat.com>

    Revert:
    2006-09-16  Alexandre Oliva  <aoliva@redhat.com>

    * src/x86/Gget_proc_info.c (unw_get_proc_info): Use
    unw_get_proc_name to build a proper proc_info_t.
    * src/x86_64/Gget_proc_info.c (unw_get_proc_info): Likewise.
    * src/hppa/Gget_proc_info.c (unw_get_proc_info): Likewise.

    2006-09-27  Alexandre Oliva  <aoliva@redhat.com>

    * src/elfxx.c (lookup_symbol): Cope with NULL buf and zero buf_len.
    * src/mi/Gget_proc_name.c (intern_string, get_proc_name): Likewise.
    * src/hppa/Gget_proc_info.c (unw_get_proc_info): Use it.
    * src/x86/Gget_proc_info.c (unw_get_proc_info): Likewise.
    * src/x86_64/Gget_proc_info.c (unw_get_proc_info): Likewise.
    * doc/unw_get_proc_name.tex: Document NULL buf and zero buf_len.
    * doc/unw_create_addr_space.tex (get_proc_name): Likewise.
    * doc/unw_get_proc_name.man: Rebuilt.
    * doc/unw_create_addr_space.man: Likewise.

frysk-core/frysk/stack/ChangeLog
2007-11-23  Mark Wielaard  <mwielaard@redhat.com>

    * LibunwindAddressSpace.java (getModuleFromAddress): Removed.
    (getProcName): Removed.

frysk-sys/lib/unwind/ChangeLog
2007-11-23  Mark Wielaard  <mwielaard@redhat.com>

    * AddressSpace.java (getProcName): Removed.
    * Cursor.java (getProcName): Removed.
    * ProcName.java: Removed.
    * TestUnwind.java (getProcName): Removed.
    * Unwind.java (getProcName): Removed.
    * cnu/UnwindH.hxx (min): Removed.
    (get_proc_name): Return UNW_ENOMEM.
    (getProcName): Removed.

I extensively tested this on both x86 and x86_64 (Fedora 8) and no
regressions at all (I suspect there might actually be some unresolved
bugs that got fixed by this, but haven't checked yet). But since this is
actually a big change (as in a huge code path is now never taken) please
let me know if you see anything bad.

Cheers,

Mark

[-- Attachment #2: no-more-procname.patch --]
[-- Type: text/x-patch, Size: 19298 bytes --]

diff --git a/frysk-core/frysk/stack/LibunwindAddressSpace.java b/frysk-core/frysk/stack/LibunwindAddressSpace.java
index 80eb3cf..4b5f8d5 100644
--- a/frysk-core/frysk/stack/LibunwindAddressSpace.java
+++ b/frysk-core/frysk/stack/LibunwindAddressSpace.java
@@ -45,25 +45,18 @@ import lib.unwind.UnwindX8664;
 import lib.unwind.UnwindX86;
 import lib.unwind.UnwindPPC32;
 import lib.unwind.UnwindPPC64;
-import frysk.dwfl.DwflCache;
 import frysk.dwfl.DwflFactory;
-import frysk.event.Event;
 import frysk.isa.ISA;
-import frysk.proc.Manager;
 import frysk.proc.MemoryMap;
 import frysk.proc.Task;
 import java.util.Arrays;
 import java.util.logging.Level;
 import java.util.logging.Logger;
-import lib.dwfl.Dwfl;
-import lib.dwfl.DwflModule;
-import lib.dwfl.SymbolBuilder;
 import lib.unwind.AddressSpace;
 import lib.unwind.ByteOrder;
 import lib.unwind.Cursor;
 import lib.unwind.ElfImage;
 import lib.unwind.ProcInfo;
-import lib.unwind.ProcName;
 import frysk.isa.RegisterMap;
 
 class LibunwindAddressSpace extends AddressSpace {
@@ -168,60 +161,6 @@ class LibunwindAddressSpace extends AddressSpace {
 	return - lib.unwind.Error.UNW_ENOINFO_;
     }
 
-    private DwflModule getModuleFromAddress (long addr) {
-	logger.log(Level.FINE, "Looking for addr: 0x{0}\n",
-		   Long.toHexString(addr));
-	Dwfl dwfl = null;
-	dwfl = DwflCache.getDwfl(task);
-	logger.log(Level.FINEST, "got dwfl: {0}\n", dwfl);
-	if (dwfl == null) {
-	    logger.log(Level.FINE, "Dwfl was null\n");
-	    return null;
-	}
-	return dwfl.getModule(addr);
-    }
-
-    public ProcName getProcName (long addr, int maxNameSize) {
-	logger.log(Level.FINE,
-		   "entering getProcName addr: {0}, maxNameSize: {1}\n",
-		   new Object[] {
-		       Long.toHexString(addr),
-		       new Integer(maxNameSize)
-		   });
-	// Need to tell ptrace thread to perform the getProcName operation.
-	class ExecuteGetProcName 
-	    implements Event, SymbolBuilder
-	{
-	    ProcName procName;
-	    long addr;
-      
-	    ExecuteGetProcName (long addr) {
-		this.addr = addr;
-	    }
-      
-	    public void symbol (String name, long value, long size, int type,
-				int bind, int visibility) {
-		procName = new ProcName(addr-value, name);
-	    }
-      
-	    public void execute () {
-		DwflModule dwflModule = getModuleFromAddress(addr);
-		logger.log(Level.FINEST, "got dwflModule: {0}\n", dwflModule);
-		if (dwflModule != null) {
-		    dwflModule.getSymbol(addr, this);
-		    logger.log(Level.FINE, "ProcName is: {0}\n", procName);
-		}
-		if (procName == null)
-		    procName = new ProcName(- lib.unwind.Error.UNW_EUNSPEC_);
-	    }
-	}
-	ExecuteGetProcName executer = new ExecuteGetProcName(addr);
-	Manager.eventLoop.execute(executer);
-	logger.log(Level.FINE, "exiting getProcName, returning: {0}\n",
-		   executer.procName);
-	return executer.procName;
-    }
-
     public void putUnwindInfo (final ProcInfo procInfo) {
 	// No longer need to hold procInfo.
 	this.procInfo = null;
diff --git a/frysk-imports/libunwind/doc/unw_create_addr_space.man b/frysk-imports/libunwind/doc/unw_create_addr_space.man
index 4ff2b6e..4aca13e 100644
--- a/frysk-imports/libunwind/doc/unw_create_addr_space.man
+++ b/frysk-imports/libunwind/doc/unw_create_addr_space.man
@@ -413,19 +413,6 @@ pointed to by offp
 (assuming the procedure is at least 0x80 
 bytes long). 
 .PP
-If bufp
-is NULL
-, buf_len
-is still verified to fit
-and offp
-is set.  Passing buf_len
-as zero to indicate no
-limits on the buffer length is only safe if buf
-is NULL
-,
-otherwise the callback is entitled and likely to scribble anywhere in
-the entire address space.
-.PP
 On successful completion, the get_proc_name()
 call\-back must 
 return zero. Otherwise, the negative value of one of the 
diff --git a/frysk-imports/libunwind/doc/unw_create_addr_space.tex b/frysk-imports/libunwind/doc/unw_create_addr_space.tex
index f259d4c..8de0691 100644
--- a/frysk-imports/libunwind/doc/unw_create_addr_space.tex
+++ b/frysk-imports/libunwind/doc/unw_create_addr_space.tex
@@ -229,12 +229,6 @@ at address 0x40003000, then invoking \Func{get\_proc\_name}() with
 pointed to by \Var{offp} (assuming the procedure is at least 0x80
 bytes long).
 
-If \Var{bufp} is \Const{NULL}, \Var{buf\_len} is still verified to fit
-and \Var{offp} is set.  Passing \Var{buf\_len} as zero to indicate no
-limits on the buffer length is only safe if \Var{buf} is \Const{NULL},
-otherwise the callback is entitled and likely to scribble anywhere in
-the entire address space.
-
 On successful completion, the \Func{get\_proc\_name}() call-back must
 return zero.  Otherwise, the negative value of one of the
 \Type{unw\_error\_t} error-codes may be returned.
diff --git a/frysk-imports/libunwind/doc/unw_get_proc_name.man b/frysk-imports/libunwind/doc/unw_get_proc_name.man
index b84c5c4..bbf350f 100644
--- a/frysk-imports/libunwind/doc/unw_get_proc_name.man
+++ b/frysk-imports/libunwind/doc/unw_get_proc_name.man
@@ -54,19 +54,6 @@ return a value of 0x80 in the word pointed to by offp
 (assuming 
 the procedure is at least 0x80 bytes long). 
 .PP
-If bufp
-is NULL
-, buf_len
-is still verified to fit
-and offp
-is set.  Passing buf_len
-as zero to indicate no
-limits on the buffer length is only safe if buf
-is NULL
-,
-otherwise the callback is entitled and likely to scribble anywhere in
-the entire address space.
-.PP
 Note that on some platforms there is no reliable way to distinguish 
 between procedure names and ordinary labels. Furthermore, if symbol 
 information has been stripped from a program, procedure names may be 
diff --git a/frysk-imports/libunwind/doc/unw_get_proc_name.tex b/frysk-imports/libunwind/doc/unw_get_proc_name.tex
index bd2b8bc..4a9b585 100644
--- a/frysk-imports/libunwind/doc/unw_get_proc_name.tex
+++ b/frysk-imports/libunwind/doc/unw_get_proc_name.tex
@@ -29,12 +29,6 @@ stack frame with an instruction-pointer value of 0x40003080 would
 return a value of 0x80 in the word pointed to by \Var{offp} (assuming
 the procedure is at least 0x80 bytes long).
 
-If \Var{bufp} is \Const{NULL}, \Var{buf\_len} is still verified to fit
-and \Var{offp} is set.  Passing \Var{buf\_len} as zero to indicate no
-limits on the buffer length is only safe if \Var{buf} is \Const{NULL},
-otherwise the callback is entitled and likely to scribble anywhere in
-the entire address space.
-
 Note that on some platforms there is no reliable way to distinguish
 between procedure names and ordinary labels.  Furthermore, if symbol
 information has been stripped from a program, procedure names may be
diff --git a/frysk-imports/libunwind/src/elfxx.c b/frysk-imports/libunwind/src/elfxx.c
index c70d06b..ae1ef34 100644
--- a/frysk-imports/libunwind/src/elfxx.c
+++ b/frysk-imports/libunwind/src/elfxx.c
@@ -158,14 +158,14 @@ elf_w (lookup_symbol) (unw_addr_space_t as,
 		  Debug (16, "0x%016lx info=0x%02x %s\n",
 			 (long) val, sym->st_info, strtab + sym->st_name);
 
-		  min_dist = (Elf_W (Addr)) (ip - val);
-		  if (buf)
+		  if ((Elf_W (Addr)) (ip - val) < min_dist)
 		    {
+		      min_dist = (Elf_W (Addr)) (ip - val);
 		      strncpy (buf, strtab + sym->st_name, buf_len);
-		      buf[buf_len] = '\0';
+		      buf[buf_len - 1] = '\0';
+		      if (strlen (strtab + sym->st_name) >= buf_len)
+			ret = -UNW_ENOMEM;
 		    }
-		  if (strlen (strtab + sym->st_name) > buf_len)
-		    ret = -UNW_ENOMEM;
 		}
 	    }
 	  break;
diff --git a/frysk-imports/libunwind/src/hppa/Gget_proc_info.c b/frysk-imports/libunwind/src/hppa/Gget_proc_info.c
index 5c5a3fd..8d2c1fd 100644
--- a/frysk-imports/libunwind/src/hppa/Gget_proc_info.c
+++ b/frysk-imports/libunwind/src/hppa/Gget_proc_info.c
@@ -36,13 +36,8 @@ unw_get_proc_info (unw_cursor_t *cursor, unw_proc_info_t *pi)
 	 are missing DWARF unwind info.  We don't want to fail in that
 	 case, because those frames are uninteresting and just mark
 	 the end of the frame-chain anyhow.  */
-      unw_word_t offset;
-
-      if (unw_get_proc_name (cursor, NULL, 0, &offset) < 0)
-	offset = 0;
-
       memset (pi, 0, sizeof (*pi));
-      pi->start_ip = c->dwarf.ip - offset;
+      pi->start_ip = c->dwarf.ip;
       pi->end_ip = c->dwarf.ip + 4;
       return 0;
     }
diff --git a/frysk-imports/libunwind/src/mi/Gget_proc_name.c b/frysk-imports/libunwind/src/mi/Gget_proc_name.c
index bac98ff..7251c59 100644
--- a/frysk-imports/libunwind/src/mi/Gget_proc_name.c
+++ b/frysk-imports/libunwind/src/mi/Gget_proc_name.c
@@ -33,25 +33,16 @@ intern_string (unw_addr_space_t as, unw_accessors_t *a,
   size_t i;
   int ret;
 
-  buf_len--;
-
-  for (i = 0; i <= buf_len; ++i)
+  for (i = 0; i < buf_len; ++i)
     {
-      int8_t c, *p = buf ? (int8_t *)buf + i : &c;
-
-      if ((ret = fetch8 (as, a, &addr, p, arg)) < 0)
+      if ((ret = fetch8 (as, a, &addr, (int8_t *) buf + i, arg)) < 0)
 	return ret;
 
-      if (*p == '\0')
+      if (buf[i] == '\0')
 	return 0;		/* copied full string; return success */
     }
-  if (buf)
-    {
-      buf[buf_len] = '\0';	/* ensure string is NUL terminated */
-      return -UNW_ENOMEM;
-    }
-  else
-    return 0;
+  buf[buf_len - 1] = '\0';	/* ensure string is NUL terminated */
+  return -UNW_ENOMEM;
 }
 
 static inline int
@@ -62,8 +53,7 @@ get_proc_name (unw_addr_space_t as, unw_word_t ip,
   unw_proc_info_t pi;
   int ret;
 
-  if (buf)
-    buf[0] = '\0';	/* always return a valid string, even if it's empty */
+  buf[0] = '\0';	/* always return a valid string, even if it's empty */
 
   ret = unwi_find_dynamic_proc_info (as, ip, &pi, 1, arg);
   if (ret == 0)
diff --git a/frysk-imports/libunwind/src/x86/Gget_proc_info.c b/frysk-imports/libunwind/src/x86/Gget_proc_info.c
index ac4f98a..a533483 100644
--- a/frysk-imports/libunwind/src/x86/Gget_proc_info.c
+++ b/frysk-imports/libunwind/src/x86/Gget_proc_info.c
@@ -35,13 +35,8 @@ unw_get_proc_info (unw_cursor_t *cursor, unw_proc_info_t *pi)
       /* On x86, it's relatively common to be missing DWARF unwind
 	 info.  We don't want to fail in that case, because the
 	 frame-chain still would let us do a backtrace at least.  */
-      unw_word_t offset;
-
-      if (unw_get_proc_name (cursor, NULL, 0, &offset) < 0)
-	offset = 0;
-
       memset (pi, 0, sizeof (*pi));
-      pi->start_ip = c->dwarf.ip - offset;
+      pi->start_ip = c->dwarf.ip;
       pi->end_ip = c->dwarf.ip + 1;
       return 0;
     }
diff --git a/frysk-imports/libunwind/src/x86_64/Gget_proc_info.c b/frysk-imports/libunwind/src/x86_64/Gget_proc_info.c
index 6d5c3d5..213666e 100644
--- a/frysk-imports/libunwind/src/x86_64/Gget_proc_info.c
+++ b/frysk-imports/libunwind/src/x86_64/Gget_proc_info.c
@@ -38,13 +38,8 @@ unw_get_proc_info (unw_cursor_t *cursor, unw_proc_info_t *pi)
 	 are missing DWARF unwind info.  We don't want to fail in that
 	 case, because those frames are uninteresting and just mark
 	 the end of the frame-chain anyhow.  */
-      unw_word_t offset;
-
-      if (unw_get_proc_name (cursor, NULL, 0, &offset) < 0)
-	offset = 0;
-
       memset (pi, 0, sizeof (*pi));
-      pi->start_ip = c->dwarf.ip - offset;
+      pi->start_ip = c->dwarf.ip;
       pi->end_ip = c->dwarf.ip + 1;
       return 0;
     }
diff --git a/frysk-sys/lib/unwind/AddressSpace.java b/frysk-sys/lib/unwind/AddressSpace.java
index 28db0ee..c1df18b 100644
--- a/frysk-sys/lib/unwind/AddressSpace.java
+++ b/frysk-sys/lib/unwind/AddressSpace.java
@@ -104,6 +104,4 @@ public abstract class AddressSpace
     public abstract int accessFPReg (int regnum, byte[] fpvalp, boolean write);
 
     public abstract int resume (Cursor cursor);
-
-    public abstract ProcName getProcName (long addr, int maxSize);
 }
diff --git a/frysk-sys/lib/unwind/Cursor.java b/frysk-sys/lib/unwind/Cursor.java
index 6433ace..8628bd9 100644
--- a/frysk-sys/lib/unwind/Cursor.java
+++ b/frysk-sys/lib/unwind/Cursor.java
@@ -93,20 +93,6 @@ public class Cursor
 	return unwinder.step(cursor);
     }
   
-    public ProcName getProcName(int maxNameSize) {
-	return unwinder.getProcName(cursor, maxNameSize);
-    }
-  
-    public ProcName getProcName() {
-	int initialSize = 256;
-	ProcName myName;
-	do {
-	    myName = unwinder.getProcName(cursor, initialSize);
-	    initialSize *= 2;
-	} while (myName.getError() == - lib.unwind.Error.UNW_ENOMEM_);
-	return myName;
-    }
-  
     public ProcInfo getProcInfo () {
 	return unwinder.getProcInfo(cursor);
     }
diff --git a/frysk-sys/lib/unwind/ProcName.java b/frysk-sys/lib/unwind/ProcName.java
deleted file mode 100644
index 9141899..0000000
--- a/frysk-sys/lib/unwind/ProcName.java
+++ /dev/null
@@ -1,88 +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 lib.unwind;
-
-public class ProcName
-{
-  int error = 0;
-  final long offset;
-  final String name;
-  
-  public long getOffset()
-  {
-    return offset;
-  }
-  
-  public String getName()
-  {
-    return name;
-  }
-  
-  public int getError()
-  {
-    return error;
-  }
-  
-  private ProcName(int error, long offset, String name)
-  {
-    this.error = error;
-    this.offset = offset;
-    this.name = name;
-  }
-  
-  public ProcName(long address, String name)
-  {
-	  this(0, address, name);
-  }
-  
-  public ProcName(int error)
-  {
-	  this(error, 0, null);
-  }
-  
-  public String toString()
-  {
-    if (error != 0)
-    return "ProcName error: " + error;
-    
-    return "ProcName name: " + name + " offset: " + Long.toHexString(offset);
-  }
-  
-}
diff --git a/frysk-sys/lib/unwind/TestUnwind.java b/frysk-sys/lib/unwind/TestUnwind.java
index 6d57e78..255b36a 100644
--- a/frysk-sys/lib/unwind/TestUnwind.java
+++ b/frysk-sys/lib/unwind/TestUnwind.java
@@ -73,9 +73,6 @@ public class TestUnwind
 	public int getDynInfoListAddr (byte[] dilap) {
 	    return 0;
 	}
-	public ProcName getProcName (long addr, int maxNameSize) {
-	    return null;
-	}
 	public void putUnwindInfo (ProcInfo procInfo) {
 	}
 	public int resume (Cursor cursor) {
diff --git a/frysk-sys/lib/unwind/Unwind.java b/frysk-sys/lib/unwind/Unwind.java
index 8e9d3d3..2ab70ef 100644
--- a/frysk-sys/lib/unwind/Unwind.java
+++ b/frysk-sys/lib/unwind/Unwind.java
@@ -61,8 +61,6 @@ public abstract class Unwind
   
   abstract int step (RawDataManaged cursor);
   
-  abstract ProcName getProcName(RawDataManaged cursor, int maxNameSize);
-  
   abstract ProcInfo getProcInfo (RawDataManaged cursor);
   
     abstract void getRegister(RawDataManaged cursor, int regNum,
diff --git a/frysk-sys/lib/unwind/cni/UnwindH.hxx b/frysk-sys/lib/unwind/cni/UnwindH.hxx
index f48494e..77a24cf 100644
--- a/frysk-sys/lib/unwind/cni/UnwindH.hxx
+++ b/frysk-sys/lib/unwind/cni/UnwindH.hxx
@@ -67,7 +67,6 @@
 #include "lib/unwind/ByteOrder.h"
 #include "lib/unwind/CachingPolicy.h"
 #include "lib/unwind/ProcInfo.h"
-#include "lib/unwind/ProcName.h"
 #include "lib/unwind/ElfImage.h"
 
 #include "frysk/sys/cni/Errno.hxx"
@@ -188,12 +187,6 @@ resume(::unw_addr_space_t as, ::unw_cursor_t *cp, void *arg)
   return (int) addressSpace(arg)->resume ((lib::unwind::Cursor *) cp);
 }
 
-static size_t
-min (size_t a, size_t b)
-{
-  return a < b ? a : b;
-}
-
 /*
  * Returns the name of the procedure that the provided address is in as well as
  * the offset from the start of the procedure.
@@ -203,26 +196,7 @@ get_proc_name(::unw_addr_space_t as,
 	      ::unw_word_t addr, char *bufp,
 	      size_t buf_len, ::unw_word_t *offp, void *arg)
 {
-  lib::unwind::ProcName *procName
-    = addressSpace(arg)->getProcName ((jlong) addr, (jint) buf_len);
-  if (procName->error < 0 && procName->error != -UNW_ENOMEM)
-    return procName->error;
-  *offp = (unw_word_t) procName->offset;
-  //In case get_proc_name is used only to find addr;
-  if (bufp == NULL || buf_len == 0) 
-    return 0;
-  if (procName->name == NULL)
-      return 0;
-  //The maximum number of characters that can be copied are buf_len -1.
-  //with bufp[buf_len - 1] = '\0'.
-  //Otherwise copy name.length characters, and bufp[name.length] = '\0'
-  size_t upper_limit = min(buf_len - 1 , JvGetStringUTFLength(procName->name));
-  //JvGetStringUTFRegion(jstring STR, jsize START, jsize LEN, char* BUF);
-  JvGetStringUTFRegion(procName->name, 0, upper_limit, bufp);
-  bufp[upper_limit] = '\0';
-  if (upper_limit < buf_len)
-    return 0;
-  else
+    // This should never be called, always return an error.
     return -UNW_ENOMEM;
 }
 
@@ -290,31 +264,6 @@ lib::unwind::TARGET::step(gnu::gcj::RawDataManaged* cursor)
   return unw_step((unw_cursor_t *) cursor);
 }
 
-lib::unwind::ProcName*
-lib::unwind::TARGET::getProcName(gnu::gcj::RawDataManaged* cursor, jint maxNameSize)
-{
-  logFine (this, logger, "getProcName cursor: %p, maxNameSize: %d", cursor, (int) maxNameSize);
-
-  char bufp[maxNameSize];
-  bufp[0] = '\0';
-  unw_word_t offset;
-  int err = unw_get_proc_name((unw_cursor_t *) cursor, bufp, maxNameSize, &offset);
-
-  logFinest(this, logger, "getProcName bufp: %s, offset: %lx, error: %d", bufp,(long) offset, err);
-
-  if (err < 0)
-    return new lib::unwind::ProcName((jint) err);
-
-  jstring jName;
-  
-  if (bufp[0] == '\0')
-    jName = NULL;
-  else
-    jName = JvNewStringUTF(bufp);
-  
-  return new lib::unwind::ProcName((jlong) offset, jName);
-}
-
 static void
 verifyBounds(jlong offset, jint length, jbyteArray bytes, jint start, int size)
 {

      reply	other threads:[~2007-11-23 13:51 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-11-19 11:45 Mark Wielaard
2007-11-23 13:51 ` Mark Wielaard [this message]

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=1195825850.2981.40.camel@dijkstra.wildebeest.org \
    --to=mark@klomp.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: link
Be 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).