From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6227 invoked by alias); 23 Nov 2007 13:49:48 -0000 Received: (qmail 6193 invoked by uid 9112); 23 Nov 2007 13:49:44 -0000 Date: Fri, 23 Nov 2007 13:49:00 -0000 Message-ID: <20071123134944.6176.qmail@sourceware.org> From: mark@sourceware.org To: frysk-cvs@sourceware.org Subject: [SCM] master: Get rid of ProcName libunwind symbol lookup. X-Git-Refname: refs/heads/master X-Git-Reftype: branch X-Git-Oldrev: 2d2be297dcf9af37e1fd58d1bdedb1a13838c2ab X-Git-Newrev: 2180a0e3263189d34f8e01a891dc22994486a386 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: 2007-q4/txt/msg00443.txt.bz2 The branch, master has been updated via 2180a0e3263189d34f8e01a891dc22994486a386 (commit) from 2d2be297dcf9af37e1fd58d1bdedb1a13838c2ab (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email. - Log ----------------------------------------------------------------- commit 2180a0e3263189d34f8e01a891dc22994486a386 Author: Mark Wielaard Date: Fri Nov 23 14:45:16 2007 +0100 Get rid of ProcName libunwind symbol lookup. frysk-imports/libunwind/ChangeLog 2007-11-23 Mark Wielaard Revert: 2006-09-16 Alexandre Oliva * 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 * 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 * LibunwindAddressSpace.java (getModuleFromAddress): Removed. (getProcName): Removed. frysk-sys/lib/unwind/ChangeLog 2007-11-23 Mark Wielaard * 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. ----------------------------------------------------------------------- Summary of changes: frysk-core/frysk/stack/ChangeLog | 5 + frysk-core/frysk/stack/LibunwindAddressSpace.java | 61 -------------- frysk-imports/libunwind/ChangeLog | 22 +++++ .../libunwind/doc/unw_create_addr_space.man | 13 --- .../libunwind/doc/unw_create_addr_space.tex | 6 -- frysk-imports/libunwind/doc/unw_get_proc_name.man | 13 --- frysk-imports/libunwind/doc/unw_get_proc_name.tex | 6 -- frysk-imports/libunwind/src/elfxx.c | 10 +- frysk-imports/libunwind/src/hppa/Gget_proc_info.c | 7 +-- frysk-imports/libunwind/src/mi/Gget_proc_name.c | 22 ++---- frysk-imports/libunwind/src/x86/Gget_proc_info.c | 7 +-- .../libunwind/src/x86_64/Gget_proc_info.c | 7 +-- frysk-sys/lib/unwind/AddressSpace.java | 2 - frysk-sys/lib/unwind/ChangeLog | 16 +++- frysk-sys/lib/unwind/Cursor.java | 14 --- frysk-sys/lib/unwind/ProcName.java | 88 -------------------- frysk-sys/lib/unwind/TestUnwind.java | 3 - frysk-sys/lib/unwind/Unwind.java | 2 - frysk-sys/lib/unwind/cni/UnwindH.hxx | 53 +------------ 19 files changed, 56 insertions(+), 301 deletions(-) delete mode 100644 frysk-sys/lib/unwind/ProcName.java First 500 lines of diff: diff --git a/frysk-core/frysk/stack/ChangeLog b/frysk-core/frysk/stack/ChangeLog index 2684148..72d529b 100644 --- a/frysk-core/frysk/stack/ChangeLog +++ b/frysk-core/frysk/stack/ChangeLog @@ -1,3 +1,8 @@ +2007-11-23 Mark Wielaard + + * LibunwindAddressSpace.java (getModuleFromAddress): Removed. + (getProcName): Removed. + 2007-11-21 Sami Wagiaalla * StackFactory.java (printTaskStackTrace): Added number of 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/ChangeLog b/frysk-imports/libunwind/ChangeLog index 74d2fbf..fd48784 100644 --- a/frysk-imports/libunwind/ChangeLog +++ b/frysk-imports/libunwind/ChangeLog @@ -1,3 +1,25 @@ +2007-11-23 Mark Wielaard + + Revert: + 2006-09-16 Alexandre Oliva + + * 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 + + * 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. + 2007-11-19 Mark Wielaard * src/mi/Gget_reg.c (unw_get_reg): Use cached value from cursor 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/ChangeLog b/frysk-sys/lib/unwind/ChangeLog index ebe978e..ebb93ad 100644 --- a/frysk-sys/lib/unwind/ChangeLog +++ b/frysk-sys/lib/unwind/ChangeLog @@ -1,3 +1,14 @@ +2007-11-23 Mark Wielaard + + * 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. + 2007-11-19 Mark Wielaard * Cursor.java (getIP): New method. @@ -11,8 +22,9 @@ * UnwindPPC32.cxx: New. To support powerpc32. 2007-11-09 Jose Flavio Aguilar Paulino - * UnwindPPC32.java-sh: New - * UnwindRegistersPPC32.shenum: New + + * UnwindPPC32.java-sh: New + * UnwindRegistersPPC32.shenum: New * UnwindRegistersPPC64.shenum: New 2007-10-30 Andrew Cagney 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); hooks/post-receive -- frysk system monitor/debugger