Import deps with slight edits
This commit is contained in:
parent
7220868509
commit
3ecd6130a3
494 changed files with 188191 additions and 0 deletions
77
dwarf-compilation.base/contrib/libcxxfileno/.gitignore
vendored
Normal file
77
dwarf-compilation.base/contrib/libcxxfileno/.gitignore
vendored
Normal file
|
@ -0,0 +1,77 @@
|
|||
/Makefile
|
||||
|
||||
__pycache__/
|
||||
*.py[cod]
|
||||
|
||||
.deps/
|
||||
.libs/
|
||||
|
||||
|
||||
# http://www.gnu.org/software/automake
|
||||
|
||||
Makefile.in
|
||||
|
||||
# http://www.gnu.org/software/autoconf
|
||||
|
||||
/autom4te.cache
|
||||
/aclocal.m4
|
||||
/compile
|
||||
/configure
|
||||
/depcomp
|
||||
/install-sh
|
||||
/missing
|
||||
/stamp-h1
|
||||
/m4/
|
||||
/config.guess
|
||||
/config.sub
|
||||
/config.status
|
||||
/config.log
|
||||
/ltmain.sh
|
||||
/libtool
|
||||
|
||||
|
||||
# Compiled Object files
|
||||
*.slo
|
||||
*.lo
|
||||
*.o
|
||||
*.obj
|
||||
|
||||
*.pc
|
||||
|
||||
# Dependencies
|
||||
.*.d
|
||||
|
||||
# Precompiled Headers
|
||||
*.gch
|
||||
*.pch
|
||||
|
||||
# Compiled Dynamic libraries
|
||||
*.so
|
||||
*.dylib
|
||||
*.dll
|
||||
|
||||
# Fortran module files
|
||||
*.mod
|
||||
|
||||
# Compiled Static libraries
|
||||
*.lai
|
||||
*.la
|
||||
*.a
|
||||
*.lib
|
||||
|
||||
# Executables
|
||||
*.exe
|
||||
*.out
|
||||
*.app
|
||||
|
||||
|
||||
# Backup files
|
||||
*~
|
||||
\#*\#
|
||||
.\#*
|
||||
|
||||
# WTF Dropbox
|
||||
|
||||
.fuse_hidden*
|
||||
.nfs*
|
||||
.dropbox*
|
2
dwarf-compilation.base/contrib/libcxxfileno/INSTALL
Normal file
2
dwarf-compilation.base/contrib/libcxxfileno/INSTALL
Normal file
|
@ -0,0 +1,2 @@
|
|||
libtoolize && autoreconf -i && ./configure --prefix=(somewhere) && make && [sudo] make install
|
||||
|
16
dwarf-compilation.base/contrib/libcxxfileno/Makefile.am
Executable file
16
dwarf-compilation.base/contrib/libcxxfileno/Makefile.am
Executable file
|
@ -0,0 +1,16 @@
|
|||
pkgincludedir=$(includedir)
|
||||
ACLOCAL_AMFLAGS = -I m4
|
||||
lib_LTLIBRARIES = libc++fileno.la
|
||||
libc__fileno_la_SOURCES = fileno.cpp
|
||||
pkginclude_HEADERS = fileno.hpp
|
||||
extra_DIST = libc++fileno.pc.in
|
||||
pkgconfigdir = $(libdir)/pkgconfig
|
||||
pkgconfig_DATA = libc++fileno.pc
|
||||
|
||||
lib/libc++fileno.so: $(lib_LTLIBRARIES)
|
||||
mkdir -p lib && cd lib && ln -sf ../.libs/libc++fileno.so .
|
||||
|
||||
lib/libc++fileno.so.0: $(lib_LTLIBRARIES)
|
||||
mkdir -p lib && cd lib && ln -sf ../.libs/libc++fileno.so.0 .
|
||||
|
||||
all: lib/libc++fileno.so lib/libc++fileno.so.0
|
15
dwarf-compilation.base/contrib/libcxxfileno/configure.ac
Executable file
15
dwarf-compilation.base/contrib/libcxxfileno/configure.ac
Executable file
|
@ -0,0 +1,15 @@
|
|||
AC_CONFIG_MACRO_DIR([m4])
|
||||
AC_PREREQ([2.69])
|
||||
AC_INIT([libc++fileno], [0.1], [srk31@cl.cam.ac.uk])
|
||||
LT_INIT
|
||||
AC_CONFIG_SRCDIR([fileno.cpp])
|
||||
AC_LANG([C++])
|
||||
AM_INIT_AUTOMAKE([foreign subdir-objects])
|
||||
AM_MAINTAINER_MODE
|
||||
AC_PROG_CXX
|
||||
AX_CXX_COMPILE_STDCXX_11
|
||||
AC_PROG_LN_S
|
||||
AC_PROG_INSTALL
|
||||
PKG_PROG_PKG_CONFIG
|
||||
AC_CHECK_HEADERS([cstdio fstream cerrno iosfwd ext/stdio_filebuf.h ext/stdio_sync_filebuf.h], [], [AC_MSG_FAILURE([required standard headers: cstdio fstream cerrno iosfwd ext/stdio_filebuf.h ext/stdio_sync_filebuf.h])])
|
||||
AC_OUTPUT([Makefile libc++fileno.pc])
|
191
dwarf-compilation.base/contrib/libcxxfileno/fileno.cpp
Normal file
191
dwarf-compilation.base/contrib/libcxxfileno/fileno.cpp
Normal file
|
@ -0,0 +1,191 @@
|
|||
#include "fileno.hpp"
|
||||
#include <ciso646> // just for __LIBCPP_VERSION
|
||||
|
||||
#include <cstdio> // declaration of ::fileno
|
||||
#include <cerrno>
|
||||
|
||||
// for basic_filebuf template
|
||||
#ifdef _LIBCPP_VERSION
|
||||
#ifdef private
|
||||
# error "why on earth is private #defined to something already?!"
|
||||
#endif
|
||||
// this is a very bad idea, never do this
|
||||
# define private public
|
||||
// no, seriously.
|
||||
# include <fstream>
|
||||
# undef private
|
||||
# undef class
|
||||
#else
|
||||
# include <fstream>
|
||||
#endif
|
||||
|
||||
|
||||
#if defined(__GLIBCXX__) || (defined(__GLIBCPP__) && __GLIBCPP__>=20020514) // GCC >= 3.1.0
|
||||
# include <ext/stdio_filebuf.h>
|
||||
#endif
|
||||
#if defined(__GLIBCXX__) // GCC >= 3.4.0
|
||||
# include <ext/stdio_sync_filebuf.h>
|
||||
#endif
|
||||
|
||||
int cfileno(FILE *f) {
|
||||
return ::fileno(f);
|
||||
}
|
||||
|
||||
|
||||
//! Similar to fileno(3), but taking a C++ stream as argument instead of a
|
||||
//! FILE*. Note that there is no way for the library to track what you do with
|
||||
//! the descriptor, so be careful.
|
||||
//! \return The integer file descriptor associated with the stream, or -1 if
|
||||
//! that stream is invalid. In the latter case, for the sake of keeping the
|
||||
//! code as similar to fileno(3), errno is set to EBADF.
|
||||
//! \see The <A HREF="http://www.ginac.de/~kreckel/fileno/">upstream page at
|
||||
//! http://www.ginac.de/~kreckel/fileno/</A> of this code provides more
|
||||
//! detailed information.
|
||||
template <typename charT, typename traits>
|
||||
inline int
|
||||
fileno_hack(const std::basic_ios<charT, traits>& stream)
|
||||
{
|
||||
// Some C++ runtime libraries shipped with ancient GCC, Sun Pro,
|
||||
// Sun WS/Forte 5/6, Compaq C++ supported non-standard file descriptor
|
||||
// access basic_filebuf<>::fd(). Alas, starting from GCC 3.1, the GNU C++
|
||||
// runtime removes all non-standard std::filebuf methods and provides an
|
||||
// extension template class __gnu_cxx::stdio_filebuf on all systems where
|
||||
// that appears to make sense (i.e. at least all Unix systems). Starting
|
||||
// from GCC 3.4, there is an __gnu_cxx::stdio_sync_filebuf, in addition.
|
||||
// Sorry, darling, I must get brutal to fetch the darn file descriptor!
|
||||
// Please complain to your compiler/libstdc++ vendor...
|
||||
#if defined(__GLIBCXX__) || defined(__GLIBCPP__)
|
||||
// OK, stop reading here, because it's getting obscene. Cross fingers!
|
||||
# if defined(__GLIBCXX__) // >= GCC 3.4.0
|
||||
// This applies to cin, cout and cerr when not synced with stdio:
|
||||
typedef __gnu_cxx::stdio_filebuf<charT, traits> unix_filebuf_t;
|
||||
unix_filebuf_t* fbuf = dynamic_cast<unix_filebuf_t*>(stream.rdbuf());
|
||||
if (fbuf != NULL) {
|
||||
return fbuf->fd();
|
||||
}
|
||||
|
||||
// This applies to filestreams:
|
||||
typedef std::basic_filebuf<charT, traits> filebuf_t;
|
||||
filebuf_t* bbuf = dynamic_cast<filebuf_t*>(stream.rdbuf());
|
||||
if (bbuf != NULL) {
|
||||
// This subclass is only there for accessing the FILE*. Ouuwww, sucks!
|
||||
struct my_filebuf : public std::basic_filebuf<charT, traits> {
|
||||
int fd() { return this->_M_file.fd(); }
|
||||
};
|
||||
return static_cast<my_filebuf*>(bbuf)->fd();
|
||||
}
|
||||
|
||||
// This applies to cin, cout and cerr when synced with stdio:
|
||||
typedef __gnu_cxx::stdio_sync_filebuf<charT, traits> sync_filebuf_t;
|
||||
sync_filebuf_t* sbuf = dynamic_cast<sync_filebuf_t*>(stream.rdbuf());
|
||||
if (sbuf != NULL) {
|
||||
# if (__GLIBCXX__<20040906) // GCC < 3.4.2
|
||||
// This subclass is only there for accessing the FILE*.
|
||||
// See GCC PR#14600 and PR#16411.
|
||||
struct my_filebuf : public sync_filebuf_t {
|
||||
my_filebuf(); // Dummy ctor keeps the compiler happy.
|
||||
// Note: stdio_sync_filebuf has a FILE* as its first (but private)
|
||||
// member variable. However, it is derived from basic_streambuf<>
|
||||
// and the FILE* is the first non-inherited member variable.
|
||||
FILE* c_file() {
|
||||
return *(FILE**)((char*)this + sizeof(std::basic_streambuf<charT, traits>));
|
||||
}
|
||||
};
|
||||
return ::fileno(static_cast<my_filebuf*>(sbuf)->c_file());
|
||||
# else
|
||||
return ::fileno(sbuf->file());
|
||||
# endif
|
||||
}
|
||||
# else // GCC < 3.4.0 used __GLIBCPP__
|
||||
# if (__GLIBCPP__>=20020514) // GCC >= 3.1.0
|
||||
// This applies to cin, cout and cerr:
|
||||
typedef __gnu_cxx::stdio_filebuf<charT, traits> unix_filebuf_t;
|
||||
unix_filebuf_t* buf = dynamic_cast<unix_filebuf_t*>(stream.rdbuf());
|
||||
if (buf != NULL) {
|
||||
return buf->fd();
|
||||
}
|
||||
|
||||
// This applies to filestreams:
|
||||
typedef std::basic_filebuf<charT, traits> filebuf_t;
|
||||
filebuf_t* bbuf = dynamic_cast<filebuf_t*>(stream.rdbuf());
|
||||
if (bbuf != NULL) {
|
||||
// This subclass is only there for accessing the FILE*. Ouuwww, sucks!
|
||||
struct my_filebuf : public std::basic_filebuf<charT, traits> {
|
||||
// Note: _M_file is of type __basic_file<char> which has a
|
||||
// FILE* as its first (but private) member variable.
|
||||
FILE* c_file() { return *(FILE**)(&this->_M_file); }
|
||||
};
|
||||
FILE* c_file = static_cast<my_filebuf*>(bbuf)->c_file();
|
||||
if (c_file != NULL) { // Could be NULL for failed ifstreams.
|
||||
return ::fileno(c_file);
|
||||
}
|
||||
}
|
||||
# else // GCC 3.0.x
|
||||
typedef std::basic_filebuf<charT, traits> filebuf_t;
|
||||
filebuf_t* fbuf = dynamic_cast<filebuf_t*>(stream.rdbuf());
|
||||
if (fbuf != NULL) {
|
||||
struct my_filebuf : public filebuf_t {
|
||||
// Note: basic_filebuf<charT, traits> has a __basic_file<charT>* as
|
||||
// its first (but private) member variable. Since it is derived
|
||||
// from basic_streambuf<charT, traits> we can guess its offset.
|
||||
// __basic_file<charT> in turn has a FILE* as its first (but
|
||||
// private) member variable. Get it by brute force. Oh, geez!
|
||||
FILE* c_file() {
|
||||
std::__basic_file<charT>* ptr_M_file = *(std::__basic_file<charT>**)((char*)this + sizeof(std::basic_streambuf<charT, traits>));
|
||||
# if _GLIBCPP_BASIC_FILE_INHERITANCE
|
||||
// __basic_file<charT> inherits from __basic_file_base<charT>
|
||||
return *(FILE**)((char*)ptr_M_file + sizeof(std::__basic_file_base<charT>));
|
||||
# else
|
||||
// __basic_file<charT> is base class, but with vptr.
|
||||
return *(FILE**)((char*)ptr_M_file + sizeof(void*));
|
||||
# endif
|
||||
}
|
||||
};
|
||||
return ::fileno(static_cast<my_filebuf*>(fbuf)->c_file());
|
||||
}
|
||||
# endif
|
||||
# endif
|
||||
#else
|
||||
#ifdef _LIBCPP_VERSION // llvm libc++
|
||||
typedef std::basic_filebuf<charT, traits> filebuf_t;
|
||||
filebuf_t* fbuf = stream.rdbuf();
|
||||
template <typename c, typename t>
|
||||
struct my_filebuf : public filebuf_t<c, t> {
|
||||
FILE *c_file() {
|
||||
return this->__file_;
|
||||
}
|
||||
};
|
||||
my_filebuf<charT, traits> *my_fbuf = static_cast<my_filebuf<charT, traits>*>(fbuf);
|
||||
if (my_fbuf != NULL && my_fbuf->c_file() != NULL) {
|
||||
return cfileno(my_fbuf->c_file());
|
||||
} else {
|
||||
errno = EBADF;
|
||||
return -1;
|
||||
}
|
||||
#else
|
||||
# error "Does anybody know how to fetch the bloody file descriptor?"
|
||||
return stream.rdbuf()->fd(); // Maybe a good start?
|
||||
#endif
|
||||
#endif
|
||||
errno = EBADF;
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
//! 8-Bit character instantiation: fileno(ios).
|
||||
template <>
|
||||
int
|
||||
fileno<char>(const std::ios& stream)
|
||||
{
|
||||
return fileno_hack(stream);
|
||||
}
|
||||
|
||||
#if !(defined(__GLIBCXX__) || defined(__GLIBCPP__)) || (defined(_GLIBCPP_USE_WCHAR_T) || defined(_GLIBCXX_USE_WCHAR_T))
|
||||
//! Wide character instantiation: fileno(wios).
|
||||
template <>
|
||||
int
|
||||
fileno<wchar_t>(const std::wios& stream)
|
||||
{
|
||||
return fileno_hack(stream);
|
||||
}
|
||||
#endif
|
4
dwarf-compilation.base/contrib/libcxxfileno/fileno.hpp
Normal file
4
dwarf-compilation.base/contrib/libcxxfileno/fileno.hpp
Normal file
|
@ -0,0 +1,4 @@
|
|||
#include <iosfwd>
|
||||
|
||||
template <typename charT, typename traits>
|
||||
int fileno(const std::basic_ios<charT, traits>& stream);
|
1
dwarf-compilation.base/contrib/libcxxfileno/include
Symbolic link
1
dwarf-compilation.base/contrib/libcxxfileno/include
Symbolic link
|
@ -0,0 +1 @@
|
|||
.
|
|
@ -0,0 +1,14 @@
|
|||
prefix=@prefix@
|
||||
exec_prefix=@exec_prefix@
|
||||
libdir=@libdir@
|
||||
includedir=@includedir@
|
||||
pkgincludedir=${includedir}/@PACKAGE@
|
||||
pkglibdir=@pkglibdir@
|
||||
datarootdir=@datarootdir@
|
||||
datadir=@datadir@
|
||||
|
||||
Name: libc++fileno
|
||||
Description: Stephen Kell's distribution of Richard Kreckel's fileno() function for popular implementations of the C++ standard library
|
||||
Version: 0.1
|
||||
Cflags: -I${pkgincludedir}
|
||||
Libs: -L${libdir} -lc++fileno
|
3
dwarf-compilation.base/contrib/libdwarf/.gitignore
vendored
Normal file
3
dwarf-compilation.base/contrib/libdwarf/.gitignore
vendored
Normal file
|
@ -0,0 +1,3 @@
|
|||
*.[oa]
|
||||
junk*
|
||||
*~
|
29
dwarf-compilation.base/contrib/libdwarf/BLDLIBDWARF
Executable file
29
dwarf-compilation.base/contrib/libdwarf/BLDLIBDWARF
Executable file
|
@ -0,0 +1,29 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
bldone () {
|
||||
t=$1
|
||||
cd $t
|
||||
# The following distclean will fail on a clean directory
|
||||
# Ignore the failure
|
||||
make distclean
|
||||
./configure
|
||||
if [ $? != 0 ]
|
||||
then
|
||||
echo build failed
|
||||
exit
|
||||
fi
|
||||
make
|
||||
if [ $? != 0 ]
|
||||
then
|
||||
echo build failed
|
||||
exit
|
||||
fi
|
||||
cd ..
|
||||
}
|
||||
|
||||
bldone libdwarf
|
||||
bldone dwarfdump
|
||||
|
||||
|
||||
|
||||
|
44
dwarf-compilation.base/contrib/libdwarf/BLDLIBDWARFTAR
Executable file
44
dwarf-compilation.base/contrib/libdwarf/BLDLIBDWARFTAR
Executable file
|
@ -0,0 +1,44 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
#newpref sets directory name with date, more
|
||||
#like normal linux packages.
|
||||
if [ $# != 1 ]
|
||||
then
|
||||
echo Usage: BLDLIBDWARFTAR yyyymmdd
|
||||
echo Example: BLDLIBDWARFTAR 20040108
|
||||
exit 1
|
||||
fi
|
||||
echo "This does not do UPDATEDWARFDUMPVERSION.sh"
|
||||
echo "Make sure there are no unwanted files"
|
||||
echo "in the code directories as all the files get"
|
||||
echo "copied to the release tar file."
|
||||
dat=$1
|
||||
|
||||
tmpf=dwarf
|
||||
tmpdir=/var/tmp
|
||||
# cptopublic knows /var/tmp/dwarf is the target
|
||||
sh CPTOPUBLIC nouv
|
||||
newpref=dwarf-${dat}
|
||||
newf=libdwarf-${dat}.tar
|
||||
echo src is $tmpdir/$tmpf tmp is $newpref target is $newf
|
||||
echo ============ $newpref $newf ==========
|
||||
|
||||
echo First create $tmpdir/$newpref with the latest source.
|
||||
cd $tmpdir
|
||||
if [ ! -d $tmpf ]
|
||||
then
|
||||
echo No $tmpdir/dwarf present! Do nothing.
|
||||
exit 0
|
||||
fi
|
||||
rm -rf $newpref
|
||||
|
||||
cp -rp $tmpf $newpref
|
||||
# Alter date below before using.e
|
||||
rm -f ${newf} ${newf}.gz
|
||||
tar cf /var/tmp/$newf $newpref
|
||||
gzip ${newf}
|
||||
hm=/home/davea/web4/gweb/pagedata
|
||||
cp ${newf}.gz $hm
|
||||
ls -l $tmpdir/${newf}.gz
|
||||
ls -l $hm/${newf}.gz
|
||||
exit 0
|
210
dwarf-compilation.base/contrib/libdwarf/BLDTESTDIR
Normal file
210
dwarf-compilation.base/contrib/libdwarf/BLDTESTDIR
Normal file
|
@ -0,0 +1,210 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
#newpref sets directory name with date, more
|
||||
#like normal linux packages.
|
||||
if [ $# != 1 ]
|
||||
then
|
||||
echo Usage: BLDTESTDIR yyyymmdd
|
||||
echo Example: BLDTESTDIR 20100501
|
||||
exit 1
|
||||
fi
|
||||
dat=$1
|
||||
tmpdir=/var/tmp
|
||||
cd dwarftest
|
||||
basenewpref=dwarftest-${dat}
|
||||
newpref=$tmpdir/dwarftest-${dat}
|
||||
newf=dwarftest-${dat}.tar
|
||||
echo ============ $newpref $newf ==========
|
||||
echo First create /var/tmp/$newpref with the latest source.
|
||||
rm -rf $newpref
|
||||
mkdir $newpref
|
||||
for i in zero/Makefile \
|
||||
allen1/README \
|
||||
allen1/todd-allen-gcc-4.4.4-bin.exe \
|
||||
zero/TEST \
|
||||
zero/zero.cc \
|
||||
sandnes2/cu_dir_added_to_complete_path.c \
|
||||
sandnes2/README \
|
||||
sandnes2/RUNTEST.sh \
|
||||
sandnes2/cu_dir_added_to_complete_path.elf \
|
||||
dwarf4/dd2g4.5dwarf-4 \
|
||||
dwarf4/ddg4.5dwarf-4 \
|
||||
dwarf4/README \
|
||||
moshe/a.out.t \
|
||||
moshe/hello \
|
||||
moshe/hello.c \
|
||||
moshe/README \
|
||||
moshe/t.c \
|
||||
lloyd/arange.elf \
|
||||
lloyd/README \
|
||||
cell/c_malloc.o \
|
||||
cell/README \
|
||||
test-eh/Makefile \
|
||||
test-eh/eh-frame.cc \
|
||||
test-eh/test-eh.386 \
|
||||
test-eh/test-eh.c \
|
||||
test-eh/eh-frame.386 \
|
||||
CLEANUP \
|
||||
ChangeLog2010 \
|
||||
ChangeLog2009 \
|
||||
test-alex2/test.c \
|
||||
test-alex2/README \
|
||||
test-alex2/RUNTEST \
|
||||
test-alex2/bugemail \
|
||||
test-alex2/orig.a.out \
|
||||
sun/sunelf1 \
|
||||
sun/sparc1-a.out \
|
||||
linkonce/linkonce.txt \
|
||||
linkonce/test.cpp \
|
||||
linkonce/comdattest.o \
|
||||
libdwarf.a \
|
||||
louzon/README \
|
||||
louzon/ppcobj.o \
|
||||
cristi3/foo.cpp \
|
||||
cristi3/cristibadobj \
|
||||
cristi3/README \
|
||||
arm/README \
|
||||
arm/armcc-test-dwarf3 \
|
||||
arm/armcc-test-dwarf2 \
|
||||
ia64/hxdump.c \
|
||||
ia64/mytry.ia64 \
|
||||
ia64/mytry.cpp \
|
||||
ia64/README \
|
||||
ia64/hxdump.ia64 \
|
||||
PICKUPBIN \
|
||||
test_harmless \
|
||||
findcu/cutest.c \
|
||||
findcu/README \
|
||||
findcu/cutestobj.save \
|
||||
findcu/RUNTEST \
|
||||
TEST \
|
||||
macinfo/test.c \
|
||||
macinfo/a.out3.4 \
|
||||
macinfo/a.out4.3 \
|
||||
macinfo/README \
|
||||
RUNALL.sh \
|
||||
testcase/testcase.c \
|
||||
testcase/Makefile \
|
||||
testcase/README \
|
||||
testcase/testcase \
|
||||
testcase/BLD \
|
||||
testcase/verify \
|
||||
dwarfextract/test2.c \
|
||||
dwarfextract/Makefile \
|
||||
dwarfextract/test1.base \
|
||||
dwarfextract/test1.c \
|
||||
dwarfextract/runtests.sh \
|
||||
dwarfextract/test1.h \
|
||||
dwarfextract/dwarfextract.c \
|
||||
val_expr/libpthread-2.5.so \
|
||||
ChangeLog \
|
||||
frame1/frame1.orig \
|
||||
frame1/frame1.c \
|
||||
frame1/README \
|
||||
frame1/frame1.exe.save \
|
||||
frame1/frame1.base \
|
||||
frame1/runtest.sh \
|
||||
cristi2/libpthread-2.4.so \
|
||||
cristi2/README \
|
||||
cristi2/libc-2.5.so \
|
||||
x86/README \
|
||||
x86/dwarfdumpv4.3 \
|
||||
kartashev2/Makefile \
|
||||
kartashev2/bar.cc \
|
||||
kartashev2/foo.cc \
|
||||
kartashev2/combined.o \
|
||||
test_harmless.c \
|
||||
libdwoldframecol.a \
|
||||
atefail/README \
|
||||
atefail/ig_server \
|
||||
modula2/README \
|
||||
modula2/write-fixed \
|
||||
shihhuangti/t1.o \
|
||||
shihhuangti/tcombined.o \
|
||||
shihhuangti/README.txt \
|
||||
shihhuangti/t2.o \
|
||||
dwarfdump.conferr1 \
|
||||
DWARFTEST.sh \
|
||||
moore/README \
|
||||
moore/simplec.o \
|
||||
moore/RUNTEST.sh \
|
||||
moore/simplec.c \
|
||||
moore/djpeg.v850 \
|
||||
README.txt \
|
||||
ppc2/README \
|
||||
ppc2/powerpc-750-linux-gnu-hello-static.txt \
|
||||
ppc2/powerpc-750-linux-gnu-hello-static \
|
||||
sparc/README \
|
||||
sparc/tcombined.o \
|
||||
sandnes/Test1.elf \
|
||||
sandnes/README \
|
||||
wynn/unoptimised.axf \
|
||||
wynn/README.txt \
|
||||
COPYING \
|
||||
SINGLE \
|
||||
mutatee/test1.mutatee_gcc.exe \
|
||||
mucci/main.gcc \
|
||||
mucci/a.out.mucci \
|
||||
mucci/main.o \
|
||||
mucci/README \
|
||||
mucci/main.c \
|
||||
mucci/main.pathcc \
|
||||
mucci/stream.o \
|
||||
mucci/main.o.pathcc \
|
||||
mucci/main.o.gcc \
|
||||
test_dwarfnames.c \
|
||||
legendre/frame_test.c \
|
||||
legendre/libmpich.so.1.0 \
|
||||
legendre/README \
|
||||
legendre/RUNTEST.sh \
|
||||
ref_addr/README \
|
||||
ref_addr/ELF3.elf \
|
||||
test-array/Makefile \
|
||||
test-array/array.c \
|
||||
test-array/test-array \
|
||||
BLD \
|
||||
irix64/libc.so \
|
||||
test-alex1/test.c \
|
||||
test-alex1/bug \
|
||||
test-alex1/RUNTEST \
|
||||
test-alex1/bugemail \
|
||||
test-alex1/BLD \
|
||||
test-alex1/RUNIT \
|
||||
test-alex1/orig.a.out \
|
||||
BLDTAR \
|
||||
kartashev/README \
|
||||
kartashev/combined.o \
|
||||
irixn32/dwarfdump \
|
||||
irixn32/libc.so \
|
||||
RUN \
|
||||
verifyall.cc \
|
||||
dwarfdump.O \
|
||||
dwarfdump.conf \
|
||||
ia32/libc.so.6 \
|
||||
ia32/preloadable_libintl.so \
|
||||
ia32/mytry.ia32 \
|
||||
ia32/libpfm.so.3 \
|
||||
ia32/libpt_linux_x86_r.so.1 \
|
||||
enciso2/README \
|
||||
enciso2/test_templates.cpp \
|
||||
enciso2/template.elf \
|
||||
enciso2/test_templates.o
|
||||
do
|
||||
d=`dirname $i`
|
||||
if ! [ -d $newpref/$d ]
|
||||
then
|
||||
mkdir $newpref/$d
|
||||
fi
|
||||
cp -p $i $newpref/$i
|
||||
done
|
||||
|
||||
cd $tmpdir
|
||||
# Alter date below before using.e
|
||||
rm -f ${newf} ${newf}.gz
|
||||
tar cf /var/tmp/$newf $basenewpref
|
||||
gzip ${newf}
|
||||
hm=/home/davea/sgiweb3/pagedata
|
||||
cp ${newf}.gz $hm
|
||||
ls -l $tmpdir/${newf}.gz
|
||||
ls -l $hm/${newf}.gz
|
||||
exit 0
|
18
dwarf-compilation.base/contrib/libdwarf/CLEANUP
Normal file
18
dwarf-compilation.base/contrib/libdwarf/CLEANUP
Normal file
|
@ -0,0 +1,18 @@
|
|||
|
||||
|
||||
( cd dwarfexample ; make clean ; make distclean )
|
||||
( cd dwarfgen ; make clean ; make distclean )
|
||||
( cd libdwarf ; make clean ; make distclean )
|
||||
( cd dwarfdump ; make clean ; make distclean )
|
||||
( cd bugxml ; rm -f bugrecord.pyc )
|
||||
( cd bugxml ; rm -f dwarfbug.xml )
|
||||
( cd bugxml ; rm -f dwarfbugtail )
|
||||
( cd bugxml ; rm -f junk* )
|
||||
( cd bugxml ; rm -rf __pycache__ )
|
||||
|
||||
rm -f libdwarf/BLD
|
||||
rm -f dwarfdump/BLD
|
||||
|
||||
rm -f dwarfgen/configure.lineno
|
||||
rm -f ALLd*
|
||||
rm -f junk* */junk*
|
45
dwarf-compilation.base/contrib/libdwarf/CMakeLists.txt
Normal file
45
dwarf-compilation.base/contrib/libdwarf/CMakeLists.txt
Normal file
|
@ -0,0 +1,45 @@
|
|||
cmake_minimum_required(VERSION 3.2)
|
||||
|
||||
project(libdwarf)
|
||||
|
||||
list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
|
||||
|
||||
include(LibdwarfMacros)
|
||||
|
||||
# view folders on supported IDEs
|
||||
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
|
||||
|
||||
# used when finding libelf
|
||||
set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS TRUE)
|
||||
|
||||
# this project has tests
|
||||
enable_testing()
|
||||
|
||||
# always include project's folder to includes
|
||||
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||
set(CMAKE_INCLUDE_CURRENT_DIR_IN_INTERFACE ON)
|
||||
|
||||
find_package(LibElf REQUIRED)
|
||||
|
||||
list(APPEND CMAKE_REQUIRED_INCLUDES ${LIBELF_INCLUDE_DIRS})
|
||||
|
||||
include(configure.cmake)
|
||||
|
||||
if(nonshared)
|
||||
set(DWARF_TARGETS dwarf-static)
|
||||
set(DWARF_TYPES STATIC)
|
||||
set(dwarf-target dwarf-static)
|
||||
endif()
|
||||
if(shared)
|
||||
list(APPEND DWARF_TARGETS dwarf-shared)
|
||||
list(APPEND DWARF_TYPES SHARED)
|
||||
set(dwarf-target dwarf-shared)
|
||||
endif()
|
||||
|
||||
add_subdirectory(libdwarf)
|
||||
add_subdirectory(dwarfexample)
|
||||
add_subdirectory(dwarfdump)
|
||||
add_subdirectory(dwarfgen)
|
||||
|
||||
add_custom_target(dd
|
||||
DEPENDS ${DWARF_TARGETS} dwarfdump)
|
35
dwarf-compilation.base/contrib/libdwarf/CPTOPUBLIC
Executable file
35
dwarf-compilation.base/contrib/libdwarf/CPTOPUBLIC
Executable file
|
@ -0,0 +1,35 @@
|
|||
#!/bin/sh
|
||||
# CPTOPUBLIC [uv] [nouv]
|
||||
|
||||
usemsg()
|
||||
{
|
||||
echo "CPTOPUBLIC [uv] [nouv]"
|
||||
echo "where uv means update version strings "
|
||||
echo "where nouv means do not update version strings "
|
||||
echo "One of uv or nouv is required..."
|
||||
}
|
||||
|
||||
if [ $# -ne 1 ]
|
||||
then
|
||||
usemsg
|
||||
exit 1
|
||||
fi
|
||||
uver="n"
|
||||
case $1 in
|
||||
uv) uver="y" ;;
|
||||
nouv) uver="n" ;;
|
||||
*) usemsg ; exit 1 ;;
|
||||
esac
|
||||
|
||||
s=/home/davea/dwarf/code
|
||||
cd $s
|
||||
pwd
|
||||
t=/var/tmp/dwarf
|
||||
echo target is $t
|
||||
if [ $uver = "y" ]
|
||||
then
|
||||
sh UPDATEDWARFDUMPVERSION.sh
|
||||
fi
|
||||
rm -rf $t
|
||||
mkdir $t
|
||||
cp -rp * $t
|
93
dwarf-compilation.base/contrib/libdwarf/CREATINGARELEASE
Normal file
93
dwarf-compilation.base/contrib/libdwarf/CREATINGARELEASE
Normal file
|
@ -0,0 +1,93 @@
|
|||
|
||||
This is an checlist of the steps in creating a new release.
|
||||
In hopes this will prevent omissions.
|
||||
|
||||
DavidA. 30 November 2012
|
||||
|
||||
Source here means libdwarf/dwarfdump/dwarfgen source (in Git).
|
||||
Tests here means the regression tests (in another Git repository).
|
||||
|
||||
In the Source:
|
||||
|
||||
Update the source and build with your changes.
|
||||
Update the appropriate ChangeLog file so every
|
||||
file in Git which changes (except ChangeLog and NEWS)
|
||||
are in ChangeLog.
|
||||
(at year end, move ChangeLog to ChangeLogyyyy
|
||||
where yyyy is the year ending and create a new
|
||||
empty ChangeLog)
|
||||
|
||||
Use dicheck (also in sourceforge) to verify indentation of
|
||||
all .h .cc and .c files is consistent.
|
||||
|
||||
Ensure all interfaces in libdwarf that are call able by users
|
||||
are in libdwarf.h and are documented in libdwarf2.1.mm or
|
||||
libdwarf2p.1.mm and that any changes in the .mm also
|
||||
mean you inserted a version and date change
|
||||
in the date lines near the front of that .mm.
|
||||
Then regenerate the pdf if any changes.
|
||||
|
||||
Run any small preliminary tests that seem applicable.
|
||||
|
||||
In the Tests:
|
||||
|
||||
Create any new tests that seem applicable.
|
||||
Add the appropriate lines to DWARFTEST.sh which
|
||||
actually does the test running.
|
||||
|
||||
RUNALL.sh
|
||||
Runs one test of the new dwarfdump/libdwarf executable
|
||||
against the previously saved dwarfdump/libdwarf executable.
|
||||
|
||||
The notion of keeping baseline test output and simply
|
||||
comparing output of a previous release vs the new
|
||||
candiate release would involve saving some really large files.
|
||||
So the present test suite instead runs each test with
|
||||
two dwarfdump* versions and compares the output.
|
||||
|
||||
To run all the tests, most of which
|
||||
compare the (committed in tests) dwarfdump
|
||||
against your new source:
|
||||
sh PICKUPBIN # This picks up latest source and compiles
|
||||
# (for some files multiple times)
|
||||
# It is essential before each test run.
|
||||
sh RUNALL.sh # This runs the tests 3 times with different
|
||||
# dwarfdump[2] and different comparisons
|
||||
|
||||
To check for failure:
|
||||
grep FAIL ALL*
|
||||
If there are any FAILS decide if they are real failures
|
||||
(in which case fix the Source and retest) or are in fact
|
||||
the output change that is expected given the Source changes.
|
||||
|
||||
In case all tests pass:
|
||||
cp dwarfdump dwarfdump.O
|
||||
commit the updated .O executables as the new baseline good
|
||||
dwarfdump for the next test run.
|
||||
|
||||
In the Source:
|
||||
sh UPDATEDWARFDUMPVERSION.sh #updates the version string in 4 places
|
||||
update dwarfdump[2]/ChangeLog files to reflect the new version.
|
||||
commit the new version string. If this has been done recently
|
||||
enough that users won't see the current version string
|
||||
it need not be done at this time.
|
||||
|
||||
sh BLD #to verify it still builds
|
||||
git push origin master # Push to sourceforge.
|
||||
# We use 20121130 as an example below, use the current date.
|
||||
sh CPTOPUBLIC # To copy relevant Source to a temp directory
|
||||
sh BLDLIBDWARFTAR 20121130 # (use current date) to create a tar.gz
|
||||
# like libdwarf-20121130.tar.gz
|
||||
md5sum libdwarf-20121130.tar.gz
|
||||
sha512sum libdwarf-20121130.tar.gz
|
||||
# To get unforgeable checksums for the tar.gz file
|
||||
git tag -a 20121130 -m 'Release 20121130'
|
||||
git push origin 20121130 # push the tag
|
||||
|
||||
In the Tests:
|
||||
git push origin master
|
||||
git tag -a 20121130 -m 'Release 20121130'
|
||||
git push origin 20121130 # push the tag
|
||||
|
||||
Update web pages so that the new release is visble to users
|
||||
and copy the tar.gz to the appropriate web site.
|
118
dwarf-compilation.base/contrib/libdwarf/Makefile.in
Normal file
118
dwarf-compilation.base/contrib/libdwarf/Makefile.in
Normal file
|
@ -0,0 +1,118 @@
|
|||
#
|
||||
#
|
||||
# Copyright (C) 2000,2003,2004,2006 Silicon Graphics, Inc. All Rights Reserved.
|
||||
# Portions Copyright (C) 2010-2013 David B Anderson. All Rights Reserved.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify it
|
||||
# under the terms of version 2.1 of the GNU Lesser General Public License
|
||||
# as published by the Free Software Foundation.
|
||||
#
|
||||
# This program is distributed in the hope that it would be useful, but
|
||||
# WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
#
|
||||
# Further, this software is distributed without any warranty that it is
|
||||
# free of the rightful claim of any third person regarding infringement
|
||||
# or the like. Any license provided herein, whether implied or
|
||||
# otherwise, applies only to this software file. Patent licenses, if
|
||||
# any, provided herein do not apply to combinations of this program with
|
||||
# other software, or any other product whatsoever.
|
||||
#
|
||||
# You should have received a copy of the GNU Lesser General Public
|
||||
# License along with this program; if not, write the Free Software
|
||||
# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston MA 02110-1301,
|
||||
# USA.
|
||||
|
||||
#
|
||||
# Contact information: Silicon Graphics, Inc., 1500 Crittenden Lane,
|
||||
# Mountain View, CA 94043, or:
|
||||
#
|
||||
# http://www.sgi.com
|
||||
#
|
||||
# For further information regarding this notice, see:
|
||||
#
|
||||
# http://oss.sgi.com/projects/GenInfo/NoticeExplan
|
||||
#
|
||||
#
|
||||
|
||||
#
|
||||
# Makefile for libdwarf
|
||||
# This is made very simple so it should work with
|
||||
# any 'make'.
|
||||
#
|
||||
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
prefix = @prefix@
|
||||
exec_prefix = @exec_prefix@
|
||||
bindir = $(exec_prefix)/bin
|
||||
libdir = $(exec_prefix)/lib
|
||||
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
SHELL = /bin/sh
|
||||
CC = @CC@
|
||||
AR = @AR@
|
||||
# For use with BSD ar (MacOSX ar) edit the ARFLAGS to be -s
|
||||
#ARFLAGS = @ARFLAGS@
|
||||
RM = rm
|
||||
RANLIB = @RANLIB@
|
||||
DEFS = @DEFS@
|
||||
LIBS = @LIBS@
|
||||
INCLUDES = -I. -I$(srcdir)
|
||||
dwfpic = @dwfpic@
|
||||
CFLAGS = $(PREINCS) @CPPFLAGS@ @CFLAGS@ $(INCLUDES) $(dwfpic) $(POSTINCS)
|
||||
LDFLAGS = $(PRELIBS) @LDFLAGS@ $(POSTLIBS)
|
||||
|
||||
basic:
|
||||
cd libdwarf && make
|
||||
cd dwarfdump && make
|
||||
|
||||
# The dd target takes the least space and time
|
||||
# to build.
|
||||
dd:
|
||||
cd libdwarf && make
|
||||
cd dwarfdump && make
|
||||
all: basic
|
||||
cd dwarfgen && make
|
||||
cd dwarfexample && make
|
||||
|
||||
clean:
|
||||
sh ./CLEANUP
|
||||
|
||||
install: all
|
||||
echo "No install provided, see comments in the README"
|
||||
|
||||
distclean: clean
|
||||
rm -f dwarfgen/config.status
|
||||
rm -f dwarfgen/config.log
|
||||
rm -f dwarfgen/config.cache
|
||||
rm -f dwarfgen/config.h
|
||||
rm -f dwarfgen/configure.lineno
|
||||
rm -rf dwarfgen/autom4te.cache
|
||||
rm -f dwarfgen/Makefile
|
||||
rm -f dwarfdump/config.status
|
||||
rm -f dwarfdump/config.log
|
||||
rm -f dwarfdump/config.cache
|
||||
rm -f dwarfdump/config.h
|
||||
rm -rf dwarfdump/autom4te.cache
|
||||
rm -f dwarfdump/Makefile
|
||||
rm -f libdwarf/config.status
|
||||
rm -f libdwarf/config.log
|
||||
rm -f libdwarf/config.cache
|
||||
rm -f libdwarf/config.h
|
||||
rm -rf libdwarf/autom4te.cache
|
||||
rm -f libdwarf/Makefile
|
||||
rm -f config.status
|
||||
rm -f config.log
|
||||
rm -f config.cache
|
||||
rm -f config.h
|
||||
rm -rf autom4te.cache
|
||||
rm -f Makefile
|
||||
|
||||
shar:
|
||||
@echo "shar not set up"
|
||||
dist:
|
||||
@echo "dist not set up"
|
35
dwarf-compilation.base/contrib/libdwarf/NEWS
Normal file
35
dwarf-compilation.base/contrib/libdwarf/NEWS
Normal file
|
@ -0,0 +1,35 @@
|
|||
2016-11-30:
|
||||
An alternative build mechanism using cmake is now in the source tree.
|
||||
The builds for product testing continue to be done using configure && make.
|
||||
2016-09-20:
|
||||
--enable-sanitize option added to configure. This builds
|
||||
with -fsanitize=address to check for out of bounds
|
||||
memory access.
|
||||
2016-09-05:
|
||||
dwarfexample/simpleexample.c now has a simple option letting one
|
||||
extract all .debug_info, .debug_types strings into a file by
|
||||
themselves in case one wanted to examine string frequencies,
|
||||
for example.
|
||||
2016-06-01: Now we use DW_VERSION_DATE_STR for
|
||||
dates everywhere instead of __DATE__ __TIME__
|
||||
so a repeated build gets identical object output.
|
||||
DW_VERSION_DATE_STR is updated by UPDATEDWARFDUMPVERSION.sh
|
||||
wherever that string is needed.
|
||||
|
||||
2015-11-26: If DWARF section data you intend to read
|
||||
with libdwarf is compressed by zlib (a section name
|
||||
like .zdebug_info indicates such compression) libdwarf etc
|
||||
will need zlib's headers and archive or shared-library
|
||||
at build and link time. If you do not have zlib
|
||||
everything will compile fine and will work
|
||||
on ordinary DWARF sections but libdwarf will not be
|
||||
able to read .zdebug_ compressed sections.
|
||||
zlib.h is the main zlib header and libz.a is the
|
||||
most likely zlib library you will encounter.
|
||||
|
||||
2015-11-15: It is now possible to build
|
||||
outside of the source tree. See README.
|
||||
So configure.in changed a little.
|
||||
2015-01-13: Removed dwarfdump2 and references to it.
|
||||
dwarfdump has the (tsearch) features needed so the C++
|
||||
version no longer a benefit.
|
79
dwarf-compilation.base/contrib/libdwarf/README
Normal file
79
dwarf-compilation.base/contrib/libdwarf/README
Normal file
|
@ -0,0 +1,79 @@
|
|||
|
||||
A build can be done via cmake, which is
|
||||
new as of November 2016.
|
||||
mkdir /tmp/builddir
|
||||
cd /tmp/builddir
|
||||
# Assuming the source tree in /a/b/code
|
||||
cmake /a/b/code
|
||||
make
|
||||
|
||||
Standard builds are done by configure/make as
|
||||
described below.
|
||||
|
||||
BUILDING IN SOURCE TREE
|
||||
To just build libdwarf and dwarfdump
|
||||
if the source tree is in /a/b/libdwarf-1
|
||||
one might do:
|
||||
cd /a/b/libdwarf-1
|
||||
./configure
|
||||
make dd
|
||||
#You may need to be root to do the following copy commands
|
||||
cp dwarfdump/dwarfdump /usr/local/bin
|
||||
cp dwarfdump/dwarfdump.conf /usr/local/lib
|
||||
#The following is optional, not needed to run dwarfdump
|
||||
#when doing the default build.
|
||||
cp libdwarf/libdwarf.a /usr/local/lib
|
||||
|
||||
BUILDING OUT OF SOURCE TREE
|
||||
Or one could create a new directory, for example,
|
||||
mkdir /var/tmp/dwarfex
|
||||
cd /var/tmp/dwarfex
|
||||
/a/b/libdwarf-1/configure
|
||||
make dd
|
||||
In this case the source directory is not touched and
|
||||
all objects and files created are under /var/tmp/dwarfex
|
||||
|
||||
NOTE: When building out of source tree the source tree
|
||||
must be cleaned of any files created by a build
|
||||
in the source tree. This is due to the way GNU Make
|
||||
VPATH works.
|
||||
|
||||
For a simple build of libdwarf, and dwarfdump
|
||||
and the other tools:
|
||||
./configure
|
||||
make
|
||||
#Optionally: cp libdwarf/libdwarf.a <somewhere>
|
||||
|
||||
To build all the tools (including dwarfgen and
|
||||
dwarfexample) use 'make all'. There are known
|
||||
small compile-time issues with building dwarfgen on
|
||||
MaxOSX and most don't need to build dwarfgen.
|
||||
./configure
|
||||
make all
|
||||
|
||||
By default configure compiles and uses libdwarf.a.
|
||||
|
||||
With
|
||||
./configure --enabled-shared
|
||||
both libdwarf.a and libdwarf.so
|
||||
are built. The runtimes built will reference libdwarf.so.
|
||||
|
||||
With
|
||||
./configure --enabled-shared --disable-nonshared
|
||||
libdwarf.so is built and used; libdwarf.a is not built.
|
||||
|
||||
When ready to create a new source distribution do
|
||||
./CPTOPUBLIC
|
||||
./BLDLIBDWARF yyyymmdd
|
||||
where that could be
|
||||
./BLDLIBDWARF 20140131
|
||||
as an example.
|
||||
|
||||
Sanity checking:
|
||||
Recent gcc has some checks that can be done at runtime.
|
||||
-fsanitize=address
|
||||
-fsanitize=leak
|
||||
-fsanitize=undefined
|
||||
which are turned on here by --enable-sanitize at build time.
|
||||
|
||||
David Anderson. Updated November 30, 2016
|
19
dwarf-compilation.base/contrib/libdwarf/README.md
Normal file
19
dwarf-compilation.base/contrib/libdwarf/README.md
Normal file
|
@ -0,0 +1,19 @@
|
|||
[![Travis Build Status](https://travis-ci.org/dvirtz/libdwarf.svg?branch=cmake)](https://travis-ci.org/dvirtz/libdwarf)
|
||||
[![AppVeyor Build status](https://ci.appveyor.com/api/projects/status/oxh8pg7hsuav2jrl?svg=true)](https://ci.appveyor.com/project/dvirtz/libdwarf)
|
||||
|
||||
# This is README.md
|
||||
## BUILDING
|
||||
|
||||
To just build libdwarf and dwarfdump, if the source tree is in `/a/b/libdwarf-1`
|
||||
|
||||
### Using CMake
|
||||
|
||||
To build using CMake one might do
|
||||
* `cd /a/b/libdwarf-1`
|
||||
* configure: `cmake . -B_Release -DCMAKE_BUILD_TYPE=Release`
|
||||
* build: `cmake --build _Release --target dd`
|
||||
* (optionally install): `sudo cmake --build _Release --target install`
|
||||
|
||||
# for autotools builds, see README
|
||||
|
||||
|
31
dwarf-compilation.base/contrib/libdwarf/REBLDLIBDWARF
Executable file
31
dwarf-compilation.base/contrib/libdwarf/REBLDLIBDWARF
Executable file
|
@ -0,0 +1,31 @@
|
|||
#!/bin/sh
|
||||
# Assume configure done recently.
|
||||
|
||||
cd libdwarf
|
||||
if [ $? != 0 ]
|
||||
then
|
||||
echo build failed
|
||||
exit
|
||||
fi
|
||||
make
|
||||
if [ $? != 0 ]
|
||||
then
|
||||
echo build failed
|
||||
exit
|
||||
fi
|
||||
cd ..
|
||||
cd dwarfdump
|
||||
if [ $? != 0 ]
|
||||
then
|
||||
echo build failed
|
||||
exit
|
||||
fi
|
||||
# rm in case we changed libdwarf.
|
||||
rm dwarfdump
|
||||
make
|
||||
if [ $? != 0 ]
|
||||
then
|
||||
echo build failed
|
||||
exit
|
||||
fi
|
||||
cd ..
|
154
dwarf-compilation.base/contrib/libdwarf/SETUP_MASTER_TREE
Normal file
154
dwarf-compilation.base/contrib/libdwarf/SETUP_MASTER_TREE
Normal file
|
@ -0,0 +1,154 @@
|
|||
#!/bin/sh
|
||||
exit 0; #modify this before running.
|
||||
cat > tarlist.tmp <<EOF
|
||||
libdwarf2002April28.tar.gz
|
||||
libdwarf2002Oct23.tar.gz
|
||||
libdwarf2002Nov22.tar.gz
|
||||
libdwarf2003Apr06.tar.gz
|
||||
libdwarf20031002.tar.gz
|
||||
libdwarf20031006.tar.gz
|
||||
libdwarf20031230.tar.gz
|
||||
libdwarf20040102.tar.gz
|
||||
libdwarf20040203.tar.gz
|
||||
libdwarf20040315.tar.gz
|
||||
libdwarf20040507.tar.gz
|
||||
libdwarf20041011.tar.gz
|
||||
libdwarf20041026.tar.gz
|
||||
libdwarf20041027.tar.gz
|
||||
libdwarf-20041122.tar.gz
|
||||
libdwarf-20050216.tar.gz
|
||||
libdwarf-20050318.tar.gz
|
||||
libdwarf-20050503.tar.gz
|
||||
libdwarf-20050714.tar.gz
|
||||
libdwarf-20050722.tar.gz
|
||||
libdwarf-20050801.tar.gz
|
||||
libdwarf-20051003.tar.gz
|
||||
libdwarf-20051024.tar.gz
|
||||
libdwarf-20051108.tar.gz
|
||||
libdwarf-20051201.tar.gz
|
||||
libdwarf-20060224.tar.gz
|
||||
libdwarf-20060308.tar.gz
|
||||
libdwarf-20060317.tar.gz
|
||||
libdwarf-20060323.tar.gz
|
||||
libdwarf-20060327.tar.gz
|
||||
libdwarf-20060418.tar.gz
|
||||
libdwarf-20060419.tar.gz
|
||||
libdwarf-20060421.tar.gz
|
||||
libdwarf-20060428.tar.gz
|
||||
libdwarf-20060612.tar.gz
|
||||
libdwarf-20060614.tar.gz
|
||||
libdwarf-20060925.tar.gz
|
||||
libdwarf-20061108.tar.gz
|
||||
libdwarf-20061206.tar.gz
|
||||
EOF
|
||||
#cat > tarlist.tmp <<EOF
|
||||
#libdwarf2002April28.tar.gz
|
||||
#libdwarf2002Oct23.tar.gz
|
||||
#libdwarf-20061206.tar.gz
|
||||
#EOF
|
||||
|
||||
rm -rf $dm
|
||||
b=/home/davea/sgiweb3/pagedata
|
||||
dw=/home/davea/dwarf
|
||||
dwrepo=$dw/dwarf-repository
|
||||
dwwork=$dw/dwarf-working
|
||||
rm -rf $dwwork
|
||||
rm -rf $dwrepo
|
||||
mkdir $dwwork
|
||||
first=y
|
||||
checkout(){
|
||||
s=`pwd`
|
||||
cd $dwwork
|
||||
echo checkout
|
||||
svn checkout file://$dwrepo/trunk $dwwork/trunk
|
||||
cd $s
|
||||
}
|
||||
update(){
|
||||
s=`pwd`
|
||||
cd $dwwork/trunk
|
||||
svn update
|
||||
cd $s
|
||||
}
|
||||
modify(){
|
||||
origsrcname=$1
|
||||
src=$dw/dwarf
|
||||
msg=$2
|
||||
s=`pwd`
|
||||
cd $dwwork/trunk
|
||||
svn update
|
||||
cp -r $src/dwarfdump/* dwarfdump
|
||||
cp -r $src/libdwarf/* libdwarf
|
||||
find . -type f -exec chmod +w {} \;
|
||||
l=`find . -type f -print | grep -v '\.svn'`
|
||||
for i in $l
|
||||
do
|
||||
echo "svn add $i"
|
||||
svn add $i
|
||||
done
|
||||
svn commit -m $msg
|
||||
cd $s
|
||||
}
|
||||
while read linein
|
||||
do
|
||||
echo $linein
|
||||
rm -rf dwarf
|
||||
y=`echo $linein | awk -F . '{ print $1; }' `
|
||||
echo $y
|
||||
tar xzf $b/$linein
|
||||
# Only newer ones actually have a - in the name.
|
||||
t=`echo $y | awk -F - '{ print $2; }' `
|
||||
to=`echo $y | cut -c 9- `
|
||||
echo 'local variable to = ' $to
|
||||
f=dwarf
|
||||
if [ -d $f ]
|
||||
then
|
||||
echo found $f
|
||||
else
|
||||
f=$y
|
||||
if [ -d $f ]
|
||||
then
|
||||
echo found $f
|
||||
else
|
||||
f="dwarf-$t"
|
||||
echo try $t $f
|
||||
if [ -d $f ]
|
||||
then
|
||||
echo found $f
|
||||
else
|
||||
f=dwarf$to
|
||||
echo try $y $f
|
||||
if [ -d $f ]
|
||||
then
|
||||
echo found $f
|
||||
else
|
||||
echo "cannot find dwarf expansion"
|
||||
continue
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
echo $f
|
||||
ls $f
|
||||
if [ $f != "dwarf" ]
|
||||
then
|
||||
echo "switch name from $f to dwarf"
|
||||
mv $f dwarf
|
||||
fi
|
||||
if [ $first = "y" ]
|
||||
then
|
||||
svnadmin create $dwrepo
|
||||
svn import dwarf file://$dwrepo/trunk -m "$y"
|
||||
first="n"
|
||||
checkout
|
||||
cd $dw
|
||||
else
|
||||
echo existing repository update `pwd`
|
||||
update
|
||||
modify $f $y
|
||||
echo existing repository checkout done `pwd`
|
||||
fi
|
||||
echo rm -rf dwarf $y
|
||||
rm -rf dwarf
|
||||
rm -rf $y
|
||||
done <tarlist.tmp
|
||||
|
34
dwarf-compilation.base/contrib/libdwarf/SMBLDLIBDWARF
Executable file
34
dwarf-compilation.base/contrib/libdwarf/SMBLDLIBDWARF
Executable file
|
@ -0,0 +1,34 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
|
||||
cd libdwarf
|
||||
touch *.c
|
||||
CFLAGS="-g -O0 -DDWARF_SIMPLE_MALLOC" ./configure
|
||||
if [ $? != 0 ]
|
||||
then
|
||||
echo build failed
|
||||
exit
|
||||
fi
|
||||
make
|
||||
if [ $? != 0 ]
|
||||
then
|
||||
echo build failed
|
||||
exit
|
||||
fi
|
||||
cd ..
|
||||
cd dwarfdump
|
||||
rm dwarfdump
|
||||
touch *.c
|
||||
CFLAGS="-g -O0" ./configure
|
||||
if [ $? != 0 ]
|
||||
then
|
||||
echo build failed
|
||||
exit
|
||||
fi
|
||||
make
|
||||
if [ $? != 0 ]
|
||||
then
|
||||
echo build failed
|
||||
exit
|
||||
fi
|
||||
cd ..
|
11
dwarf-compilation.base/contrib/libdwarf/UPD.awk
Normal file
11
dwarf-compilation.base/contrib/libdwarf/UPD.awk
Normal file
|
@ -0,0 +1,11 @@
|
|||
BEGIN {
|
||||
if (ARGC <= 2) {
|
||||
print "Bogus use of awk file, requires arg"
|
||||
exit 1
|
||||
} else {
|
||||
v=ARGV[1]
|
||||
ARGV[1]=""
|
||||
}
|
||||
}
|
||||
$0 ~ /#define DW_VERSION_DATE_STR/ { print $1, $2, "\"",v,"\"" }
|
||||
$0 !~ /^#define DW_VERSION_DATE_STR/ { print $0 }
|
|
@ -0,0 +1,25 @@
|
|||
# Do not turn on -x here. it will screw things up!
|
||||
x=`date --rfc-3339=seconds |tr '\n' ' '`
|
||||
cat > UPD.awk <<\EOF
|
||||
BEGIN {
|
||||
if (ARGC <= 2) {
|
||||
print "Bogus use of awk file, requires arg"
|
||||
exit 1
|
||||
} else {
|
||||
v=ARGV[1]
|
||||
ARGV[1]=""
|
||||
}
|
||||
}
|
||||
$0 ~ /#define DW_VERSION_DATE_STR/ { print $1, $2, "\"",v,"\"" }
|
||||
$0 !~ /^#define DW_VERSION_DATE_STR/ { print $0 }
|
||||
EOF
|
||||
awk -f UPD.awk "$x" dwarfdump/dwarfdump.c >t
|
||||
mv t dwarfdump/dwarfdump.c
|
||||
awk -f UPD.awk "$x" dwarfdump/common.c >t
|
||||
mv t dwarfdump/common.c
|
||||
awk -f UPD.awk "$x" dwarfdump/tag_attr.c >t
|
||||
mv t dwarfdump/tag_attr.c
|
||||
awk -f UPD.awk "$x" dwarfdump/tag_tree.c >t
|
||||
mv t dwarfdump/tag_tree.c
|
||||
awk -f UPD.awk "$x" libdwarf/gennames.c >t
|
||||
mv t libdwarf/gennames.c
|
41
dwarf-compilation.base/contrib/libdwarf/appveyor.yml
Normal file
41
dwarf-compilation.base/contrib/libdwarf/appveyor.yml
Normal file
|
@ -0,0 +1,41 @@
|
|||
environment:
|
||||
global:
|
||||
LIBELF_INSTALL_PREFIX: "C:/libelf"
|
||||
matrix:
|
||||
- platform: Win32
|
||||
CMAKE_GENERATOR_NAME: "Visual Studio 14 2015"
|
||||
CMAKE_OPTIONS: ""
|
||||
- platform: Win32
|
||||
CMAKE_GENERATOR_NAME: "Visual Studio 14 2015"
|
||||
CMAKE_OPTIONS: "-Dshared=ON"
|
||||
- platform: Win32
|
||||
CMAKE_GENERATOR_NAME: "Visual Studio 14 2015"
|
||||
CMAKE_OPTIONS: "-Dshared=ON nonshared=OFF"
|
||||
- platform: x64
|
||||
CMAKE_GENERATOR_NAME: "Visual Studio 14 2015 Win64"
|
||||
CMAKE_OPTIONS: ""
|
||||
- platform: x64
|
||||
CMAKE_GENERATOR_NAME: "Visual Studio 14 2015 Win64"
|
||||
CMAKE_OPTIONS: "-Dshared=ON"
|
||||
- platform: x64
|
||||
CMAKE_GENERATOR_NAME: "Visual Studio 14 2015 Win64"
|
||||
CMAKE_OPTIONS: "-Dshared=ON nonshared=OFF"
|
||||
|
||||
configuration: Release
|
||||
|
||||
install:
|
||||
- git clone https://github.com/dvirtz/libelf.git
|
||||
- cd libelf
|
||||
- git checkout cmake
|
||||
- cmake . -B_build -G "%CMAKE_GENERATOR_NAME%" -DCMAKE_INSTALL_PREFIX=%LIBELF_INSTALL_PREFIX%
|
||||
- cmake --build _build --config %CONFIGURATION%
|
||||
- cmake --build _build --config %CONFIGURATION% --target INSTALL
|
||||
- cd ..
|
||||
|
||||
build_script:
|
||||
- cmake . -B_build -G "%CMAKE_GENERATOR_NAME%" -DLIBELF_ROOT=%LIBELF_INSTALL_PREFIX% %OPTIONS%
|
||||
- cmake --build _build --config %CONFIGURATION%
|
||||
|
||||
test_script:
|
||||
- cmake --build _build --config %CONFIGURATION% --target RUN_TESTS
|
||||
|
18
dwarf-compilation.base/contrib/libdwarf/bugxml/README
Normal file
18
dwarf-compilation.base/contrib/libdwarf/bugxml/README
Normal file
|
@ -0,0 +1,18 @@
|
|||
|
||||
The files here are for maintaining a list of bugs
|
||||
fixed so html and xml can be posted to prevanders.net
|
||||
and CVE (see cert.org) issues can reference a public
|
||||
database.
|
||||
|
||||
This is intended mainly for bugs that can result in
|
||||
application crashes as such can represent a vulnerability
|
||||
that can be exploited.
|
||||
Bugs that result simply in errors in output (but no crash)
|
||||
will typically not be mentioned.
|
||||
|
||||
Bugs in dwarfdump are not vulnerabilities in the same way
|
||||
and at present these do not get CVE identifiers.
|
||||
|
||||
David Anderson
|
||||
Created: 2016-05-03.
|
||||
Updated: 2017-07-06.
|
328
dwarf-compilation.base/contrib/libdwarf/bugxml/bugrecord.py
Executable file
328
dwarf-compilation.base/contrib/libdwarf/bugxml/bugrecord.py
Executable file
|
@ -0,0 +1,328 @@
|
|||
#!/usr/bin/python3
|
||||
# Copyright (c) 2016-2016 David Anderson.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
# * Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# * Neither the name of the example nor the
|
||||
# names of its contributors may be used to endorse or promote products
|
||||
# derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY David Anderson ''AS IS'' AND ANY
|
||||
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
# DISCLAIMED. IN NO EVENT SHALL David Anderson BE LIABLE FOR ANY
|
||||
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||
# OF SUCH DAMAGE.
|
||||
|
||||
|
||||
import sys
|
||||
|
||||
# Use only <pre> or </pre> all by itself in data.xml.
|
||||
# No other data on either of such lines.
|
||||
# All the lines between these two markers should be
|
||||
# shown in individual lines.
|
||||
def xmlize(linea,inhtml,inpre):
|
||||
outi = []
|
||||
l = linea
|
||||
if l.find("<pre>") != -1:
|
||||
if inhtml == 'y':
|
||||
s2 = '</p>' +l + '\n'
|
||||
else:
|
||||
s2 = l + '\n'
|
||||
inpre = 'y'
|
||||
return s2,inpre
|
||||
if l.find("</pre>") != -1:
|
||||
if inhtml == 'y':
|
||||
s2 = l + '\n' + "<p>"
|
||||
else:
|
||||
s2 = l + '\n'
|
||||
inpre = 'n'
|
||||
return s2, inpre
|
||||
if inpre == 'y' and inhtml == 'n':
|
||||
outi += ["<preline>"]
|
||||
for c in l:
|
||||
if c == '<':
|
||||
outi += ["<"]
|
||||
elif c == '>':
|
||||
outi += [">"]
|
||||
elif c == "&":
|
||||
outi += ["&"]
|
||||
#elif c == "'":
|
||||
# outi += ["'"]
|
||||
elif c == '"':
|
||||
outi += ["""]
|
||||
else:
|
||||
outi += [c]
|
||||
if inpre == 'y' and inhtml == 'n':
|
||||
outi += ["</preline>"]
|
||||
outi += ["\n"]
|
||||
s2 = ''.join(outi)
|
||||
return s2,inpre
|
||||
|
||||
def paraline(name,linea):
|
||||
inpre = 'n'
|
||||
out = ''
|
||||
if len(linea) <1:
|
||||
out = "<p>" + name + ":"+ "</p>"
|
||||
return out
|
||||
out = "<p>" + name + ": "
|
||||
out +=linea
|
||||
out += "</p>"
|
||||
return out;
|
||||
|
||||
def paralines(name,lines):
|
||||
inpre = 'n'
|
||||
if len(lines) <1:
|
||||
out = "<p>" + name + ":"+ "</p>"
|
||||
return out
|
||||
out = "<p>" + name + ": "
|
||||
for lin in lines:
|
||||
f,inpre = xmlize(lin,'y',inpre)
|
||||
out += f
|
||||
out += "</p>"
|
||||
return out;
|
||||
|
||||
def para(name,str):
|
||||
if str == None:
|
||||
out = "<p>" + name + ":"+ "</p>"
|
||||
elif len(str) > 0:
|
||||
out = "<p>" + name + ": " + str + "</p>"
|
||||
else:
|
||||
out = "<p>" + name + ":"+ "</p>"
|
||||
return out
|
||||
|
||||
|
||||
class bugrecord:
|
||||
|
||||
def __init__(self,dwid):
|
||||
self._id= dwid.strip()
|
||||
self._cve = ''
|
||||
self._datereported = ''
|
||||
self._reportedby = ''
|
||||
self._vulnerability = []
|
||||
self._product = ''
|
||||
self._description = []
|
||||
self._datefixed = ''
|
||||
self._references = []
|
||||
self._gitfixid = ''
|
||||
self._tarrelease = ''
|
||||
|
||||
def setcve(self,pubid):
|
||||
if self._cve != '':
|
||||
print("Duplicate cve ",self._cve,pubid)
|
||||
sys.exit(1)
|
||||
self._cve = pubid.strip()
|
||||
def setdatereported(self,rep):
|
||||
if self._datereported != '':
|
||||
print("Duplicate datereported ",self._datereported,rep)
|
||||
sys.exit(1)
|
||||
self._datereported = rep.strip()
|
||||
def setreportedby(self,rep):
|
||||
if self._reportedby != '':
|
||||
print("Duplicate reportedby ",self._reportedby,rep)
|
||||
sys.exit(1)
|
||||
self._reportedby = rep.strip()
|
||||
def setvulnerability(self,vuln):
|
||||
if len(self._vulnerability) != 0:
|
||||
print("Duplicate vulnerability ",self._vulnerability,vuln)
|
||||
sys.exit(1)
|
||||
self._vulnerability = vuln
|
||||
def setproduct(self,p):
|
||||
if len(self._product) != 0:
|
||||
print("Duplicate product ",self._product,p)
|
||||
sys.exit(1)
|
||||
self._product = p.strip()
|
||||
def setdescription(self,d):
|
||||
if len(self._description) != 0:
|
||||
print("Duplicate description ",self._description,d)
|
||||
sys.exit(1)
|
||||
self._description = d
|
||||
def setdatefixed(self,d):
|
||||
if len(self._datefixed) != 0:
|
||||
print("Duplicate datefixed ",self._datefixed,d)
|
||||
sys.exit(1)
|
||||
self._datefixed = d.strip()
|
||||
def setreferences(self,r):
|
||||
if len(self._references) != 0:
|
||||
print("Duplicate references ",self._references,r)
|
||||
sys.exit(1)
|
||||
self._references = r
|
||||
def setgitfixid(self,g):
|
||||
if len(self._gitfixid) != 0:
|
||||
print("Duplicate gitfixid ",self._gitfixid,g)
|
||||
sys.exit(1)
|
||||
self._gitfixid = g.strip()
|
||||
def settarrelease(self,g):
|
||||
if len(self._tarrelease) != 0:
|
||||
print("Duplicate tarrelease ",self._tarrelease,g)
|
||||
sys.exit(1)
|
||||
self._tarrelease = g.strip()
|
||||
def plist(self,title,lines):
|
||||
if lines == None:
|
||||
print(title)
|
||||
return
|
||||
if len(lines) == 1:
|
||||
print(title,lines[0])
|
||||
return
|
||||
print(title)
|
||||
for l in lines:
|
||||
print(l)
|
||||
|
||||
def printbug(self):
|
||||
print("")
|
||||
print("id:",self._id)
|
||||
print("cve:",self._cve)
|
||||
print("datereported:",self._datereported)
|
||||
print("reportedby:",self._reportedby)
|
||||
self.plist("vulnerability:",self._vulnerability)
|
||||
print("product:",self._product)
|
||||
self.plist("description:",self._description)
|
||||
print("datefixed:",self._datefixed)
|
||||
self.plist("references:",self._references)
|
||||
print("gitfixid:",self._gitfixid)
|
||||
print("tarrelease:",self._tarrelease)
|
||||
|
||||
def generate_html(self):
|
||||
s5= ''.join(self._id)
|
||||
t = ''.join(['<h3 id="',s5,'">',self._id,'</h3>'])
|
||||
txt = [t]
|
||||
|
||||
inpre = 'n'
|
||||
s,inp= xmlize(self._id,'y',inpre)
|
||||
t = paraline("id",s)
|
||||
txt += [t]
|
||||
s,inp= xmlize(self._cve,'y',inpre)
|
||||
t = paraline("cve",s)
|
||||
txt += [t]
|
||||
|
||||
s,inp= xmlize(self._datereported,'y',inpre)
|
||||
t = paraline("datereported",s)
|
||||
txt += [t]
|
||||
|
||||
s,inp= xmlize(self._reportedby,'y',inpre)
|
||||
t = paraline("reportedby",s)
|
||||
txt += [t]
|
||||
|
||||
#MULTI
|
||||
t = paralines("vulnerability",self._vulnerability)
|
||||
txt += [t]
|
||||
|
||||
|
||||
s,inp= xmlize(self._product,'y',inpre)
|
||||
t = paraline("product",s)
|
||||
txt += [t]
|
||||
|
||||
#MULTI
|
||||
t = paralines("description",self._description)
|
||||
txt += [t]
|
||||
|
||||
s,inp= xmlize(self._datefixed,'y',inpre)
|
||||
t = paraline("datefixed",s)
|
||||
txt += [t]
|
||||
|
||||
#MULTI
|
||||
t = paralines("references",self._references)
|
||||
txt += [t]
|
||||
|
||||
s,inp= xmlize(self._gitfixid,'y',inpre)
|
||||
t = paraline("gitfixid",s)
|
||||
txt += [t]
|
||||
|
||||
s,inp= xmlize(self._tarrelease,'y',inpre)
|
||||
t = paraline("tarrelease",s)
|
||||
txt += [t]
|
||||
|
||||
t = '<p> <a href="#top">[top]</a> </p>'
|
||||
txt += [t]
|
||||
return txt
|
||||
|
||||
def paraxml(self,start,main,term):
|
||||
# For single line xml remove the newline from the main text line.
|
||||
out = start
|
||||
l=main.strip()
|
||||
if len(l) > 0:
|
||||
out += l
|
||||
out += term + "\n"
|
||||
return out
|
||||
def paraxmlN(self,start,main,term):
|
||||
# For multi line xml leave newlines present.
|
||||
out = start
|
||||
inpre = 'n'
|
||||
for x in main:
|
||||
l=x.rstrip()
|
||||
t,inpre = xmlize(l,'n',inpre);
|
||||
if len(t) > 0:
|
||||
out += t
|
||||
out += term + "\n"
|
||||
return out
|
||||
|
||||
|
||||
def generate_xml(self):
|
||||
txt=[]
|
||||
t = '<dwbug>'
|
||||
txt += [t]
|
||||
|
||||
inpre = 'n'
|
||||
s,inpre= xmlize(self._id,'n',inpre)
|
||||
s = self.paraxml('<dwid>',s,'</dwid>')
|
||||
|
||||
s,inpre= xmlize(self._cve,'n',inpre)
|
||||
t = self.paraxml('<cve>',s,'</cve>')
|
||||
txt += [t]
|
||||
|
||||
s,inpre= xmlize(self._datereported,'n',inpre)
|
||||
t = self.paraxml('<datereported>',s,'</datereported>')
|
||||
txt += [t];
|
||||
|
||||
s,inpre= xmlize(self._reportedby,'n',inpre)
|
||||
t = self.paraxml('<reportedby>',s,'</reportedby>')
|
||||
txt += [t];
|
||||
|
||||
s,inpre= xmlize(self._product,'n',inpre)
|
||||
t = self.paraxml('<product>',s,'</product>')
|
||||
txt += [t];
|
||||
|
||||
|
||||
#MULTI
|
||||
p = self._vulnerability
|
||||
t = self.paraxmlN("<vulnerability>",p,"</vulnerability>")
|
||||
txt += [t]
|
||||
|
||||
|
||||
#MULTI
|
||||
p = self._description
|
||||
t = self.paraxmlN("<description>",p,"</description>")
|
||||
txt += [t]
|
||||
|
||||
|
||||
s,inpre= xmlize(self._datefixed,'n',inpre)
|
||||
t = self.paraxml('<datefixed>',s,'</datefixed>')
|
||||
txt += [t];
|
||||
|
||||
#MULTI
|
||||
p = self._references
|
||||
t = self.paraxmlN("<references>",p,"</references>")
|
||||
txt += [t]
|
||||
|
||||
s,inpre= xmlize(self._gitfixid,'n',inpre)
|
||||
t = self.paraxml('<gitfixid>',s,'</gitfixid>')
|
||||
txt += [t];
|
||||
|
||||
s,inpre= xmlize(self._tarrelease,'n',inpre)
|
||||
t = self.paraxml('<tarrelease>',s,'</tarrelease>')
|
||||
txt += [t];
|
||||
|
||||
t = '</dwbug>'
|
||||
txt += [t];
|
||||
return txt
|
14
dwarf-compilation.base/contrib/libdwarf/bugxml/data.template
Normal file
14
dwarf-compilation.base/contrib/libdwarf/bugxml/data.template
Normal file
|
@ -0,0 +1,14 @@
|
|||
id:
|
||||
cve:
|
||||
datereported:
|
||||
reportedby:
|
||||
vulnerability:
|
||||
product:
|
||||
description:
|
||||
datefixed:
|
||||
references:
|
||||
gitfixid:
|
||||
endrec:
|
||||
|
||||
|
||||
|
1232
dwarf-compilation.base/contrib/libdwarf/bugxml/data.txt
Normal file
1232
dwarf-compilation.base/contrib/libdwarf/bugxml/data.txt
Normal file
File diff suppressed because it is too large
Load diff
257
dwarf-compilation.base/contrib/libdwarf/bugxml/readbugs.py
Executable file
257
dwarf-compilation.base/contrib/libdwarf/bugxml/readbugs.py
Executable file
|
@ -0,0 +1,257 @@
|
|||
#!/usr/bin/python3
|
||||
# Copyright (c) 2016-2016 David Anderson.
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
# * Redistributions of source code must retain the above copyright
|
||||
# notice, this list of conditions and the following disclaimer.
|
||||
# * Redistributions in binary form must reproduce the above copyright
|
||||
# notice, this list of conditions and the following disclaimer in the
|
||||
# documentation and/or other materials provided with the distribution.
|
||||
# * Neither the name of the example nor the
|
||||
# names of its contributors may be used to endorse or promote products
|
||||
# derived from this software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY David Anderson ''AS IS'' AND ANY
|
||||
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
# DISCLAIMED. IN NO EVENT SHALL David Anderson BE LIABLE FOR ANY
|
||||
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
|
||||
# OF SUCH DAMAGE.
|
||||
|
||||
import os
|
||||
import sys
|
||||
sys.path.append(os.path.abspath("/home/davea/dwarf/code/bugxml"))
|
||||
import bugrecord
|
||||
|
||||
def ignore_this_line(d,inrecord):
|
||||
if len(d) < 1:
|
||||
if inrecord == "y":
|
||||
return "n"
|
||||
else:
|
||||
return "y"
|
||||
s = str(d)
|
||||
if s[0] == '#':
|
||||
return "y"
|
||||
return "n"
|
||||
|
||||
def closeouttext(bugrec,intext,text,linecount):
|
||||
if intext == 'd':
|
||||
bugrec.setdescription(text)
|
||||
return
|
||||
elif intext == 'v':
|
||||
bugrec.setvulnerability(text)
|
||||
return
|
||||
elif intext == 'r':
|
||||
bugrec.setreferences(text)
|
||||
return
|
||||
if intext == "":
|
||||
return
|
||||
print("bogus closeout line at line ",linecount)
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
def readbugs(iname):
|
||||
name = iname
|
||||
if len(name) == 0:
|
||||
name = "/home/davea/dwarf/code/bugxml/data.txt"
|
||||
try:
|
||||
file = open(name,"r")
|
||||
except IOError as message:
|
||||
print("failed to open ",name, message)
|
||||
|
||||
inrecord = "n"
|
||||
linecount = 0
|
||||
text = []
|
||||
usedid ={}
|
||||
intext = ''
|
||||
bugrec = ''
|
||||
buglist = []
|
||||
while 1:
|
||||
try:
|
||||
rec = file.readline()
|
||||
except EOFError:
|
||||
break
|
||||
if len(rec) < 1:
|
||||
# eof
|
||||
break
|
||||
linecount += 1
|
||||
if ignore_this_line(rec,inrecord) == "y":
|
||||
continue
|
||||
rec = rec.rstrip()
|
||||
if inrecord == "n":
|
||||
if len(rec) == 0:
|
||||
continue
|
||||
if rec.find(":") == -1:
|
||||
print("bogus non-blank line at line ",linecount)
|
||||
sys.exit(1)
|
||||
if inrecord == "y" and len(rec) > 0:
|
||||
# A multi line entry may have ":" in it.
|
||||
if intext != "" and rec[0] == ' ':
|
||||
s3 = ''.join(rec)
|
||||
text += [s3]
|
||||
continue
|
||||
low = rec.find(":")
|
||||
fldname = rec[0:low+1]
|
||||
fldval = rec[low+1:]
|
||||
if fldname == "id:":
|
||||
if inrecord == "y":
|
||||
print("bogus id: at line ",linecount)
|
||||
sys.exit(1)
|
||||
inrecord = "y"
|
||||
f = fldval.strip()
|
||||
if f in usedid:
|
||||
print("Duplicate Key:",f,"Giving up.")
|
||||
sys.exit(1)
|
||||
usedid[f] = 1
|
||||
s4= ''.join(fldval)
|
||||
bugrec = bugrecord.bugrecord(s4)
|
||||
elif fldname == "cve:":
|
||||
closeouttext(bugrec,intext,text,linecount),
|
||||
intext = ""
|
||||
text = []
|
||||
s4= ''.join(fldval)
|
||||
bugrec.setcve(s4)
|
||||
elif fldname == "datereported:":
|
||||
closeouttext(bugrec,intext,text,linecount),
|
||||
intext = ""
|
||||
text = []
|
||||
s4= ''.join(fldval)
|
||||
bugrec.setdatereported(s4)
|
||||
elif fldname == "reportedby:":
|
||||
closeouttext(bugrec,intext,text,linecount),
|
||||
intext = ""
|
||||
text = []
|
||||
s4= ''.join(fldval)
|
||||
bugrec.setreportedby(s4)
|
||||
elif fldname == "vulnerability:":
|
||||
closeouttext(bugrec,intext,text,linecount),
|
||||
intext = 'v'
|
||||
text = []
|
||||
if len(fldval) > 0:
|
||||
s4= ''.join(fldval)
|
||||
text = [s4]
|
||||
|
||||
elif fldname == "product:":
|
||||
closeouttext(bugrec,intext,text,linecount),
|
||||
intext = ""
|
||||
text = []
|
||||
s4= ''.join(fldval)
|
||||
bugrec.setproduct(s4)
|
||||
elif fldname == "description:":
|
||||
closeouttext(bugrec,intext,text,linecount),
|
||||
text = []
|
||||
intext = 'd'
|
||||
if len(fldval) > 0:
|
||||
s4= ''.join(fldval)
|
||||
text = [s4]
|
||||
|
||||
elif fldname == "datefixed:":
|
||||
closeouttext(bugrec,intext,text,linecount),
|
||||
text = []
|
||||
intext = ""
|
||||
s4= ''.join(fldval)
|
||||
bugrec.setdatefixed(s4)
|
||||
elif fldname == "references:":
|
||||
closeouttext(bugrec,intext,text,linecount),
|
||||
text = []
|
||||
intext = 'r'
|
||||
if len(fldval) > 0:
|
||||
s4= ''.join(fldval)
|
||||
text = [s4]
|
||||
elif fldname == "gitfixid:":
|
||||
closeouttext(bugrec,intext,text,linecount),
|
||||
text = []
|
||||
intext = ""
|
||||
s4= ''.join(fldval)
|
||||
bugrec.setgitfixid(s4)
|
||||
elif fldname == "tarrelease:":
|
||||
closeouttext(bugrec,intext,text,linecount),
|
||||
text = []
|
||||
intext = ""
|
||||
s4= ''.join(fldval)
|
||||
bugrec.settarrelease(s4)
|
||||
elif fldname == "endrec:":
|
||||
closeouttext(bugrec,intext,text,linecount),
|
||||
text = []
|
||||
if inrecord == "n":
|
||||
print("bogus endrec: at line ",linecount)
|
||||
sys.exit(1)
|
||||
buglist += [bugrec]
|
||||
inrecord = "n"
|
||||
text = []
|
||||
intext = ""
|
||||
inrecord = "n"
|
||||
file.close()
|
||||
return buglist
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
def sort_by_id(myl):
|
||||
""" Sort the list of objects by name. """
|
||||
auxiliary = [ ( x._id, x) for x in myl ]
|
||||
auxiliary.sort()
|
||||
return [ x[1] for x in auxiliary ]
|
||||
|
||||
|
||||
def write_line(file,l):
|
||||
file.write(l + "\n")
|
||||
|
||||
def write_all_lines(file,txt):
|
||||
for t in txt:
|
||||
write_line(file,t)
|
||||
|
||||
def generatehtml(list2,name):
|
||||
try:
|
||||
file = open(name,"w")
|
||||
except IOError as message:
|
||||
print("failed to open ",name, message)
|
||||
sys.exit(1)
|
||||
for b in list2:
|
||||
txt=b.generate_html()
|
||||
write_all_lines(file,txt)
|
||||
write_line(file,"</body>")
|
||||
write_line(file,"</html>")
|
||||
file.close()
|
||||
|
||||
def generatexml(list2,name):
|
||||
try:
|
||||
file = open(name,"w")
|
||||
except IOError as message:
|
||||
print("failed to open ",name, message)
|
||||
sys.exit(1)
|
||||
t = '<?xml version="1.0" encoding="us-ascii"?>'
|
||||
write_line(file,t)
|
||||
write_line(file,"<dwarfbug>")
|
||||
for b in list2:
|
||||
txt=b.generate_xml()
|
||||
write_all_lines(file,txt)
|
||||
write_line(file,"</dwarfbug>")
|
||||
file.close()
|
||||
|
||||
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
list = readbugs("")
|
||||
list2 = sort_by_id(list)
|
||||
list2.reverse()
|
||||
#for b in list2:
|
||||
# b.printbug()
|
||||
|
||||
generatehtml(list2,"./dwarfbugtail")
|
||||
generatexml(list2,"./dwarfbuglohi.xml")
|
||||
|
||||
list2.reverse()
|
||||
generatehtml(list2,"./dwarfbuglohitail")
|
||||
|
|
@ -0,0 +1,383 @@
|
|||
# Helper functions for translating autoconf projects. Several functions
|
||||
# are lifted from the Mono sources
|
||||
|
||||
include (CheckCSourceCompiles)
|
||||
include (CheckIncludeFile)
|
||||
include (TestBigEndian)
|
||||
include (CheckFunctionExists)
|
||||
include (CheckTypeSize)
|
||||
include (CheckCSourceRuns)
|
||||
|
||||
|
||||
# Function to get the version information from the configure.ac file in the
|
||||
# current directory. Its argument is the name of the library as passed to
|
||||
# AC_INIT. It will set the variables ${LIBNAME}_VERSION and ${LIBNAME}_SOVERSION
|
||||
function (ac_get_version libname)
|
||||
string(TOUPPER "${libname}" libname_upper)
|
||||
|
||||
# Read the relevant content from configure.ac
|
||||
file (STRINGS configure.ac tmp_configure_ac
|
||||
REGEX "${libname_upper}_[_A-Z]+=[ \\t]*[0-9]+")
|
||||
|
||||
# Product version
|
||||
string (REGEX REPLACE ".+MAJOR[_A-Z]+=([0-9]+).+MINOR[_A-Z]+=([0-9]+).+MICRO[_A-Z]+=([0-9]+).*"
|
||||
"\\1.\\2.\\3" ${libname_upper}_VERSION "${tmp_configure_ac}")
|
||||
|
||||
# Library version for libtool
|
||||
string (REGEX REPLACE ".+CURRENT=([0-9]+).+REVISION=([0-9]+).+AGE=([0-9]+).*"
|
||||
"\\1.\\2.\\3" ${libname_upper}_SOVERSION "${tmp_configure_ac}")
|
||||
|
||||
# Checks if the string needs to be displayed
|
||||
set (${libname_upper}_DISPLAYSTR_AUX
|
||||
"Found ${libname} version ${${libname_upper}_VERSION}, soversion ${${libname_upper}_SOVERSION} from configure.ac"
|
||||
)
|
||||
if ((NOT ${libname_upper}_DISPLAYSTR) OR (NOT ${libname_upper}_DISPLAYSTR STREQUAL ${libname_upper}_DISPLAYSTR_AUX))
|
||||
set (${libname_upper}_DISPLAYSTR ${${libname_upper}_DISPLAYSTR_AUX}
|
||||
CACHE INTERNAL "Version string from ${libname}" FORCE)
|
||||
message (STATUS ${${libname_upper}_DISPLAYSTR})
|
||||
endif ()
|
||||
|
||||
# Export the result to the caller
|
||||
set(${libname_upper}_VERSION "${${libname_upper}_VERSION}" PARENT_SCOPE)
|
||||
set(${libname_upper}_SOVERSION "${${libname_upper}_SOVERSION}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
|
||||
# Also from mono's source code
|
||||
# Implementation of AC_CHECK_HEADERS
|
||||
# In addition, it also records the list of variables in the variable
|
||||
# 'autoheader_vars', and for each variable, a documentation string in the
|
||||
# variable ${var}_doc
|
||||
function(ac_check_headers)
|
||||
foreach (header ${ARGV})
|
||||
string(TOUPPER ${header} header_var)
|
||||
string(REPLACE "." "_" header_var ${header_var})
|
||||
string(REPLACE "/" "_" header_var ${header_var})
|
||||
set(header_var "HAVE_${header_var}")
|
||||
check_include_file (${header} ${header_var})
|
||||
set("${header_var}_doc" "Define to 1 if you have the <${header}> header file." PARENT_SCOPE)
|
||||
if (${header_var})
|
||||
set("${header_var}_defined" "1" PARENT_SCOPE)
|
||||
endif()
|
||||
set("${header_var}_val" "1" PARENT_SCOPE)
|
||||
set (autoheader_vars ${autoheader_vars} ${header_var})
|
||||
endforeach()
|
||||
set (autoheader_vars ${autoheader_vars} PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
# Function taken from mono's source code
|
||||
function (ac_check_funcs)
|
||||
foreach (func ${ARGV})
|
||||
string(TOUPPER ${func} var)
|
||||
set(var "HAVE_${var}")
|
||||
set(${var})
|
||||
check_function_exists (${func} ${var})
|
||||
set("${var}_doc" "Define to 1 if you have the '${func}' function." PARENT_SCOPE)
|
||||
if (${var})
|
||||
set("${var}_defined" "1" PARENT_SCOPE)
|
||||
set(${var} yes PARENT_SCOPE)
|
||||
endif()
|
||||
set("${var}_val" "1" PARENT_SCOPE)
|
||||
set (autoheader_vars ${autoheader_vars} ${var})
|
||||
endforeach()
|
||||
set (autoheader_vars ${autoheader_vars} PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
|
||||
# Specifically, this macro checks for stdlib.h', stdarg.h',
|
||||
# string.h', and float.h'; if the system has those, it probably
|
||||
# has the rest of the ANSI C header files. This macro also checks
|
||||
# whether string.h' declares memchr' (and thus presumably the
|
||||
# other mem' functions), whether stdlib.h' declare free' (and
|
||||
# thus presumably malloc' and other related functions), and whether
|
||||
# the ctype.h' macros work on characters with the high bit set, as
|
||||
# ANSI C requires.
|
||||
function (ac_header_stdc)
|
||||
if (STDC_HEADERS)
|
||||
return()
|
||||
endif()
|
||||
message(STATUS "Looking for ANSI-C headers")
|
||||
set(code "
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
#include <float.h>
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
void *ptr;
|
||||
free((void*)1);
|
||||
ptr = memchr((void*)1, 0, 0);
|
||||
|
||||
return (int)ptr;
|
||||
}
|
||||
")
|
||||
# FIXME Check the ctype.h high bit
|
||||
CHECK_C_SOURCE_COMPILES("${code}" STDC_HEADERS)
|
||||
if (STDC_HEADERS)
|
||||
set(STDC_HEADERS 1 PARENT_SCOPE)
|
||||
message(STATUS "Looking for ANSI-C headers - found")
|
||||
else()
|
||||
message(STATUS "Looking for ANSI-C headers - not found")
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
|
||||
# Also from the mono sources, kind of implements AC_SYS_LARGEFILE
|
||||
function (ac_sys_largefile)
|
||||
CHECK_C_SOURCE_RUNS("
|
||||
#include <sys/types.h>
|
||||
#define BIG_OFF_T (((off_t)1<<62)-1+((off_t)1<<62))
|
||||
int main (int argc, char **argv) {
|
||||
int big_off_t=((BIG_OFF_T%2147483629==721) &&
|
||||
(BIG_OFF_T%2147483647==1));
|
||||
return big_off ? 0 : 1;
|
||||
}
|
||||
" HAVE_LARGE_FILE_SUPPORT)
|
||||
|
||||
# Check if it makes sense to define _LARGE_FILES or _FILE_OFFSET_BITS
|
||||
if (HAVE_LARGE_FILE_SUPPORT)
|
||||
return()
|
||||
endif()
|
||||
|
||||
set (_LARGE_FILE_EXTRA_SRC "
|
||||
#include <sys/types.h>
|
||||
int main (int argc, char **argv) {
|
||||
return sizeof(off_t) == 8 ? 0 : 1;
|
||||
}
|
||||
")
|
||||
CHECK_C_SOURCE_RUNS ("#define _LARGE_FILES\n${_LARGE_FILE_EXTRA_SRC}"
|
||||
HAVE_USEFUL_D_LARGE_FILES)
|
||||
if (NOT HAVE_USEFUL_D_LARGE_FILES)
|
||||
if (NOT DEFINED HAVE_USEFUL_D_FILE_OFFSET_BITS)
|
||||
set (SHOW_LARGE_FILE_WARNING TRUE)
|
||||
endif ()
|
||||
CHECK_C_SOURCE_RUNS ("#define _FILE_OFFSET_BITS 64\n${_LARGE_FILE_EXTRA_SRC}"
|
||||
HAVE_USEFUL_D_FILE_OFFSET_BITS)
|
||||
if (HAVE_USEFUL_D_FILE_OFFSET_BITS)
|
||||
set (_FILE_OFFSET_BITS 64 PARENT_SCOPE)
|
||||
elseif (SHOW_LARGE_FILE_WARNING)
|
||||
message (WARNING "No 64 bit file support through off_t available.")
|
||||
endif ()
|
||||
else ()
|
||||
set (_LARGE_FILES 1 PARENT_SCOPE)
|
||||
endif ()
|
||||
endfunction ()
|
||||
|
||||
|
||||
# Quick way to set some basic variables
|
||||
# FIXME add support for variable number of arguments: only package and version are mandatory
|
||||
# arguments are package version bug_report tarname url
|
||||
function (ac_init)
|
||||
set(package ${ARGV0})
|
||||
set(version ${ARGV1})
|
||||
set(bug_report ${ARGV2})
|
||||
set(tarname ${ARGV3})
|
||||
set(url ${ARGV4})
|
||||
set(PACKAGE_NAME "\"${package}\"" PARENT_SCOPE)
|
||||
set(PACKAGE_VERSION "\"${version}\"" PARENT_SCOPE)
|
||||
set(VERSION "\"${version}\"" PARENT_SCOPE)
|
||||
if(version)
|
||||
set(PACKAGE_STRING "\"${package} ${version}\"" PARENT_SCOPE)
|
||||
else()
|
||||
set(PACKAGE_STRING "\"${package}\"" PARENT_SCOPE)
|
||||
endif()
|
||||
|
||||
set(PACKAGE_BUGREPORT "\"${bug_report}\"" PARENT_SCOPE)
|
||||
|
||||
if(NOT tarname)
|
||||
string(REGEX REPLACE "[^a-zA-Z0-9_]" "-" tarname "${package}")
|
||||
endif()
|
||||
set(PACKAGE_TARNAME "\"${tarname}\"" PARENT_SCOPE)
|
||||
|
||||
set(PACKAGE_URL "\"${url}\"" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
|
||||
# Checks for the const keyword, defining "HAS_CONST_SUPPORT"
|
||||
# If it does not have support, defines "const" to 0 in the parent scope
|
||||
function (ac_c_const)
|
||||
CHECK_C_SOURCE_COMPILES(
|
||||
"int main(int argc, char **argv){const int r = 0;return r;}"
|
||||
HAS_CONST_SUPPORT)
|
||||
if (NOT HAS_CONST_SUPPORT)
|
||||
set(const 0 PARENT_SCOPE)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
|
||||
# Inline keyword support. Defines "inline" in the parent scope to the
|
||||
# compiler internal keyword for inline in C
|
||||
# TODO write a better test!
|
||||
function (ac_c_inline)
|
||||
if (MSVC)
|
||||
set (inline __inline)
|
||||
elseif(CMAKE_COMPILER_IS_GNUC)
|
||||
set (inline __inline__)
|
||||
endif()
|
||||
set(inline "${inline}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
|
||||
# Test if you can safely include both <sys/time.h> and <time.h>
|
||||
function (ac_header_time)
|
||||
CHECK_C_SOURCE_COMPILES(
|
||||
"#include <sys/time.h>\n#include <time.h>\nint main(int argc, char **argv) { return 0; }"
|
||||
TIME_WITH_SYS_TIME)
|
||||
set(TIME_WITH_SYS_TIME ${TIME_WITH_SYS_TIME} PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
|
||||
# Native cpu byte order: 1 if big-endian (Motorola) or 0 if little-endian
|
||||
# (Intel), setting "WORDS_BIGENDIAN" to 1 if big endian
|
||||
function (ac_c_bigendian)
|
||||
TEST_BIG_ENDIAN(HOST_BIGENDIAN)
|
||||
if (HOST_BIGENDIAN)
|
||||
set(WORDS_BIGENDIAN 1 PARENT_SCOPE)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
|
||||
# Check for off_t, setting "off_t" in the parent scope
|
||||
function(ac_type_off_t)
|
||||
CHECK_TYPE_SIZE("off_t" SIZEOF_OFF_T)
|
||||
if (NOT SIZEOF_OFF_T)
|
||||
set(off_t "long int")
|
||||
endif()
|
||||
set(off_t ${off_t} PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
|
||||
# Check for size_t, setting "size_t" in the parent scope
|
||||
function(ac_type_size_t)
|
||||
CHECK_TYPE_SIZE("size_t" SIZEOF_SIZE_T)
|
||||
if (NOT SIZEOF_SIZE_T)
|
||||
set(size_t "unsigned int")
|
||||
endif()
|
||||
set(size_t ${size_t} PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
|
||||
# Define "TM_IN_SYS_TIME" to 1 if <sys/time.h> declares "struct tm"
|
||||
function(ac_struct_tm)
|
||||
CHECK_C_SOURCE_COMPILES(
|
||||
"#include <sys/time.h>\nint main(int argc, char **argv) { struct tm x; return 0; }"
|
||||
TM_IN_SYS_TIME
|
||||
)
|
||||
if (TM_IN_SYS_TIME)
|
||||
set (TM_IN_SYS_TIME 1 PARENT_SCOPE)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
|
||||
# Obtain size of an 'type' and define as SIZEOF_TYPE
|
||||
function (ac_check_sizeof typename)
|
||||
string(TOUPPER "SIZEOF_${typename}" varname)
|
||||
string(REPLACE " " "_" varname "${varname}")
|
||||
string(REPLACE "*" "p" varname "${varname}")
|
||||
CHECK_TYPE_SIZE("${typename}" ${varname} BUILTIN_TYPES_ONLY)
|
||||
if(NOT ${varname})
|
||||
set(${varname} 0 PARENT_SCOPE)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
|
||||
# Check if the type exists, defines HAVE_<type>
|
||||
function (ac_check_type typename)
|
||||
string(TOUPPER "${typename}" varname)
|
||||
string(REPLACE " " "_" varname "${varname}")
|
||||
string(REPLACE "*" "p" varname "${varname}")
|
||||
CHECK_TYPE_SIZE("${typename}" ${varname})
|
||||
if (NOT "${varname}" STREQUAL "")
|
||||
set("HAVE_${varname}" 1 PARENT_SCOPE)
|
||||
set("${varname}" "${typename}" PARENT_SCOPE)
|
||||
else()
|
||||
set("${varname}" "unknown" PARENT_SCOPE)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
|
||||
# Verifies if each type on the list exists, using the given prelude
|
||||
function (ac_check_types type_list prelude)
|
||||
foreach(typename ${type_list})
|
||||
string(TOUPPER "HAVE_${typename}" varname)
|
||||
string(REPLACE " " "_" varname "${varname}")
|
||||
string(REPLACE "*" "p" varname "${varname}")
|
||||
CHECK_C_SOURCE_COMPILES("${prelude}\n ${typename} foo;" ${varname})
|
||||
endforeach()
|
||||
endfunction()
|
||||
|
||||
function(ac_path_prog variable prog_to_check_for value_if_not_found env_var)
|
||||
find_program(${variable} NAMES ${prog_to_check_for} PATHS ENV ${env_var} NO_DEFAULT_PATH)
|
||||
if(NOT ${variable})
|
||||
message(STATUS "Looking for ${prog_to_check_for} - not found")
|
||||
set(${variable} ${value_if_not_fount} PARENT_SCOPE)
|
||||
else()
|
||||
message(STATUS "Looking for ${prog_to_check_for} - ${variable}")
|
||||
set(${variable} ${${variable}} PARENT_SCOPE)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
# check if function func exists in library lib
|
||||
function(ac_check_lib lib func)
|
||||
string(TOUPPER "HAVE_${func}" varname)
|
||||
set(CMAKE_REQUIRED_LIBRARIES ${lib})
|
||||
check_function_exists(${func} ${varname})
|
||||
set(CMAKE_REQUIRED_LIBRARIES)
|
||||
endfunction()
|
||||
|
||||
# check if source compiles without linking
|
||||
function(ac_try_compile SOURCE VAR)
|
||||
set(CMAKE_TMP_DIR ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp)
|
||||
if(NOT DEFINED "${VAR}")
|
||||
file(WRITE
|
||||
"${CMAKE_TMP_DIR}/src.c"
|
||||
"${SOURCE}\n"
|
||||
)
|
||||
|
||||
if(NOT CMAKE_REQUIRED_QUIET)
|
||||
message(STATUS "Performing Test ${VAR}")
|
||||
endif()
|
||||
# Set up CMakeLists.txt for static library:
|
||||
file(WRITE
|
||||
${CMAKE_TMP_DIR}/CMakeLists.txt
|
||||
"add_library(compile STATIC src.c)"
|
||||
)
|
||||
|
||||
# Configure:
|
||||
execute_process(
|
||||
COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" .
|
||||
WORKING_DIRECTORY ${CMAKE_TMP_DIR}
|
||||
)
|
||||
|
||||
# Build:
|
||||
execute_process(
|
||||
COMMAND ${CMAKE_COMMAND} --build ${CMAKE_TMP_DIR}
|
||||
RESULT_VARIABLE RESVAR
|
||||
OUTPUT_VARIABLE OUTPUT
|
||||
ERROR_VARIABLE OUTPUT
|
||||
)
|
||||
|
||||
# Set up result:
|
||||
if(RESVAR EQUAL 0)
|
||||
set(${VAR} 1 CACHE INTERNAL "Test ${VAR}")
|
||||
if(NOT CMAKE_REQUIRED_QUIET)
|
||||
message(STATUS "Performing Test ${VAR} - Success")
|
||||
endif()
|
||||
|
||||
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
|
||||
"Performing C SOURCE FILE Test ${VAR} succeded with the following output:\n"
|
||||
"${OUTPUT}\n"
|
||||
"Source file was:\n${SOURCE}\n")
|
||||
else()
|
||||
if(NOT CMAKE_REQUIRED_QUIET)
|
||||
message(STATUS "Performing Test ${VAR} - Failed")
|
||||
endif()
|
||||
set(${VAR} "" CACHE INTERNAL "Test ${VAR}")
|
||||
file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
|
||||
"Performing C SOURCE FILE Test ${VAR} failed with the following output:\n"
|
||||
"${OUTPUT}\n"
|
||||
"Source file was:\n${SOURCE}\n")
|
||||
endif()
|
||||
endif()
|
||||
endfunction()
|
|
@ -0,0 +1,64 @@
|
|||
# - Try to find libelf
|
||||
# Once done this will define
|
||||
#
|
||||
# LIBELF_FOUND - system has libelf
|
||||
# LIBELF_INCLUDE_DIRS - the libelf include directory
|
||||
# LIBELF_LIBRARIES - Link these to use libelf
|
||||
# LIBELF_DEFINITIONS - Compiler switches required for using libelf
|
||||
#
|
||||
# This module reads hints about search locations from variables:
|
||||
#
|
||||
# LIBELF_ROOT - Preferred installation prefix
|
||||
#
|
||||
# Copyright (c) 2008 Bernhard Walle <bernhard.walle@gmx.de>
|
||||
#
|
||||
# Redistribution and use is allowed according to the terms of the New
|
||||
# BSD license.
|
||||
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
||||
#
|
||||
|
||||
|
||||
if (LIBELF_LIBRARIES AND LIBELF_INCLUDE_DIRS)
|
||||
set (LibElf_FIND_QUIETLY TRUE)
|
||||
endif (LIBELF_LIBRARIES AND LIBELF_INCLUDE_DIRS)
|
||||
|
||||
find_path (LIBELF_INCLUDE_DIRS
|
||||
NAMES
|
||||
libelf/libelf.h libelf.h
|
||||
HINTS
|
||||
${LIBELF_ROOT}
|
||||
PATH_SUFFIXES
|
||||
include
|
||||
libelf/include
|
||||
)
|
||||
|
||||
find_library (LIBELF_LIBRARIES
|
||||
NAMES
|
||||
elf libelf
|
||||
HINTS
|
||||
${LIBELF_ROOT}
|
||||
PATH_SUFFIXES
|
||||
lib
|
||||
libelf/lib
|
||||
)
|
||||
|
||||
include (FindPackageHandleStandardArgs)
|
||||
|
||||
|
||||
# handle the QUIETLY and REQUIRED arguments and set LIBELF_FOUND to TRUE if all listed variables are TRUE
|
||||
FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibElf DEFAULT_MSG
|
||||
LIBELF_LIBRARIES
|
||||
LIBELF_INCLUDE_DIRS)
|
||||
|
||||
set(CMAKE_REQUIRED_LIBRARIES elf)
|
||||
include(CheckCXXSourceCompiles)
|
||||
check_cxx_source_compiles("#include <libelf.h>
|
||||
int main() {
|
||||
Elf *e = (Elf*)0;
|
||||
size_t sz;
|
||||
elf_getshdrstrndx(e, &sz);
|
||||
return 0;
|
||||
}" ELF_GETSHDRSTRNDX)
|
||||
unset(CMAKE_REQUIRED_LIBRARIES)
|
||||
|
||||
mark_as_advanced(LIBELF_INCLUDE_DIRS LIBELF_LIBRARIES ELF_GETSHDRSTRNDX)
|
|
@ -0,0 +1,19 @@
|
|||
# used to compile on MSVC upto 2013 where snprintf is not available
|
||||
macro(msvc_posix target)
|
||||
if(MSVC AND ("${MSVC_VERSION}" LESS 1900))
|
||||
# under VS 2015
|
||||
target_compile_definitions(${target} PUBLIC
|
||||
snprintf=_snprintf)
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
# set target folder on IDE
|
||||
macro(set_folder target folder)
|
||||
set_target_properties(${target} PROPERTIES FOLDER ${folder})
|
||||
endmacro()
|
||||
|
||||
# set source groups on IDE
|
||||
macro(set_source_group list_name group_name)
|
||||
set(${list_name} ${ARGN})
|
||||
source_group(${group_name} FILES ${ARGN})
|
||||
endmacro()
|
64
dwarf-compilation.base/contrib/libdwarf/config.h.in
Normal file
64
dwarf-compilation.base/contrib/libdwarf/config.h.in
Normal file
|
@ -0,0 +1,64 @@
|
|||
/* config.h.in. Generated from configure.in by autoheader. */
|
||||
|
||||
/* Define if building universal (internal helper macro) */
|
||||
#undef AC_APPLE_UNIVERSAL_BUILD
|
||||
|
||||
/* Define to 1 if you have the <inttypes.h> header file. */
|
||||
#undef HAVE_INTTYPES_H
|
||||
|
||||
/* Define to 1 if you have the <memory.h> header file. */
|
||||
#undef HAVE_MEMORY_H
|
||||
|
||||
/* Define to 1 if you have the <stdint.h> header file. */
|
||||
#undef HAVE_STDINT_H
|
||||
|
||||
/* Define to 1 if you have the <stdlib.h> header file. */
|
||||
#undef HAVE_STDLIB_H
|
||||
|
||||
/* Define to 1 if you have the <strings.h> header file. */
|
||||
#undef HAVE_STRINGS_H
|
||||
|
||||
/* Define to 1 if you have the <string.h> header file. */
|
||||
#undef HAVE_STRING_H
|
||||
|
||||
/* Define to 1 if you have the <sys/stat.h> header file. */
|
||||
#undef HAVE_SYS_STAT_H
|
||||
|
||||
/* Define to 1 if you have the <sys/types.h> header file. */
|
||||
#undef HAVE_SYS_TYPES_H
|
||||
|
||||
/* Define to 1 if you have the <unistd.h> header file. */
|
||||
#undef HAVE_UNISTD_H
|
||||
|
||||
/* Define to the address where bug reports for this package should be sent. */
|
||||
#undef PACKAGE_BUGREPORT
|
||||
|
||||
/* Define to the full name of this package. */
|
||||
#undef PACKAGE_NAME
|
||||
|
||||
/* Define to the full name and version of this package. */
|
||||
#undef PACKAGE_STRING
|
||||
|
||||
/* Define to the one symbol short name of this package. */
|
||||
#undef PACKAGE_TARNAME
|
||||
|
||||
/* Define to the home page for this package. */
|
||||
#undef PACKAGE_URL
|
||||
|
||||
/* Define to the version of this package. */
|
||||
#undef PACKAGE_VERSION
|
||||
|
||||
/* Define to 1 if you have the ANSI C header files. */
|
||||
#undef STDC_HEADERS
|
||||
|
||||
/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
|
||||
significant byte first (like Motorola and SPARC, unlike Intel). */
|
||||
#if defined AC_APPLE_UNIVERSAL_BUILD
|
||||
# if defined __BIG_ENDIAN__
|
||||
# define WORDS_BIGENDIAN 1
|
||||
# endif
|
||||
#else
|
||||
# ifndef WORDS_BIGENDIAN
|
||||
# undef WORDS_BIGENDIAN
|
||||
# endif
|
||||
#endif
|
5156
dwarf-compilation.base/contrib/libdwarf/configure
vendored
Executable file
5156
dwarf-compilation.base/contrib/libdwarf/configure
vendored
Executable file
File diff suppressed because it is too large
Load diff
17
dwarf-compilation.base/contrib/libdwarf/configure.cmake
Normal file
17
dwarf-compilation.base/contrib/libdwarf/configure.cmake
Normal file
|
@ -0,0 +1,17 @@
|
|||
include(AutoconfHelper)
|
||||
|
||||
ac_c_bigendian()
|
||||
ac_check_headers(sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h inttypes.h stdint.h unistd.h)
|
||||
|
||||
# libdwarf default-disabled shared
|
||||
option(shared "build shared library libdwarf.so and use it if present" FALSE)
|
||||
|
||||
option(nonshared "build archive library libdwarf.a" TRUE)
|
||||
|
||||
# This adds compiler option -Wall (gcc compiler warnings)
|
||||
option(wall "Add -Wall" FALSE)
|
||||
set(dwfwall $<$<BOOL:${wall}>:"-Wall -O0 -Wpointer-arith -Wmissing-declarations -Wmissing-prototypes -Wdeclaration-after-statement -Wextra -Wcomment -Wformat -Wpedantic -Wuninitialized -Wno-long-long -Wshadow">)
|
||||
|
||||
option(nonstandardprintf "Use a special printf format for 64bit (default is NO)" FALSE)
|
||||
set(HAVE_NONSTANDARD_PRINTF_64_FORMAT ${nonstandardprintf})
|
||||
message(STATUS "Checking enable nonstandardprintf... ${HAVE_NONSTANDARD_PRINTF_64_FORMAT}")
|
51
dwarf-compilation.base/contrib/libdwarf/configure.in
Normal file
51
dwarf-compilation.base/contrib/libdwarf/configure.in
Normal file
|
@ -0,0 +1,51 @@
|
|||
dnl Process this file with autoconf to produce a configure script.
|
||||
AC_INIT()
|
||||
AC_CONFIG_HEADER(config.h)
|
||||
|
||||
AC_PROG_CC
|
||||
AC_C_BIGENDIAN
|
||||
AC_GCC_TRADITIONAL
|
||||
AC_PROG_INSTALL
|
||||
AC_CHECK_TOOL(RANLIB, ranlib, :)
|
||||
AC_CHECK_TOOL(AR, ar)
|
||||
|
||||
dnl libdwarf default-disabled shared
|
||||
shrd=''
|
||||
AC_ARG_ENABLE(shared,AC_HELP_STRING([--enable-shared],
|
||||
[build shared library libdwarf.so and use it if present]))
|
||||
AS_IF([ test "x$enable_shared" = "xyes"], [
|
||||
shrd='--enable-shared'])
|
||||
|
||||
AC_SUBST(dwfpic,[-fPIC])
|
||||
nonshrd=''
|
||||
dnl default-enabled nonshared
|
||||
AC_SUBST(build_nonshared,[none.a])
|
||||
AC_ARG_ENABLE(nonshared,AC_HELP_STRING([--disable-nonshared],
|
||||
[do not build archive library libdwarf.a]))
|
||||
AS_IF([ test "x$enable_nonshared" = "xno"], [
|
||||
nonshrd='--disable-shared'
|
||||
])
|
||||
|
||||
dnl This adds compiler option -fsanitize=address (gcc compiler run-time checks))
|
||||
AC_SUBST(dwfsanitize,[])
|
||||
AC_MSG_CHECKING(build -fsanitize-address)
|
||||
AC_ARG_ENABLE(sanitize,AC_HELP_STRING([--enable-sanitize],
|
||||
[Add -fsanitize (default is not to)]),
|
||||
[ AC_SUBST(dwfsanitize,["-fsanitize=address -fsanitize=leak -fsanitize=undefined"])
|
||||
AC_MSG_RESULT(yes) ],
|
||||
[ AC_SUBST(dwfsanitize,[])
|
||||
AC_MSG_RESULT(no)
|
||||
]
|
||||
)
|
||||
|
||||
chckres() {
|
||||
if test $1 != 0
|
||||
then
|
||||
echo "Configure Error exit: $2"
|
||||
exit 2
|
||||
fi
|
||||
}
|
||||
|
||||
AC_CONFIG_SUBDIRS([libdwarf dwarfdump dwarfgen dwarfexample])
|
||||
|
||||
AC_OUTPUT(Makefile)
|
168
dwarf-compilation.base/contrib/libdwarf/dwarfdump/CMakeLists.txt
Normal file
168
dwarf-compilation.base/contrib/libdwarf/dwarfdump/CMakeLists.txt
Normal file
|
@ -0,0 +1,168 @@
|
|||
include(configure.cmake)
|
||||
|
||||
add_library(esb_and_tsearchbal OBJECT esb.c dwarf_tsearchbal.c)
|
||||
|
||||
set_folder(esb_and_tsearchbal dwarfdump)
|
||||
|
||||
target_include_directories(esb_and_tsearchbal PRIVATE
|
||||
$<TARGET_PROPERTY:${dwarf-target},INTERFACE_INCLUDE_DIRECTORIES>)
|
||||
|
||||
msvc_posix(esb_and_tsearchbal)
|
||||
|
||||
set_source_group(SOURCES "Source Files" addrmap.c checkutil.c dwarfdump.c dwconf.c helpertree.c
|
||||
glflags.c
|
||||
macrocheck.c print_abbrevs.c print_aranges.c print_debugfission.c print_die.c
|
||||
print_dnames.c print_frames.c print_gdbindex.c
|
||||
print_lines.c print_locs.c print_macro.c print_macros.c print_pubnames.c print_ranges.c print_reloc.c
|
||||
print_sections.c print_section_groups.c print_static_funcs.c print_static_vars.c print_strings.c print_types.c print_weaknames.c
|
||||
sanitized.c section_bitmaps.c strstrnocase.c uri.c dwgetopt.c makename.c naming.c common.c $<TARGET_OBJECTS:esb_and_tsearchbal>)
|
||||
|
||||
set_source_group(HEADERS "Header Files" checkutil.h common.h dwconf.h dwgetopt.h esb.h glflags.h globals.h macrocheck.h
|
||||
makename.h dwarf_tsearch.h print_frames.h section_bitmaps.h uri.h)
|
||||
|
||||
set_source_group(CONFIGURATION_FILES "Configuration Files" configure.cmake config.h.in.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h)
|
||||
|
||||
set_source_group(TAG_GENERATED "Generated Files" tmp-tt-table.c tmp-ta-table.c tmp-ta-ext-table.c tmp-tt-ext-table.c)
|
||||
|
||||
add_executable(dwarfdump ${SOURCES} ${HEADERS} ${TAG_GENERATED} ${CONFIGURATION_FILES})
|
||||
|
||||
set_folder(dwarfdump dwarfdump)
|
||||
|
||||
target_compile_options(dwarfdump PRIVATE ${dwfwall})
|
||||
|
||||
target_compile_definitions(dwarfdump PRIVATE "CONFPREFIX=${CMAKE_INSTALL_PREFIX}/lib")
|
||||
|
||||
target_link_libraries(dwarfdump PRIVATE ${dwarf-target} ${dwfzlib})
|
||||
|
||||
# We need this as naming.o has external references we cannot have
|
||||
# in the tree builds.
|
||||
configure_file(naming.c trivial_naming.c COPYONLY)
|
||||
|
||||
set_source_files_properties(trivial_naming.c PROPERTIES COMPILE_DEFINITIONS TRIVIAL_NAMING)
|
||||
|
||||
set(TAG_TREE_SOURCES tag_tree.c tag_common.c common.c makename.c trivial_naming.c dwgetopt.c dwarf_tsearchbal.c sanitized.c esb.c)
|
||||
|
||||
add_executable(tag_tree_build ${TAG_TREE_SOURCES})
|
||||
|
||||
set_folder(tag_tree_build dwarfdump/generators)
|
||||
|
||||
target_link_libraries(tag_tree_build PRIVATE ${dwarf-target})
|
||||
|
||||
set(TAG_ATTR_SOURCES tag_attr.c tag_common.c common.c makename.c trivial_naming.c dwgetopt.c dwarf_tsearchbal.c sanitized.c esb.c)
|
||||
|
||||
add_executable(tag_attr_build ${TAG_ATTR_SOURCES})
|
||||
|
||||
set_folder(tag_attr_build dwarfdump/generators)
|
||||
|
||||
target_link_libraries(tag_attr_build PRIVATE ${dwarf-target})
|
||||
|
||||
# Plain GNU C dash E does not work on a .list,
|
||||
# so copy to a .c name to run
|
||||
# the following four table creations.
|
||||
set(TAG_LIST_FILES tag_tree.list tag_attr.list tag_attr_ext.list tag_tree_ext.list)
|
||||
set(TAG_SWITCH -s -s -e -e)
|
||||
set(TAG_TOOL tag_tree_build tag_attr_build tag_attr_build tag_tree_build)
|
||||
foreach(i RANGE 0 3)
|
||||
list(GET TAG_GENERATED ${i} generatedFile)
|
||||
list(GET TAG_LIST_FILES ${i} listFile)
|
||||
list(GET TAG_SWITCH ${i} tagSwitch)
|
||||
list(GET TAG_TOOL ${i} tagTool)
|
||||
|
||||
math(EXPR j "${i} + 1")
|
||||
|
||||
set(tmpSouce tmp-t${j})
|
||||
set(tmpDest tmp-tag-build${j}.tmp)
|
||||
|
||||
configure_file(${listFile} ${tmpSouce}.c COPYONLY)
|
||||
|
||||
add_custom_command(OUTPUT ${generatedFile}
|
||||
COMMAND ${CMAKE_C_COMPILER} -E -I${CMAKE_CURRENT_SOURCE_DIR}/../libdwarf -DCONFPREFIX=${CMAKE_INSTALL_PREFIX}/lib ${tmpSouce}.c > ${tmpDest}
|
||||
COMMAND ${tagTool} ${tagSwitch} -i ${tmpDest} -o ${generatedFile}
|
||||
DEPENDS ${tagTool} ${listFile})
|
||||
endforeach()
|
||||
|
||||
set_source_group(TESTESB_SOURCES "Source Files" esb.c testesb.c)
|
||||
|
||||
add_executable(testesb ${TESTESB_SOURCES})
|
||||
|
||||
set_folder(testesb dwarfdump/tests)
|
||||
|
||||
target_include_directories(testesb PRIVATE
|
||||
$<TARGET_PROPERTY:${dwarf-target},INTERFACE_INCLUDE_DIRECTORIES>)
|
||||
|
||||
add_test(NAME test COMMAND testesb)
|
||||
|
||||
set_source_group(GETOPTEST_SOURCES "Source Files" getopttest.c dwgetopt.c)
|
||||
|
||||
add_executable(getopttest ${GETOPTEST_SOURCES})
|
||||
|
||||
set_folder(getopttest dwarfdump/tests)
|
||||
|
||||
add_test(NAME getopttest COMMAND getopttest)
|
||||
|
||||
add_executable(getopttestnat ${GETOPTEST_SOURCES})
|
||||
|
||||
set_folder(getopttestnat dwarfdump/tests)
|
||||
|
||||
if(UNIX)
|
||||
target_compile_definitions(getopttestnat PRIVATE GETOPT_FROM_SYSTEM)
|
||||
endif()
|
||||
|
||||
foreach(i 1 2 3 5 6 7 8)
|
||||
add_test(NAME getopttestnat${i} COMMAND getopttestnat -c ${i})
|
||||
endforeach()
|
||||
|
||||
set_source_group(SELFHELPERTREE_SOURCES "Source Files" helpertree.c)
|
||||
|
||||
add_executable(selfhelpertree ${SELFHELPERTREE_SOURCES} $<TARGET_OBJECTS:esb_and_tsearchbal>)
|
||||
|
||||
set_folder(selfhelpertree dwarfdump/tests)
|
||||
|
||||
target_compile_definitions(selfhelpertree PRIVATE SELFTEST)
|
||||
|
||||
target_include_directories(selfhelpertree PRIVATE
|
||||
$<TARGET_PROPERTY:${dwarf-target},INTERFACE_INCLUDE_DIRECTORIES>)
|
||||
|
||||
add_test(NAME selfhelpertree COMMAND selfhelpertree)
|
||||
|
||||
#doesn't compile
|
||||
#set_source_group(SELFMC_SOURCES "Source Files" macrocheck.c $<TARGET_OBJECTS:esb_and_tsearchbal>)
|
||||
#
|
||||
#add_executable(selfmc ${SELFMC_SOURCES})
|
||||
#
|
||||
# set_folder(selfmc dwarfdump/tests)
|
||||
#
|
||||
#target_compile_definitions(selfmc PRIVATE SELFTEST)
|
||||
#
|
||||
#target_include_directories(selfmc PRIVATE
|
||||
# $<TARGET_PROPERTY:${dwarf-target},INTERFACE_INCLUDE_DIRECTORIES>)
|
||||
#
|
||||
#add_test(NAME selfmc COMMAND selfmc)
|
||||
|
||||
set_source_group(SELFESB_SOURCES "Source Files" esb.c)
|
||||
|
||||
add_executable(selfesb ${SELFESB_SOURCES})
|
||||
|
||||
set_folder(selfesb dwarfdump/tests)
|
||||
|
||||
target_compile_definitions(selfesb PRIVATE SELFTEST)
|
||||
|
||||
target_include_directories(selfesb PRIVATE
|
||||
$<TARGET_PROPERTY:${dwarf-target},INTERFACE_INCLUDE_DIRECTORIES>)
|
||||
|
||||
add_test(NAME selfesb COMMAND selfesb)
|
||||
|
||||
if(${CMAKE_SIZEOF_VOID_P} EQUAL 8)
|
||||
set(SUFFIX 64)
|
||||
endif()
|
||||
set(LIBDIR lib${SUFFIX})
|
||||
set(BINDIR bin${SUFFIX})
|
||||
|
||||
install(TARGETS dwarfdump DESTINATION
|
||||
RUNTIME DESTINATION ${BINDIR}
|
||||
LIBRARY DESTINATION ${LIBDIR}
|
||||
ARCHIVE DESTINATION ${LIBDIR})
|
||||
|
||||
install(FILES dwarfdump.conf DESTINATION ${LIBDIR})
|
||||
|
||||
install(FILES dwarfdump.1 DESTINATION share/man/man1)
|
|
@ -0,0 +1,44 @@
|
|||
This document is a brief description of the main
|
||||
coding style conventions in dwarfdump. Many of them
|
||||
will be obvious from the code, but over time some
|
||||
accidental diffences crept in.
|
||||
|
||||
|
||||
Code should be indented in multiples of 4 spaces, and
|
||||
tabs should not be used to indent the source code.
|
||||
Use the dicheck program to check indenting.
|
||||
|
||||
The struct naming convention is 'struct my_struct_s' for the
|
||||
struct defined here (meaning the name should end with _s).
|
||||
It is better to not do struct typedefs of local structs.
|
||||
Coders should type 'struct mystruct_s'. Readability
|
||||
is much more important than brevity.
|
||||
|
||||
Any data or function not referenced outside the
|
||||
defining source file should be declared 'static'.
|
||||
|
||||
Any duplicated code is a candidate for refactoring
|
||||
into a subprogram.
|
||||
|
||||
Function names should be all lower case with underbars
|
||||
with the goal that statements and comments 'read well'.
|
||||
|
||||
Variables should be lower-case with
|
||||
underbars for readability. It's ok for a small loop
|
||||
with counters to use single letter names like i or k or m.
|
||||
|
||||
Structure members should have a struct-specific
|
||||
2-character prefix to the name (followed by
|
||||
an underbar). That makes it much
|
||||
easier to grep for uses of members.
|
||||
|
||||
Try to keep lines under 80 characters in length.
|
||||
|
||||
Ensure every if() has {} to enclose the actions.
|
||||
|
||||
Use libdwarf.h types for all the data objects you define,
|
||||
though sometimes an 'unsigned' or 'int' or 'size_t' is
|
||||
ok in restricted circumstances. Dwarf_Unsigned and
|
||||
Dwarf_Signed are the preferred integer types for general use.
|
||||
|
||||
------------
|
31
dwarf-compilation.base/contrib/libdwarf/dwarfdump/COPYING
Normal file
31
dwarf-compilation.base/contrib/libdwarf/dwarfdump/COPYING
Normal file
|
@ -0,0 +1,31 @@
|
|||
|
||||
David Anderson: December 2006
|
||||
The code in the dwarfdump directory is (if you look
|
||||
in each file) covered by the GPL (not the LGPL). The
|
||||
DWARFDUMPCOPYRIGHT file, though, said (before December 24,
|
||||
2006) the copyright is LGPL. There is no doubt in my (David
|
||||
Anderson) mind that the intent was always that dwarfdump be
|
||||
GPL and the copyright markings in each file are correct.
|
||||
|
||||
There are three files marked with the LGPL: tag_tree.list
|
||||
tag_attr.list acconfig.h. These markings are left as is and
|
||||
these are are therefore LGPL files.
|
||||
|
||||
The DWARFDUMPCOPYRIGHT file now (Dec 24 2006) has both
|
||||
copyrights and an explanation of where each applies.
|
||||
|
||||
|
||||
|
||||
-------------------------------------------
|
||||
The text present for years, thru Dec 23, 2006:
|
||||
The files:
|
||||
dwarfdump.c
|
||||
and all the .h and .c files in this implementation of
|
||||
dwarfdump are copyrighted according to the file
|
||||
DWARFDUMPCOPYRIGHT.
|
||||
|
||||
|
||||
|
||||
$Source: /plroot/cmplrs.src/v7.4.5m/.RCS/PL/dwarfdump/RCS/COPYING,v $
|
||||
$Revision: 1.1 $
|
||||
$Date: 2001/01/16 17:47:55 $
|
234
dwarf-compilation.base/contrib/libdwarf/dwarfdump/ChangeLog
Normal file
234
dwarf-compilation.base/contrib/libdwarf/dwarfdump/ChangeLog
Normal file
|
@ -0,0 +1,234 @@
|
|||
2017-10-20 David Anderson
|
||||
* print_die.c: Now handles DW_FORM_data16.
|
||||
2017-10-16 David Anderson
|
||||
* dwarfdump.c,globals.h,print_ranges.c,print_section_groups.c: a large group
|
||||
of per-object totals/values were not free()d or zeroed for each member
|
||||
of an archive. Some of the zero/free() was moved from the end of main()
|
||||
to be done per-object and some were simply never completely reset before.
|
||||
These problems were only visible when running dwarfdump on an archive.
|
||||
2017-10-15 David Anderson
|
||||
* dwarfdump.c: Added a call to destruct_abbrev_array()
|
||||
per object so the archive case can work properly with -ka.
|
||||
* dwgetopt.c: Unused local variable 'found' deleted.
|
||||
* print_abbrevs.c: Now -ka can handle bogus large
|
||||
abbreviation number
|
||||
without crashing when checking abbreviations..
|
||||
2017-10-15 David Anderson
|
||||
* dwgetopt.c,dwgetopt.h: Now handles simple long argument
|
||||
names cases.
|
||||
* getopttest.c: Added tests of long (--) argument names.
|
||||
2017-10-13 David Anderson
|
||||
* common.c, dwarfdump.c, tag_attr.c, tag_tree.c:Update
|
||||
version string.
|
||||
2017-10-12 David Anderson
|
||||
* dwarfdump.c: Now more careful with archive
|
||||
names presented by libelf and Elf_Arhdr.
|
||||
2017-10-12 David Anderson
|
||||
* print_section_groups.c: Added a cast on a free() call
|
||||
to avoid a compiler warning.
|
||||
* dwarfdump.c: On an archive (.a) dwarfdump would print
|
||||
a useless warning on encountering a special / or //
|
||||
member. Now just skips those, and if some other member
|
||||
is not an object dwarfdump prints a more useful message
|
||||
to identify the particular member.
|
||||
* print_die.c: The attributes_encoding_table was not
|
||||
getting reset properly in the case of reading an archive,
|
||||
and that is now fixed.
|
||||
2017-10-05 David Anderson
|
||||
* tag_attr.list: Changed the spelling from DW_AT_ranges_base
|
||||
to the final DWARF5 spelling, DW_AT_rnglists_base.
|
||||
2017-10-05 David Anderson
|
||||
* dwconf.c: Open the config file "r", not "rw".
|
||||
2017-09-26 David Anderson
|
||||
* common.c, dwarfdump.c, tag_attr.c, tag_tree.c:Update
|
||||
version string.
|
||||
2017-08-22 David Anderson
|
||||
* common.c, dwarfdump.c, tag_attr.c, tag_tree.c:Update
|
||||
version string.
|
||||
2017-08-21 David Anderson
|
||||
* CMakeLists.txt: Fix the TAG_TREE_SOURCES and TAG_ATTR_SOURCES
|
||||
entries.
|
||||
* Makefile.in: Fix a misuse of LD_LIBRARY_PATH and use
|
||||
LIBDWARF_PATH as the path to libdwarf.so.
|
||||
* common.c, dwarfdump.c, tag_attr.c, tag_tree.c:Update
|
||||
version string.
|
||||
* common.c: #include changes help for builds on Windows.
|
||||
Rename a parameter to avoid accidental name-shadowing.
|
||||
* configure.cmake: Fix ac_check_lib() uses.
|
||||
* dwarfdump.c,dwconf.c,esb.c: Modify #ifdefs to ease building on Windows.
|
||||
* getopttest.c: Cast/printf changes avoid warnings on 32 and 64 bit
|
||||
builds.
|
||||
* macrocheck.c: An extra newline makes the 'make test' output
|
||||
easier to understand.
|
||||
* testesb.c: The check() function is local, so call it 'static' to
|
||||
avoid a compiler warning.
|
||||
2017-07-24 David Anderson
|
||||
* configure.in, configure.cmake, config.h.in: Renamed
|
||||
LOCATION_OF_LIBELFHEADER to HAVE_LOCATION_OF_LIBELFHEADER
|
||||
for consistency with config.h.in generally.
|
||||
* configure: Regenerated
|
||||
2017-07-24 David Anderson
|
||||
* configure.in, configure.cmake: Consistent use of
|
||||
LOCATION_OF_LIBELFHEADER so Windows can build libdwarf with
|
||||
configure or cmake.
|
||||
* configure: Regenerated
|
||||
2017-07-09 David Anderson
|
||||
* common.c, dwarfdump.c, tag_attr.c, tag_tree.c:Update
|
||||
version string.
|
||||
2017-05-28 David Anderson
|
||||
* common.c, dwarfdump.c, tag_attr.c, tag_tree.c:Update
|
||||
version string.
|
||||
2017-05-28 David Anderson
|
||||
* macrocheck.c: Trivial revision of main() declaration
|
||||
to our standard format.
|
||||
* print_reloc.c: We were reading one-past the end
|
||||
of symtab entries(now fixed).
|
||||
Now relocation sections show the Elf section index
|
||||
and we print them in order as in the object file
|
||||
(earlier it printed in a fixed order not related to
|
||||
the object file).
|
||||
Deleted the rel/rela section name arrays,
|
||||
we already have the section name at hand.
|
||||
2017-05-27 David Anderson
|
||||
* esb.c: For selftest now indents report lines
|
||||
to make it easier to see the overview pass/fail.
|
||||
* Makefile.in,macrocheck.c,print_reloc.c: Makes macrocheck
|
||||
self test results clearer (pass/fail) and adds a check
|
||||
on the array of relocation section data in print_reloc.c.
|
||||
2017-05-26 David Anderson
|
||||
* section_bitmaps.h,section_bitmaps.c: Added comments.
|
||||
2017-05-25 David Anderson
|
||||
* common.c,tag_attr.c,tag_tree.c: Update version string.
|
||||
* dwarfdump.c: Update version string.
|
||||
Instead of using bitmaps for printing sections and relocations
|
||||
use char arrays instead. Faster, easier to read, and much
|
||||
easier to expand to the longer lists of sections.
|
||||
By using fixed size arrays for this the compiler can check
|
||||
for simple errors.
|
||||
* print_reloc.c: Moved #defines over to section_bitmap.h
|
||||
Arrays are now fixed size to give compiler the ability to
|
||||
notice simple coding errors. Added the new DWARF5 sections
|
||||
to lists of what is to print. We do not use zero as a section
|
||||
number so we add an unused zero element to each array.
|
||||
* print_reloc.h: Made idempotent with ifndef.
|
||||
* section_bitmaps.c: Now uses the char array id
|
||||
and indexes starting at 1 (per the #defines in section_bitmaps.h).
|
||||
Revised the code in 'make selftest' to do more complete checking.
|
||||
* section_bitmaps.h: Now all the REL and RELA #defines are here
|
||||
so it's easy to see them all at once. Now using indexes
|
||||
starting at 1, not bitfields. Faster,simpler, and for a given
|
||||
dwarfdump run the switch from bitmaps will expand
|
||||
static data by well under 20 bytes total.
|
||||
2017-05-18 David Anderson
|
||||
* dwarfdump.c: Fixed a small memory leak in special_program_name().
|
||||
Deleted four lines of test code that never got removed.
|
||||
2017-05-17 David Anderson
|
||||
* CMakeLists.txt: Add section_bitmaps.h,.c.
|
||||
* Makefile.in: Add section_bitmaps.o, section_bitmaps.h.
|
||||
Add section_bitmaps 'make selftest' rules.
|
||||
* section_bitmaps.h, section_bitmaps.c: The bit field code
|
||||
used to control the -E option set was out of date and
|
||||
difficult to get right. Now 'make selftest' ensures that
|
||||
the bits match up with the strings.
|
||||
* glflags.h, glflags.c: Fixed the misnamed gf_type_flag to be
|
||||
gf_types_flag.
|
||||
* globals.h: Move defines to section_bitmaps.h
|
||||
* common.c: Use sanitized() on incoming strings we print.
|
||||
* print_aranges.c,print_debugfission.c: Names from elf now
|
||||
get sanitized() for printing.
|
||||
* print_section_groups.c: Improved one interface.
|
||||
* print_die.c: Critical fixes so we get the section names on output
|
||||
when we want them, and sanitized().
|
||||
* common.c, print_aranges.c, print_debugfission.c,print_ranges.c,
|
||||
print_strings.c: Calling sanitized() to ensure printf safety.
|
||||
* print_section_groups.c: Revised function interface.
|
||||
Do not use May 13 interface.
|
||||
* print_die.c: Crucial revision so DWARF4 debug_types prints.
|
||||
* dwarfdump.c: Revised flags so the gf_section_groups_flag works.
|
||||
Revised the section bitmaps code.
|
||||
* print_section_groups.c: Delete a printf left in
|
||||
for debugging.
|
||||
2017-05-13 David Anderson
|
||||
* CMakeLists.txt, Makefile.in: Mention new
|
||||
print_section_groups.c or .o.
|
||||
* dwarfdump.c: Add needed section names in
|
||||
print_object_header() data.
|
||||
Implement glflags.gf_section_groups_flag.
|
||||
* print_section_groups.c: New, implementing handling of section
|
||||
groups (aka COMDAT).
|
||||
2017-04-20 David Anderson
|
||||
* common.c, dwarfdump.c, tag_attr.c, tag_tree.c:Update
|
||||
version string.
|
||||
2017-04-17 David Anderson
|
||||
* common.c, dwarfdump.c, tag_attr.c, tag_tree.c:Update
|
||||
version string.
|
||||
2017-04-16 David Anderson
|
||||
* CMakeLists.txt: Added in new files glflangs.c, .h
|
||||
2017-04-12 David Anderson
|
||||
* common.c, dwarfdump.c, tag_attr.c, tag_tree.c:Update
|
||||
version string.
|
||||
2017-04-06 David Anderson
|
||||
* Makefile.in: Add glflags.o. Instead of dozens of
|
||||
boolean variables, a struct with the booleans
|
||||
makes understanding them much easier.
|
||||
* glflags.h, glflags.c: define and initialize all these
|
||||
flags and settings.
|
||||
* dwarfdump.c: Use the new glflags.h setting fields.
|
||||
Add one new one for debug_names (nothing useful
|
||||
implemented yet).
|
||||
* globals.h: Remove the flag global extern lines.
|
||||
* naming.c,print_abbrevs.c, print_aranges.c, print_die.c,
|
||||
print_frames.c, print_gdbindex.c, print_lines.c,
|
||||
print locs.c, print_macro.c, print_macros.c,
|
||||
print_pubnames.c, print_ranges.c, print_static_funcs.c,
|
||||
print_static_vars.c, print_strings.c, print_types.c,
|
||||
print_weaknames.c: Using the new
|
||||
flag globals as glflags.gf_<member>
|
||||
* print_dnames.c: New for .debug_names printing.
|
||||
2017-04-06 David Anderson
|
||||
* dwarfdump.c, Makefile.in, globals.h:
|
||||
This is a small start on dealing with DWARF5 .debug_names.
|
||||
2017-04-02 David Anderson
|
||||
* common.c, dwarfdump.c, tag_attr.c, tag_tree.c:Update
|
||||
version string.
|
||||
2017-04-02 David Anderson
|
||||
* dwarfdump.c: If printing group 2 (DWARF5 dwo sections)
|
||||
ensure that printing of those sections only possible
|
||||
in group 1 is turned off.
|
||||
2017-03-30 David Anderson
|
||||
2017-03-30 David Anderson
|
||||
* dwarfdump.1: Documenting the new -x groupnumber=<n> option.
|
||||
* dwarfdump.c: Adding groupnumber option support.
|
||||
* sanitized.c: Removed trailing whitespace
|
||||
2017-03-24 David Anderson
|
||||
* dwarfdump.c: Now argv[0] is checked before setting the
|
||||
program_name global variable. If it contains /dwarfdump.O
|
||||
that part of the string is shortened to /dwarfdump.
|
||||
Doing this removes a need for the regressiontests to use sed
|
||||
and shortens the regressiontests runtime on a one machine from
|
||||
77 minutes to 23 minutes.
|
||||
2017-03-23 David Anderson
|
||||
* common.c, dwarfdump.c, tag_attr.c, tag_tree.c:Update
|
||||
version string.
|
||||
2017-03-21 David Anderson
|
||||
* sanitized.c: Now all non-ascii bytes are changed to %xx
|
||||
and a % input character is changed to %xx too
|
||||
iso-8859 and for html are now sanitized using URI
|
||||
%xx notation so the printf output looks sensible.
|
||||
These usually represent a corrupted string in an object file.
|
||||
2017-03-21 David Anderson
|
||||
* print_die.c: Added casts to call args match with the
|
||||
function declaration. So a fussy compiler will
|
||||
be less likely to complain.
|
||||
* sanitized.c: Added explicit initializers to global variables.
|
||||
Moved a static var to the function that uses it.
|
||||
2017-01-31 David Anderson
|
||||
* esb.c(esb_force_allocation): Code was wrong all this time.
|
||||
Fixed and corrected commentary. Updated copyright.
|
||||
2017-01-30 David Anderson
|
||||
* esb.c(esb_force_allocation): Add commentary about to clarify
|
||||
the purpose of the function.
|
||||
2017-01-23 David Anderson
|
||||
* dwarf_tsearchbal.c(dwarf_tsearch): In memory exhausted situation the
|
||||
function could leak a little bit of memory.
|
||||
|
332
dwarf-compilation.base/contrib/libdwarf/dwarfdump/ChangeLog2006
Normal file
332
dwarf-compilation.base/contrib/libdwarf/dwarfdump/ChangeLog2006
Normal file
|
@ -0,0 +1,332 @@
|
|||
2006-12-24 David Anderson <davea@sgi.com>
|
||||
* DWARFDUMPCOPYRIGHT: Added GPL copyright text with
|
||||
explanation of the intended content.
|
||||
* COPYING: added text explaining confusion of GPL vs LGPL.
|
||||
Thanks to Chris Quenelle for pointing out the disconnect
|
||||
between DWARFDUMPCOPYRIGHT and the source files in dwarfdump.
|
||||
2006-12-21 David Anderson <davea@sgi.com>
|
||||
* tag_tree.list: add tags to make allowed list more complete.
|
||||
Omission noticed by Marcel Mettes.
|
||||
2006-06-14 David Anderson <davea@sgi.com>
|
||||
* print_frames.c: Clean up printing of augmentation data by
|
||||
eliminating dangling 0x (for eh_frame).
|
||||
2006-04-28 David Anderson <davea@sgi.com>
|
||||
* dwarfdump.conf: Now has x86_64 register names.
|
||||
x86_64 with help from Tom Hughes (verified
|
||||
from independent sources).
|
||||
Added m68k register names and refined x86 list
|
||||
by looking at various information-sources.
|
||||
2006-04-18 David Anderson <davea@sgi.com>
|
||||
* *.c: Ran indent so all now follow a standard look.
|
||||
* dwconf.c: Added fclose(conf_stream).
|
||||
2006-04-18 David Anderson <davea@sgi.com>
|
||||
* dwarfdump.c: Forgot to call key new functions for
|
||||
handling variable-size frame data and different
|
||||
frame rule initialization value.
|
||||
* dwconf.c: Add a default print for CFA in case of
|
||||
an omission in dwarfdump.conf.
|
||||
* dwarfdump.conf: Move setup and rename the ABIs slightly.
|
||||
2006-04-17 David Anderson <davea@sgi.com>
|
||||
* dwarfdump.conf: Correct typos. Remove some register names.
|
||||
* dwarfdump.c: Fix compiler warnings, fix -x option usage message.
|
||||
* dwconf.h: Fix compiler warnings by changing types.
|
||||
* dwconf.c: Change error checking so we check all errors, do
|
||||
not stop at first error. Ran indent. Added code to check
|
||||
for extra junk after operand(s).
|
||||
* print_frames.c: Fix compiler warnings.
|
||||
* Makefile.in: get <prefix> used in install rule and creating
|
||||
places to search for dwarfdump.conf
|
||||
2006-04-16 David Anderson <davea@sgi.com>
|
||||
* dwarfdump.conf: New dwarfdump configuration file. Makes using frame
|
||||
information easy to read and correct for any ABI/ISA
|
||||
without rebuilding dwarfdump.
|
||||
* Makefile.in: Added new files dwconf.h dwconf.c
|
||||
* dwconf.h dwconf.c: New files implement reading dwarfdump.conf
|
||||
and help print_frames.c print frame information correctly
|
||||
for ABIs specified at runtime.
|
||||
* dwarfdump.1: document -x commands.
|
||||
* globals.h: Minor changes to support dwarfdump.conf
|
||||
* print_frames.c: Major changes to support a run-time description of
|
||||
the frames info and dwarfdump.conf.
|
||||
* print_frames.h: Changes to support a run-time description of
|
||||
the frames info and dwarfdump.conf.
|
||||
* print_sections.c: Minor tweaks to support a run-time
|
||||
description of the frames info and dwarfdump.conf.
|
||||
|
||||
2006-03-31 David Anderson <davea@sgi.com>
|
||||
* Makefile.in globals.h print_sections.c: Refer to new
|
||||
print_frames.h print_frames.c.
|
||||
* print_frames.h print_frames.c: Extract cie, fde printing
|
||||
to separate file, separating loop logic from the printing
|
||||
of an entry from the loop.
|
||||
2006-03-31 David Anderson <davea@sgi.com>
|
||||
* dwarfdump.c global.h print_sections.c: Preparing for
|
||||
dwarf3 frame interface.
|
||||
* print_die.c: Corrects handling of DW_AT_encoding (etc) value.
|
||||
2006-03-29 David Anderson <davea@sgi.com>
|
||||
* print_sections.c: define DWARFDUMP_TURN_OFF_MIPS_REG_NAMES
|
||||
at compile time
|
||||
to turn off the MIPS register names printing. Instead
|
||||
(aside from cfa) use a name like r4 (where the DWARF
|
||||
register number follows the letter 'r').
|
||||
Indent. Initialize some local variables at declarations.
|
||||
2006-03-13 David Anderson <davea@sgi.com>
|
||||
* print_sections.c: Now gets gnu eh_augmentation data by calling
|
||||
dwarf_get_cie_augmentation_data() or dwarf_get_fde_augmentation_data()
|
||||
and prints it (use -v to see cie data).
|
||||
Now prints DWARF3 frame information.
|
||||
2006-03-08 David Anderson <davea@sgi.com>
|
||||
* print_sections.c: Add 'break;' at line 710.
|
||||
Thanks to Richard Stuckey for noticing.
|
||||
2005-12-01 David Anderson <davea@sgi.com>
|
||||
* dwarf_names.awk: use snprintf instead of sprintf for safety.
|
||||
2005-12-01 David Anderson <davea@sgi.com>
|
||||
* Makefile.in: Build attr/tag trees with
|
||||
individual commands to catch build errors.
|
||||
* tag_attr.c,tag_tree.c: Verify that
|
||||
tables fit in the generated C code and check for
|
||||
format errors in the *.list files.
|
||||
* tag_attr.list, tag_tree.list: Added some valid entries.
|
||||
* globals.h: add DWARF_ERROR3 macro for better diagnostics.
|
||||
* print_die.c: Show both sides of questionable tag relation
|
||||
in CHECK -k diagnostic output.
|
||||
|
||||
2005-11-25 David Anderson <davea@sgi.com>
|
||||
* print_die.c: DW_AT_stride_size changed to DW_AT_bit_stride,
|
||||
added DW_AT_byte_stride.
|
||||
* tag_attr.c,tag_tree.c: fixed array size now a #define for
|
||||
readability.
|
||||
* tag_attr.list: Added DWARF3 attributes, also new TAGs.
|
||||
* tag_tree.list: Added DWARF3 TAGs.
|
||||
|
||||
2005-11-08 David Anderson <davea@sgi.com>
|
||||
* makename.c: remove non-standard malloc.h include,
|
||||
stdlib.h suffices and is already included.
|
||||
|
||||
2005-10-24 David Anderson <davea@sgi.com>
|
||||
* tag_attr.c tag_tree.c: added DWARF3 TAGs to string array.
|
||||
|
||||
2005-08-01 David Anderson <davea@sgi.com>
|
||||
* Makefile.in: Add esb.o and test rule (test code for esb.c).
|
||||
* dwarfdump.c: Remove old static buffer initialization.
|
||||
* print_die.c: Use esb now, avoid crash due to long loclist
|
||||
overrunning static buffer. Uses snprintf now, not sprintf.
|
||||
snprintf is for safety.
|
||||
* esb.h esb.c: Adding extensible string buffer (esb) code.
|
||||
* testesb.c: Test code for esb.c.
|
||||
* print_reloc.c: size field is now Elf64_Xword for
|
||||
Elf64 as Elf64_Word is only 32 bits.
|
||||
|
||||
2005-07-15 David Anderson <davea@sgi.com>
|
||||
* dwarfdump.c: Add print of .debug_pubtypes, remove
|
||||
erroneous dealloc after dwarf_formstring() call.
|
||||
* globals.h: Add declarations for .debug_pubtypes print. Add
|
||||
declaration for full dealloc.
|
||||
* print_die.c: Remove erroneous dealloc after dwarf_formstring() call.
|
||||
* print_exception_tables.c: Call dwarf_fde_cie_list_dealloc()
|
||||
for complete dealloc.
|
||||
* print_sections.c: Remove incorrect dealloc() call.
|
||||
Add calls to new dealloc routines. Add support of .debug_pubtypes
|
||||
print.
|
||||
2005-07-14 David Anderson <davea@sgi.com>
|
||||
* print_sections.c (print_line_numbers_this_cu): Use new
|
||||
dwarf_srclines_dealloc() for deallocation after
|
||||
dwarf_srclines() called.
|
||||
|
||||
2005-04-13 David Anderson <davea@sgi.com>
|
||||
* print_sections.c: Factors out common print code into
|
||||
a new routine. Avoid indexing past end of register names
|
||||
array. Adds checks and prints so that certain errors
|
||||
in pubnames-like sections are printed usefully (and dwarfdump
|
||||
then stops if libdwarf gave an error).
|
||||
|
||||
2005-03-21 David Anderson <davea@sgi.com>
|
||||
* dwarfdump.c: Add -F flag to
|
||||
request .eh_frame section print. Changed -f flag meaning
|
||||
to print .debug_frame only. -a flag no longer
|
||||
prints .debug_frame by default.
|
||||
* print_sections.c: avoid printing an eh_frame we don't understand.
|
||||
Add new information per CU when printing line info: specifically
|
||||
the line section offset.
|
||||
* globals.h: Added arguments to print_frames() for -F flag.
|
||||
|
||||
2005-03-18 David Anderson <davea@sgi.com>
|
||||
* print_sections.c: Correct macro section printing.
|
||||
|
||||
2004-10-28 David Anderson <davea@sgi.com>
|
||||
* DWARFDUMPCOPYRIGHT config.h defs.h dwarfdump.c globals.h
|
||||
makename.c makename.h print_die.c print_exception_tables.c
|
||||
print_reloc.c print_sections.c tag_attr.c tag_attr.list
|
||||
tag_tree.c tag_tree.list: Copyright update, SGI
|
||||
corporate address change.
|
||||
|
||||
2004-10-26 David Anderson <davea@sgi.com>
|
||||
* acconfig.h: removed. Was old style autoconf usage.
|
||||
* configure.in: Updated AC_DEFINE usage, adding args 2 & 3.
|
||||
* config.guess: Updated. timestamp='2004-06-11'.
|
||||
* config.sub: Updated. timestamp='2004-03-12'.
|
||||
* configure config.h.in: regenerated with autoconf 2.58.
|
||||
|
||||
2004-05-14 David Anderson <davea@sgi.com>
|
||||
|
||||
* print_die.c (print_die_and_children): Change to iteration
|
||||
on siblings (still recursing on children).
|
||||
|
||||
|
||||
2004-03-30 David Anderson <davea@sgi.com>
|
||||
* dwarfdump.c (main): getopt() string should contain k:g
|
||||
not kg: Thanks to Peter Seiderer for pointing this out.
|
||||
|
||||
2003-12-31 David Anderson <davea@sgi.com>
|
||||
* README: Added configure example.
|
||||
* Makefile.in: Removed bogus LIBS line, updated copyright date.
|
||||
* acconfig.h: Added LGPL copyright to match libdwarf
|
||||
Silly, but it matches libdwarf version boilerplate.
|
||||
* config.guess config.sub: new versions from automake-1.6.
|
||||
* config.h.in configure: Regenerated.
|
||||
|
||||
|
||||
2003-10-06 David Anderson <davea@sgi.com>
|
||||
* dwarfdump.c print_sections.c: applied indent(1).
|
||||
* print_die.c: applied indent and added ; after
|
||||
invocations of macros PUSH_DIE_STACK POP_DIE_STACK SPACE
|
||||
as these were confusing indent a bit.
|
||||
The indent control file .indent.pro contained:
|
||||
-bad -bap -nbbo -br -ce -brs
|
||||
-l72 -lc72 -hnl -nprs
|
||||
-fca -i4 -lp -psl -npcs
|
||||
|
||||
|
||||
|
||||
2003-10-02 David Anderson <davea@sgi.com>
|
||||
* dwarfdump.c: Add -g to indicate use of older
|
||||
location entry code in libdwarf. So dwarf_loclist
|
||||
and dwarf_loclist_n are testable.
|
||||
* globals.h: Added use_old_dwarf_loclist flag so one
|
||||
can choose the old dwarf_loclist() interface.
|
||||
For testing.
|
||||
* print_die.c: Rearranged to avoid code duplication.
|
||||
Now supports .debug_loc fully.
|
||||
* print_sections.c: Prints .debug_loc now.
|
||||
|
||||
2003-09-29 David Anderson <davea@sgi.com>
|
||||
|
||||
* print_die.c: with -v, print 'loclist' start and
|
||||
end addr and also a hint that DW_FORM_indirect is used.
|
||||
No change for normal output (for now).
|
||||
|
||||
2003-05-19 David Anderson <davea@sgi.com>
|
||||
* dwarfdump.c call dwarf_srcfiles() to get file names
|
||||
per cu and pass down to die print routines.
|
||||
Removed incorrect tests for when to print ".debug_info",
|
||||
leaving simpler test.
|
||||
* print_die.c globals.h: print file name (from line info)
|
||||
with DW_AT_decl_file, adding data from dwarf_srcfiles
|
||||
to argument list of a few routines to make that possible.
|
||||
* print_sections.c: moved "line number info" string print so
|
||||
it prints for -v as well as normal line ouput.
|
||||
|
||||
2002-10-23 Amaury Le Leyzour amaury@sgi.com
|
||||
* print_sections.c (print_weaknames): Changed
|
||||
DW_DLA_TYPENAME to DW_DLA_WEAK at dwarf_dealloc().
|
||||
|
||||
2002-10-22 Tom Hughes <thh@cyberscience.com>
|
||||
* print_sections.c: macro printing now supported.
|
||||
* dwarfdump.c: removed erroneous dwarf_dealloc()
|
||||
of string returned by dwarf_errmsg().
|
||||
|
||||
2002-11-22 David Anderson <davea@sgi.com>
|
||||
* dwarf_names.awk at_list.awk: Allow an name to have two
|
||||
spellings so the historical name preserved yet the dwarf3
|
||||
version is supported. First name seen is used/reported
|
||||
by dwarfdump.
|
||||
* dwarf.h: DW_TAG_template_type_param(eter)
|
||||
DW_TAG_template_value_param(eter) DW_AT_namelist_itm(s)
|
||||
are the ones with alternate spellings now.
|
||||
Added Universal Parallel C TAGs/Attributes in
|
||||
user namespace.
|
||||
* tag_attr.c tag_attr.list tag_tree.c tag_tree.list:
|
||||
Use the DW_TAG_template_* dwarf3 spellings.
|
||||
|
||||
|
||||
2002-05-08 David Anderson <davea@sgi.com>
|
||||
* tag_attr.list dwarf.h: DW_AT_namelist_items is
|
||||
wrong, changed to DW_AT_namelist_item
|
||||
|
||||
2002-04-29 Stephen Clarke <stephen.clarke@superh.com>
|
||||
* dwarfdump.c (main): #ifdef for __CYGWIN__ on open().
|
||||
|
||||
2001-06-14 David Anderson <davea@sgi.com>
|
||||
|
||||
* print_sections.c: Calling the new libdwarf function
|
||||
dwarf_get_arange_cu_header_offset() so we can print
|
||||
the cu header offset for aranges.
|
||||
|
||||
|
||||
2000-07-14 Fred Fish <fnf@ninemoons.com>
|
||||
|
||||
* configure.in (LOCATION_OF_LIBELFHEADER): Fix typo for configure
|
||||
variable to be tested and enclose libelf/libelf.h in <>.
|
||||
* configure: Regenerated.
|
||||
|
||||
2000-07-10 Fred Fish <fnf@ninemoons.com>
|
||||
|
||||
* Makefile.in (install): Install dwarfdump.1 from $(srcdir).
|
||||
|
||||
2000 June 12 davea@sgi.com
|
||||
print_sections.c the DW_CFA_offset_extended print
|
||||
did not multiply by data-alignment factor in the
|
||||
-v -v detailed output.
|
||||
And the offsets used %2d when the values were
|
||||
unsigned int, so now %2u.
|
||||
|
||||
And not all cfa prints of values had
|
||||
necessarily a type to match
|
||||
%llu or %lld where required. Depended on the size of Dwarf_Signed
|
||||
and Dwarf_Unsigned.
|
||||
So now explicitly use cast to the
|
||||
right type to match the % format.
|
||||
2000 April 13 davea@sgi.com
|
||||
print_sections.c - 1.56
|
||||
- A single byte of zero is a perfectly legitmate null
|
||||
abbreviation entry (in .debug_abbrev)
|
||||
now we print those directly and avoid a warning
|
||||
from dwarfdump
|
||||
|
||||
print_die.c - 1.42
|
||||
- Explain what combo checker is doing and make it
|
||||
more maintainable (and fix bug which would
|
||||
not be hit, but was real enough (in combo checker),
|
||||
using too large a number as highest tag number).
|
||||
|
||||
tag_tree.list - 1.2
|
||||
- Add valid parent/child relationships so checker
|
||||
does not report valid entries as bogus.
|
||||
|
||||
|
||||
|
||||
|
||||
2000 Feb 24
|
||||
Jason Merrill <jason@cygnus.com> noticed that gcc did
|
||||
not like gcc -E foo.list, so incorporated his fix so
|
||||
now the Makefile.in makes a link and does gcc -E _tmp.c
|
||||
|
||||
2000 Jan 26
|
||||
elena.demikhovsky@intel.com noticed that 3 statements in
|
||||
print_sections.c got warnings from the compiler
|
||||
she was using. Simple casts (provided by her) fixed these.
|
||||
|
||||
1999 July 21
|
||||
davea@sgi.com
|
||||
print_sections changed to allow printing
|
||||
of dwarf-ish egcs c++ .eh_frame data
|
||||
|
||||
|
||||
1999 June 14
|
||||
Fred Fish fnf@ninemoons.com contributed
|
||||
autoconf'ing of the libdwarf and dwarfdump source.
|
||||
|
||||
|
||||
|
||||
1999 June 10
|
||||
ChangeLog started. davea@sgi.com David Anderson
|
108
dwarf-compilation.base/contrib/libdwarf/dwarfdump/ChangeLog2007
Normal file
108
dwarf-compilation.base/contrib/libdwarf/dwarfdump/ChangeLog2007
Normal file
|
@ -0,0 +1,108 @@
|
|||
2007-12-09 DavidAnderson <davea42@earthlink.net>
|
||||
* print_sections.c print_frames.c: Forgot to commit yesterday.
|
||||
yesterday's commit includes renaming _dwarf_fde_section_offset
|
||||
_dwarf_cie_section_offset, _dwarf_print_lines, _dwarf_ld_sort_lines
|
||||
to dwarf_* form while retaining support for the now obsolete
|
||||
_dwarf_* form.
|
||||
2007-12-08 DavidAnderson <davea42@earthlink.net>
|
||||
* config.h.in, configure.in: Latest linux libelf.h requires
|
||||
_GNU_SOURCE to get off64_t defined so dwarfdump compiles.
|
||||
Only define _GNU_SOURCE if libelf.h defines off64_t.
|
||||
Regenerated configure.
|
||||
* config.guess, config.sub: Updated to 2.61
|
||||
* acconfig.h: Deleted, removing autoconf complaint.
|
||||
2007-10-15 DavidAnderson <davea42@earthlink.net>
|
||||
* print_die.c (clean_up_die_esb): New function
|
||||
cleans up malloc space.
|
||||
* print_reloc.c (clean_up_syms_malloc_data): New function
|
||||
cleans up malloc space.
|
||||
* dwarfdump.c (main): Call new cleanup functions at end.
|
||||
* globals.h: Declare new cleanup functions.
|
||||
|
||||
2007-09-04 DavidAnderson <davea42@earthlink.net>
|
||||
* print_die.c (print_attribute): For DWARF4: DW_AT_high_pc:
|
||||
add qualifier to value when the value is an offset from
|
||||
DW_AT_low_pc (thus not itself a address).
|
||||
Update the address of the FSF.
|
||||
* print_frames.h DWARFDUMPCOPYRIGHT print_sections.c
|
||||
print_reloc.c dwarfdump.c tag_tree.c tag_attr.c
|
||||
esb.c esb.h makename.c acconfig.h dwconf.c makename.h
|
||||
dwconf.h globals.h print_frames.c:
|
||||
Update the address of the FSF.
|
||||
|
||||
2007-07-03 DavidAnderson <davea42@earthlink.net>
|
||||
* print_sections.c (dump_block): Removed superfluous return byte from
|
||||
printed characters. Removed unused variables.
|
||||
* print_die.c: A little refactoring for clarity.
|
||||
* globals.h: dwarfdump_print_one_locdesc() is now a
|
||||
global-to-dwarfdump function.
|
||||
* print_frames.c: Now (with -v) prints dwarf expression bytes
|
||||
in frame expressions readably.
|
||||
2007-07-02 DavidAnderson <davea42@earthlink.net>
|
||||
* dwarfdump.c: Add new -R option for 'generic' register sets.
|
||||
* dwarfdump.1: document -R, add new -x documentation.
|
||||
* dwconf.c: Set up -R configuration. Slight revision of
|
||||
register printing code.
|
||||
* dwconf.h: Interface to register name printing simplified.
|
||||
* print_frames.c: Use the simpler register name interface.
|
||||
* dwarfdump.conf: Add new 'generic' abi for up to 1000 registers.
|
||||
|
||||
2007-07-01 DavidAnderson <davea42@earthlink.net>
|
||||
* print_frames.c: For DW_CFA_def_cfa_sf & DW_CFA_def_cfa_offset_sf
|
||||
print a computed data alignment factor.
|
||||
2007-06-29 DavidAnderson <davea42@earthlink.net>
|
||||
* dwarfdump.1: Corrected spelling error.
|
||||
2007-05-25 DavidAnderson <davea42@earthlink.net>
|
||||
* dwconf.h dwconf.c: Changed field name to
|
||||
cf_named_regs_table_size as old name was less than clear.
|
||||
* dwarfdump.c: Call frame table setup with
|
||||
cf_table_entry_count not cf_named_regs_table_size. The newly
|
||||
renamed field makes it clearer the call was wrong.
|
||||
2007-05-04 DavidAnderson <davea42@earthlink.net>
|
||||
* print_die.c: printing of global offset of DIEs
|
||||
with -G is now more in the style of previous output.
|
||||
2007-04-18 Chris Quenelle <chris.quenelle@sun.com>
|
||||
* Makefile.in:
|
||||
- use $(srcdir) for files in source directory
|
||||
- support running rules in parallel by
|
||||
- use different tmp file names in different rules.
|
||||
- use more accurate target for dwarf_names.{c,h}
|
||||
* dwarf_names.awk: Enhance script to be able to generate either
|
||||
#define-style headers or enum-style headers
|
||||
* dwarfdump.c: dump most everything by default if no arguments
|
||||
are given to dwarfdump. This seems to be a more useful default
|
||||
than showing nothing at all. Also add a -G option to show
|
||||
the (G)lobal section offset for each die within an a.out. If you
|
||||
think you're seeing data corruption inside a .debug_info
|
||||
section, this is a useful option to have.
|
||||
* print_die.c: Support compressed integer blocks. This is an
|
||||
array (DW_FORM_block) of LEB numbers used as part of a Sun
|
||||
extension, DW_AT_SUN_func_offsets. Also add support for
|
||||
a new dwarf enum DW_ATCF_xxxx. This is used in DW_AT_SUN_cf_kind.
|
||||
Also, fix DW_AT_upper_bound so it can be a constant or a location
|
||||
list. DW_AT_count and DW_AT_data_member_location should also be
|
||||
fixed eventually.
|
||||
* print_sections.c: Changes to support zero-padding in the middle of
|
||||
section data. Change offset labels to be a little more clear.
|
||||
Not sure about the get_str failure.
|
||||
* tag_tree.list: DW_TAG_compile_unit can contain a DW_TAG_namespace
|
||||
2007-04-10 David Anderson <davea42@earthlink.net>
|
||||
* print_reloc.c dwarfdump.c print_frames.c: Unified
|
||||
copyright to the SGI form. No copyright change.
|
||||
|
||||
2007-04-06 David Anderson <davea42@earthlink.net>
|
||||
* print_die.c (print_die_and_children): Increase static
|
||||
depth of die stack. Notice if it overflows and
|
||||
print error.
|
||||
2007-02-23 David Anderson <davea42@earthlink.net>
|
||||
* print_reloc.c: 2 lines added (long) cast in printf
|
||||
and made %3ld instead of %3d to fix compiler warning.
|
||||
* print_frames.c: newline was missing from the output.
|
||||
Thanks to Chris Quenelle for noticing.
|
||||
2007-02-20 David Anderson <davea42@earthlink.net>
|
||||
* print_frame.c (print_frame_inst_bytes): Fixed
|
||||
an off by one error (several places)
|
||||
when printing dwarf expressions and added commentary about it.
|
||||
Thanks to Julian Seward for pointing out it was off by one.
|
||||
* dwarfdump.c (print_error): added fflush of stdout, stderr
|
||||
where we are going to exit right away anyway.
|
|
@ -0,0 +1,96 @@
|
|||
2008-12-30 David Anderson <davea42@earthlink.net>
|
||||
* tag_attr.list: Mark DW_AT_artificial as sensible on
|
||||
DW_TAG_variable.
|
||||
* dwarfdump.1: Document -N option to print .debug_ranges.
|
||||
* Makefile.in: add new source header files
|
||||
* dwarfdump.c: Implement -N to print .debug_ranges.
|
||||
* print_sections.c: Allow more flexible printing
|
||||
of function names for .debug_frame section.
|
||||
With -N, print .debug_ranges.
|
||||
* print_die.c: Print .debug_ranges details.
|
||||
* print_frames.c: Delete useless comment.
|
||||
* globals.h: Allow re-use of debug_ranges formatting code.
|
||||
* Makefile.in: Make the header dependency list more complete.
|
||||
* makename.h: Comment tweaked.
|
||||
2008-12-08 David Anderson <davea42@earthlink.net>
|
||||
* print_die.c: the -M option now also prints the form
|
||||
number (after the form name). And -v prints the DIE
|
||||
abbreviation code, the index into the relevant abbreviation
|
||||
table.
|
||||
* globals.h: Removed unused global variable.
|
||||
* dwarfdump.c: Removed unused global variable.
|
||||
* dwarfdump.1: document -M and the new -v features.
|
||||
2008-12-07 David Anderson <davea42@earthlink.net>
|
||||
* print_reloc.c (print_relocinfo): Removed unused local variable.
|
||||
2008-11-19 David Anderson <davea42@earthlink.net>
|
||||
* globals.h: Added new boolean to support -M.
|
||||
* dwarfdump.1: Mentioning the -M option.
|
||||
* dwarfdump.c: Implementing -M, which has each attribute line
|
||||
show the name of the form.
|
||||
* print_die.c: Implementing -M option.
|
||||
2008-10-12 David Anderson <davea42@earthlink.net>
|
||||
* dwarfdump.conf: Adding power pc register names and table
|
||||
size for use with -x abi=ppc .
|
||||
2008-08-13 David Anderson <davea42@earthlink.net>
|
||||
* dwarfdump.1: When no options (just object files) present
|
||||
all sections print, now we say that. Renamed fields
|
||||
in synopsis for readability.
|
||||
2008-06-23 David Anderson <davea42@earthlink.net>
|
||||
* print_reloc.c (print_reloc_information_64): Was testing
|
||||
sym_data_entry_count one place where sym_data_64_entry_count
|
||||
should have been tested. Thanks to Carlos Alberto Enciso
|
||||
for noticing.
|
||||
2008-06-17 David Anderson <davea42@earthlink.net>
|
||||
* print_die.c: Add to dwarf_formstring failure message.
|
||||
* README: Correct email: the old sgi.com address is no
|
||||
longer correct.
|
||||
2008-06-13 David Anderson <davea42@earthlink.net>
|
||||
* dwconf.c: Fix an off-by-one condition where
|
||||
we could index off the end of the cf_regs array in printing
|
||||
a register name.
|
||||
2008-04-12 David Anderson <davea42@earthlink.net>
|
||||
* print_reloc.c: Verify stringtab exists and is
|
||||
large enough before indexing into it to get a string
|
||||
in printing relocations.
|
||||
(Providing default name "<no name>" so it's evident from
|
||||
the output that we used a default name string).
|
||||
2008-04-09 David Anderson <davea42@earthlink.net>
|
||||
* print_sections.c (get_fde_proc_name): Initialize some
|
||||
local variables at declaration. The function is very slow
|
||||
and needs a replacement.
|
||||
* print_die.c: Fixes a typo in a comment.
|
||||
* dwarfdump.c: Added -n option to suppress function name search
|
||||
when printing FDEs. Current dwarfdump is n-squared at least
|
||||
getting those names, this is a bandage-type-workaround when
|
||||
there are so many FDEs the slowness is painful.
|
||||
* globals.h: Support for -n option.
|
||||
* print_frames.c: Support for -n option.
|
||||
2008-04-08 David Anderson <davea42@earthlink.net>
|
||||
* dwarfdump.c: Added -H option for testing
|
||||
(it limits the run length).
|
||||
And the support for -H in printing DIEs.
|
||||
* globals.h: Added extern for -H option declaration.
|
||||
* print_sections.c: Added -H option support to limit frames printing.
|
||||
|
||||
2008-04-04 David Anderson <davea42@earthlink.net>
|
||||
* print_die.c (tag_tree_combination, tag_attr_combination):
|
||||
Ensure we do not index off the end of the -k checking arrays.
|
||||
* print_sections.c: Increase the size of a local variable,.
|
||||
2008-03-03 David Anderson <davea42@earthlink.net>
|
||||
* dwarfdump.1: Add description of -ka option.
|
||||
* print_frames.h print_sections.c testesb.c print_die.c print_reloc.c
|
||||
dwarfdump.c tag_tree.c tag_attr.c esb.c esb.h makename.c dwconf.c
|
||||
makename.h dwconf.h globals.h print_frames.c: Change tabs
|
||||
to spaces with expand(1).
|
||||
2008-03-03 David Anderson <davea42@earthlink.net>
|
||||
* print_die.c: Now check that DW_AT_decl_file
|
||||
and DW_AT_call_file indexes are valid and count instances of the
|
||||
attribute and errors found in it.
|
||||
* dwarfdump.c: With -ka and -ky now check that DW_AT_decl_file
|
||||
and DW_AT_call_file indexes are valid and warn if bad.
|
||||
Thanks to Carlos Alberto Enciso for the suggestion.
|
||||
* globals.h: Declare new fields for the DW_AT_decl_file
|
||||
DW_AT_call_file checks.
|
||||
2008-02-26 David Anderson <davea42@earthlink.net>
|
||||
* print_die.c (get_attr_value): Print DW_AT_call_file,
|
||||
DW_AT_call_line, DW_AT_call_column nicely.
|
280
dwarf-compilation.base/contrib/libdwarf/dwarfdump/ChangeLog2009
Normal file
280
dwarf-compilation.base/contrib/libdwarf/dwarfdump/ChangeLog2009
Normal file
|
@ -0,0 +1,280 @@
|
|||
2009-12-30 DavidAnderson <davea42@earthlink.net>
|
||||
* configure: Regenerated with autoconf 2.64.
|
||||
* config.guess, config.sub: Delete these, best not
|
||||
to have them.
|
||||
2009-11-24 DavidAnderson <davea42@earthlink.net>
|
||||
* tag_common.h: Updated 'standard tag table row' and
|
||||
tag table column maximums now the DWARF4 entries are
|
||||
in the .list files. Removed dos 'CR' characters at line ends.
|
||||
* tag_tree.list, tag_attr.list: Added various
|
||||
DWARF4 entries and added DW_TAG_enumeration_type
|
||||
under DW_TAG_union_type.
|
||||
2009-11-17 DavidAnderson <davea42@earthlink.net>
|
||||
* dwarfdump.1: Document the -u option more fully.
|
||||
* print_die.c: Check for both info_flag and
|
||||
cu_name_flag to decide when to print DIEs.
|
||||
2009-10-12 DavidAnderson <davea42@earthlink.net>
|
||||
* dwarfdump.c: Updated dwarfdump version string to today.
|
||||
2009-09-30 DavidAnderson <davea42@earthlink.net>
|
||||
* dwarfdump.c: Added globals for aranges checking and
|
||||
to print the resulting error count.
|
||||
* print_aranges.c: Added checking that all 3 ways
|
||||
of computing a cu_die_offset from an arange get
|
||||
the same offset (checked with -r -ka).
|
||||
* print_frames.c: DW_CFA_cfa_offset_extended_sf
|
||||
corrected to DW_CFA_offset_extended_sf.
|
||||
2009-09-01 DavidAnderson <davea42@earthlink.net>
|
||||
* tag_tree.list: We add
|
||||
DW_TAG_class_type as a valid child of a DW_TAG_union_type.
|
||||
2009-08-05 DavidAnderson <davea42@earthlink.net>
|
||||
* gennames.c: Change include from getopt.h to unistd.h
|
||||
so the code is more universally compilable.
|
||||
2009-07-24: David Anderson <davea42@earthlink.net>
|
||||
* tag_attr.c: Remove duplicate include of naming.h.
|
||||
2009-06-23: David Anderson <davea42@earthlink.net>
|
||||
* strstrnocase.c: Corrected typo in TEST code and
|
||||
added a new test.
|
||||
2009-06-22: David Anderson <davea42@earthlink.net>
|
||||
* Makefile.in: switched to personally written
|
||||
string comparison, strstrnocase.c.
|
||||
* stristr.c: deleted.
|
||||
* strstrnocase.c: New code, written by me so no
|
||||
license issues.
|
||||
* print_die.c: Call is_strstrnocase(), the new function.
|
||||
* dwarfdump.1: More fully document -S.
|
||||
* globals.h: Create extern for is_strstrnocase().
|
||||
2009-06-18: David Anderson <davea42@earthlink.net>
|
||||
* configure: Regenerated.
|
||||
* Makefile.in: Add stristr.o
|
||||
* stristr.c: public domain source added to dwarfdump
|
||||
* print_die.c: Add code and arguments to support -S.
|
||||
* print_lines.c: print_one_die argument list changed, added
|
||||
the require argument..
|
||||
* dwarfdump.c: Added the -S option.
|
||||
|
||||
* configure.in: Add test to set HAVE_REGEX for the -S option.
|
||||
* dwarfdump.1: Document the -S options.
|
||||
* config.h.in: Set the default HAVE_REGEX
|
||||
* globals.h: Add -S globals, change the print_one_die()
|
||||
prototype to support -S.
|
||||
* print_aranges.c: Alter the print_one_die calls added
|
||||
to support -S.
|
||||
2009-06-06: David Anderson <davea42@earthlink.net>
|
||||
* naming.c,naming.h: New files that implement the
|
||||
ellipsis functionality of dwarfdump and defer to
|
||||
libdwarf to get the names of the TAGs, attributes, FORMs, etc.
|
||||
* gennames.c: This file has moved to libdwarf, no longer
|
||||
present in dwarfdump.
|
||||
* esb.h, esb.c: Change certain char* arguments to const char*
|
||||
to avoid compiler warnings.
|
||||
* print_static_vars.c,print_static_funcs.c,
|
||||
print_sections.c,print_strings.c, print_locs.c,
|
||||
print_lines.c, print_pubnames.c,print_ranges.c,
|
||||
print_macros.c,print_types.c,tag_common.c,
|
||||
print_weaknames.c, print_aranges.c: Include
|
||||
changed from dwarf_names.h to naming.h
|
||||
* tag_common.h: Removed the tag_name array, libdwarf
|
||||
provides the TAG, ATTR, etc name strings now.
|
||||
* dwarfdump.c: Updated DWARFDUMP_VERSION string.
|
||||
* tag_tree.c,tag_attr.c: Include changed from dwarf_names.h to
|
||||
naming.h. simplified long complicated lines, remove dbg argument
|
||||
to get_TAG_name.
|
||||
* print_die.c,print_abbrevs.c: Include changed from dwarf_names.h
|
||||
to naming.h.
|
||||
Calls to get_TAG_name (etc) no longer have a dbg argument.
|
||||
* Makefile.in: We no longer build generated file names.c,
|
||||
we build naming.c (hand coded, not generated).
|
||||
2009-05-07: David Anderson <davea42@earthlink.net>
|
||||
* dwarfdump.cc: updated DWARF_VERSION string.
|
||||
* Makefile.in: dwarf_names* are now generated by C,
|
||||
so 'clean' now cleans them out.
|
||||
2009-05-04: David Anderson <davea42@earthlink.net>
|
||||
* common.h, common.c: Extracted simple utility routines
|
||||
into their own files.
|
||||
* dwarf_names.awk, at_list.awk: deleted. gennames.c replaces these.
|
||||
* tag_common.c, tag_common.h: Removed the simple utility
|
||||
routines from these files to simplify dependencies.
|
||||
* tag_attr.c, tag_tree.c: Include new common.h.
|
||||
* print_frames.c: Adding address_size argument to call.
|
||||
* print_frames.h: Adding new address_size argument to
|
||||
get_string_from_locs() declaration.
|
||||
* print_locs.c: Gets and uses CU-specific address_size.
|
||||
* print_ranges.c: Adding commentary.
|
||||
* print_die.c: adding DIE argument to ensure correct
|
||||
address size used for the CU in question.
|
||||
* Makefile.in: Now handles common.* and gennames.c changes.
|
||||
* gennames.c: New code emitting string 'get name' source.
|
||||
Replaces awk source.
|
||||
2009-04-04: David Anderson <davea42@earthlink.net>
|
||||
* Makefile.in: clean up 'clean' and 'distclean'
|
||||
so that distributed files are not cleaned out by 'clean'
|
||||
and all generated files (even those shipped in
|
||||
distribution) are cleaned out by distclean.
|
||||
* dwarfdump.c: Now calls the new
|
||||
libdwarf function dwarf_set_frame_cfa_value() and other
|
||||
such functions to specify all the values libdwarf needs.
|
||||
* dwarfdump.conf: Sets the cfa_reg: value to
|
||||
a new higher value (1436) to avoid conflict with largest
|
||||
known register count.
|
||||
* dwconf.h: Corrected commentary on DW_FRAME_CFA_COL3.
|
||||
* dwconf.c: Now uses DW_FRAME_CFA_COL3 as default for
|
||||
interface 3, rather than a directly typed number.
|
||||
Sets undefined-value and same-value pseudo-register numbers.
|
||||
2009-04-03: David Anderson <davea42@earthlink.net>
|
||||
* dwarfdump.1: Amplified -R and -x abi= documentation.
|
||||
* dwarfdump.conf: Added generic500 generic100 abis.
|
||||
2009-03-29: David Anderson <davea42@earthlink.net>
|
||||
* print_die.c: Moved print_infos() to here.
|
||||
* dwarfdump.c: Moved print_infos() out of here.
|
||||
* globals.h: Declarations changed to allow moving
|
||||
print_infos().
|
||||
* dwarf_names.awk: Eliminate a pointless space before
|
||||
a newline in the generated code.
|
||||
* print_locs.c: Add -v section offset output to loclist printing
|
||||
of the debug_loc section so the entries can be matched to
|
||||
loclist printing initiated from .debug_info.
|
||||
2009-03-24: David Anderson <davea42@earthlink.net>
|
||||
* README: Would be nice if all could use dwarfdump2,
|
||||
not this C dwarfdump.
|
||||
* dwconf.c: Initialize new frame regs configure data and
|
||||
parse it in the .conf file. Fixed old formatting mistakes.
|
||||
* dwconf.h: Add new fields to frame regs configure struct. Make -R
|
||||
be 1200 regs so that -R covers all the currently popular ABIs.
|
||||
* print_die.c, print_lines.c, print_frames.c: Change %# to
|
||||
0x% so that zero prints with leading 0x consistently.
|
||||
* dwarfdump.c: -R is now 1200 registers. So config function
|
||||
changed and usage message needed update.
|
||||
* dwarfdump.1: Change -R to 1200 and document -C.
|
||||
* dwarfdump.conf: Add same_val_reg: and undefined_val_reg:
|
||||
initial values where needed or interesting.
|
||||
* print_macros.c: Fix old formatting mistake.
|
||||
2009-03-23: David Anderson <davea42@earthlink.net>
|
||||
* print_sections.h: New file for print_*.c
|
||||
sources.
|
||||
* dwarfdump.1: Added -C documentation.
|
||||
* Makefile.in: updated 'mandir' so it works with
|
||||
current configure (so now make install properly installs
|
||||
the man page).
|
||||
* print_sections.c: Moved get_fde_proc_name() and related
|
||||
code to print_frames.c, where it is referenced.
|
||||
* dwarfdump.c: No longer turn on info_flag with -f or -F.
|
||||
Moved the Usage strings into a string table and loop through
|
||||
to print them.
|
||||
* globals.h: Removed get_fde_proc_name() declaration.
|
||||
* print_frames.c: Added get_fde_proc_name() here
|
||||
and removed the 'inlined:' from the abstract origin
|
||||
name.
|
||||
2009-03-20: David Anderson <davea42@earthlink.net>
|
||||
* print_static_vars.c, print_static_funcs.c, print_strings.c,
|
||||
print_locs.c, print_pubnames.c, print_lines.c, print_ranges.c,
|
||||
print_abbrevs.c, print_macros.c, print_types.c, print_weaknames.c,
|
||||
print_aranges.c: Moved the print_* functions from print_sections.c
|
||||
into individual sourcefiles.
|
||||
* Makefile.in: Now lists the new sourcefiles.
|
||||
* print_sections.c: Deleted code moved to individual sourcefiles.
|
||||
Added code to try to find the name from a DW_AT_abstract_origin
|
||||
DIE when a subprogram DIE itself has no DW_AT_name;
|
||||
* dwarfdump.c: Remove unused local variables. Use DWARFDUMP_VERSION
|
||||
#define to set version string.
|
||||
* tag_tree.c: Fix && || problem with parentheses.
|
||||
* tag_attr.c: Fix && || problem with parentheses.
|
||||
* print_frames.c: Moved the 'print_frames' function itself from
|
||||
print_sections.c to here.
|
||||
2009-03-17: David Anderson <davea42@earthlink.net>
|
||||
* globals.h: Created predicate function
|
||||
should_skip_this_cu() predicate function. Eliminating
|
||||
code duplication.
|
||||
* print_frames.c: Fix a hex value output to have a leading
|
||||
0x as all hex values should (when printed).
|
||||
* print_sections.c: Call should_skip_this_cu(), which
|
||||
replaces duplicate code.
|
||||
Fix the arange print: now the hex value has a leading 0x
|
||||
as all hex values should. get_proc_name() had local
|
||||
variable funcnamefound initialized incorrectly, now is
|
||||
set to 0 as it should be. get_nested_proc_name()
|
||||
now initializes string buffers. get_fde_proc_name()
|
||||
now initializes its string buffer. Surprisingly
|
||||
things worked adequately before in spite of the errors.
|
||||
* dwarfdump.c: Call should_skip_this_cu(). Implementation
|
||||
of that new function is in this source file.
|
||||
2009-03-16: David Anderson <davea42@earthlink.net>
|
||||
* print_frames.c:DW_CFA_restore output had a spurious newline.
|
||||
Removed 2 pointless blank lines an initialized 2 local variables.
|
||||
* print_sections.c: Removed a pointless redeclaration of a function
|
||||
in libdwarf.h. check_info_offset_sanity() was missing a
|
||||
return statement in one place, which could lead to spurious
|
||||
extra (and silly) error text.
|
||||
2009-03-09: David Anderson <davea42@earthlink.net>
|
||||
* print_die.c: Make a comment easier to understand.
|
||||
2009-02-28: David Anderson <davea42@earthlink.net>
|
||||
* Makefile.in: add tmp-*.tmp to the 'clean' rule.
|
||||
2009-02-17: David Anderson <davea42@earthlink.net>
|
||||
* print_sections.c,print_die.c,tag_common.c,print_frames.c: C99
|
||||
in-line declarations and // comments are not intended here,
|
||||
this removes a few that were introduced accidentally.
|
||||
2009-02-16: David Anderson <davea42@earthlink.net>
|
||||
* Makefile.in: Removed some use of awk and
|
||||
simplified some shell scripting here.
|
||||
renamed temp files, no longer named with
|
||||
underbars, they uniformly start with 'tmp-'.
|
||||
* print_sections.c: Added the new argument required
|
||||
by the updated dwarf_names.c functions argument lists.
|
||||
* tag_tree_ext.list: List 'common extensions'
|
||||
of tag->tag relationships.
|
||||
* tag_attr_ext.list: List 'common extensions'
|
||||
of tag->attr relationships.
|
||||
* print_die.c: New 'common extension' tables used
|
||||
for checking tag->tag and tag->attr relationships
|
||||
unless turned off with -C.
|
||||
* dwarf_names.awk: Removed tabs so generated names.c not so
|
||||
spread out. Added argument to the generated functions so
|
||||
tag_tree.c, tag_attr.c can use these generated functions nicely.
|
||||
* dwarfdump.c: Adding -C option, which exposes
|
||||
some 'common extensions' of dwarf uses as DWARF CHECK
|
||||
(-ka) warnings. By default these extensions not reported
|
||||
as warnings.
|
||||
* tag_tree.c: Now generates base and extensions tables.
|
||||
Code in common with tag_attr.c is in tag_common* files.
|
||||
* tag_attr.c: Now generates base and extensions tables.
|
||||
Code in common with tag_tree.c is in tag_common* files.
|
||||
* tag_common.c, tag_common.h: New files with the common
|
||||
data extracted from tag_tree.c and tag_attr.c
|
||||
* globals.h: global flag added for -C.
|
||||
|
||||
2009-02-14: David Anderson <davea42@earthlink.net>
|
||||
* configure.in: Define --enable-nonstandardprintf
|
||||
* config.h.in: new #undef HAVE_NONSTANDARD_PRINTF_64_FORMAT
|
||||
* configure: Regenerated.
|
||||
* config.guess, config.sub: Latest version from GNU.
|
||||
* Makefile.in: Referenced configure variable to avoid
|
||||
irritating message at configure time.
|
||||
* README: document --enable-nonstandardprintf
|
||||
* print_sections.c, print_die.c, print_reloc.c, dwarfdump.c,
|
||||
dwconf.c, print_frames.c: Use libdwarf.h DW_PR_ printf macros
|
||||
for for better portability.
|
||||
2009-02-13: David Anderson <davea42@earthlink.net>
|
||||
* print_sections.c: Ensure we are checking line table header
|
||||
correctness whichever line-table-print code is being used.
|
||||
Allow ARM line header table (which has a bug) to be used.
|
||||
* dwarfdump.c: Print lines_result total with checking on.
|
||||
* globals.h: Add lines_result global to count line botches.
|
||||
2009-02-11: David Anderson <davea42@earthlink.net>
|
||||
* print_sections.c, print_die.c: DWARF_CHECK_ERROR*
|
||||
macros now get the count struct passed in.
|
||||
* tag_tree.c, tag_attr.c: Add a comment in the output
|
||||
identifying the output as generated code and
|
||||
with the generation date/time inserted.
|
||||
* globals.h: Accept the struct in DWARF_CHECK_ERROR*
|
||||
macros so we can update the error count in the macro.
|
||||
2009-01-31: David Anderson <davea42@earthlink.net>
|
||||
* Makefile.in: Remove compilation of _tag_attr_table.c
|
||||
and _tag_tree_table.c as those are #included in
|
||||
print_die.c, not separately compiled.
|
||||
* print_frames.c: A formerly-static function now called
|
||||
from another file, so declare it here.
|
||||
* print_sections.c: Improve the printing of the .debug_loc
|
||||
section.
|
||||
* print_die.c: A couple of errors were missing their error
|
||||
count increment.
|
||||
* tag_attr.list tag_tree.list: Some normal relationships
|
||||
were left out of the tables: fixed now.
|
105
dwarf-compilation.base/contrib/libdwarf/dwarfdump/ChangeLog2010
Normal file
105
dwarf-compilation.base/contrib/libdwarf/dwarfdump/ChangeLog2010
Normal file
|
@ -0,0 +1,105 @@
|
|||
2010-09-30 DavidAnderson <davea42@earthlink.net>
|
||||
* dwarfdump.c: Now -a no longer implies -c because
|
||||
the -c option is not guaranteed to work by the DWARF spec,
|
||||
nor is -c really necessary.
|
||||
* README: More tweaks on the 'install' issue.
|
||||
2010-09-29 DavidAnderson <davea42@earthlink.net>
|
||||
* README, Makefile.in: Amplified make install instructions.
|
||||
2010-09-20 DavidAnderson <da
|
||||
* dwarfdump.1: The -c option is not guaranteed to work.
|
||||
Because .debug_loc can have garbage bytes in areas
|
||||
not referenced by .debug_info.
|
||||
2010-06-29 DavidAnderson <davea42@earthlink.net>
|
||||
* print_die.c: If a location form is wrong report
|
||||
an error but continue operating.
|
||||
* dwarfdump.c: Implement print_error_and_continue().
|
||||
Fix mistakes in usage message.
|
||||
* globals.h: Declare print_error_and_continue().
|
||||
2010-04-04 DavidAnderson
|
||||
* dwarfdump.c: New version date.
|
||||
* configure: regenerated.
|
||||
* addrmap.c: Added a comment to mention that tdestroy is
|
||||
GNU only, POSIX does not mention a way to delete the
|
||||
tsearch tree. Hence the code does #define USE_GNU 1
|
||||
to expose the tdestroy function prototype.
|
||||
2010-04-03 DavidAnderson <davea42@earthlink.net>
|
||||
* print_frames.h: Added new arguments to a function to get better
|
||||
function names printing.
|
||||
* configure.in: Added test for tsearch functions so dwarfdump
|
||||
will still compile if they are not present.
|
||||
See HAVE_TSEARCH macro.
|
||||
* configure: regenerated.
|
||||
* Makefile.in: Now names object for addrmap.c
|
||||
* addrmap.c: New file to map pc address to function names
|
||||
so fde printing gets functions named properly (using tsearch).
|
||||
* addrmap.h: New file to map pc address to function names
|
||||
so fde printing gets functions named properly (using tsearch).
|
||||
* print_lines.c: Correct the calculation of the number
|
||||
of error checks.
|
||||
* dwarfdump.c: Added fdes error check print.
|
||||
* config.h.in: Now handles the HAVE_TSEARCH macro.
|
||||
* globals.h: Added declarations for the fde error check
|
||||
globals.
|
||||
* print_frames.c: Now uses addrmap.h functions to do a
|
||||
better job of printing function names in the frame output.
|
||||
2010-03-31 DavidAnderson <davea42@earthlink.net>
|
||||
* dwarfdump.1: Added some text about 'harmless'
|
||||
errors.
|
||||
* dwarfdump.c: Change the size of the harmless error list
|
||||
to 50. Change harmless error reporting to be associated
|
||||
with -k flags.
|
||||
* dwconf.c: Initialize uninitialized fields to satisfy
|
||||
a compiler warning.
|
||||
* globals.h: Declarations added for 'harmless' error
|
||||
reporting.
|
||||
* print_die.c: Added commentary.
|
||||
* print_frames.cc: Change harmless error reporting to be
|
||||
associated with -k flags.
|
||||
* print_aranges.c: Now calls dwarf_get_arange_info_b()
|
||||
allowing proper printing of DWARF4 segment-sensitive
|
||||
aranges. Change harmless error reporting to be
|
||||
associated with -k flags.
|
||||
2010-03-28 DavidAnderson <davea42@earthlink.net>
|
||||
* dwarf_globals.h: Added interface to print_any_harmless_errors().
|
||||
* dwarfdump.c: Added print_any_harmless_errors() implementation
|
||||
and we call it just before closing libdwarf.
|
||||
* print_frames.c: Call print_any_harmless_errors after
|
||||
getting cie/fde list.
|
||||
* dwarfdump.conf: Add abi named 'arm' for Arm users.
|
||||
* print_die.c: Initialize a local string pointer to NULL at
|
||||
the point of definition.
|
||||
2010-02-14 DavidAnderson <davea42@earthlink.net>
|
||||
* print_die.c: Add newer DW_OP operators, remove
|
||||
bogus test of DW_OP_nop as the highest valid operator.
|
||||
Add table of DW_OPs to simplify testing for zero-operand
|
||||
operators.
|
||||
Revise so that the FORM of all attributes print with -M.
|
||||
Move a local variable declaration to the front of a block
|
||||
to match C 1990 rules.
|
||||
String searches now also match on attribute name.
|
||||
* tag_attr.list: Updated copyright.
|
||||
* dwarfdump.c: Remove a switch FALL THROUGH in the 'g' case.
|
||||
* tag_tree_ext.list, tag_attr_ext.list: Added GNU template
|
||||
parameter tags, attributes. Updated copyright.
|
||||
* tag_tree.list: Added template parameter tags. Added
|
||||
entry for nested classes. Updated copyright.
|
||||
* tag_common.h: Increased STD_TAG_TABLE_COLUMNS and
|
||||
EXT_ATTR_TABLE_COLS.
|
||||
2010-01-30 DavidAnderson <davea42@earthlink.net>
|
||||
* print_die.c: Changed the spelling of one
|
||||
'DW_AT_type offset does not point to type info' error message so
|
||||
one can distinguish which check lead to the message.
|
||||
2010-01-26 DavidAnderson <davea42@earthlink.net>
|
||||
* dwarfdump.1, dwconf.c, dwconf.h, dwarfdump.conf: The default
|
||||
frame values in frame
|
||||
output are now generic registers like r0 to r99
|
||||
instead of MIPS register names.
|
||||
For the MIPS register names use '-x abi=mips'.
|
||||
* print_frames.c: Added commentary.
|
||||
2010-01-17 DavidAnderson <davea42@earthlink.net>
|
||||
* print_die.c: The special case DW_AT_SUN_func_offsets
|
||||
now prints identically in dwarfdump and dwarfdump2.
|
||||
2010-01-03 DavidAnderson <davea42@earthlink.net>
|
||||
* tag_common.c, common.h, common.c: Remove <cr> line
|
||||
terminator characters. Update copyright year.
|
||||
* All other files: Update copyright year.
|
288
dwarf-compilation.base/contrib/libdwarf/dwarfdump/ChangeLog2011
Normal file
288
dwarf-compilation.base/contrib/libdwarf/dwarfdump/ChangeLog2011
Normal file
|
@ -0,0 +1,288 @@
|
|||
2011-12-14 DavidAnderson <davea42@earthlink.net>
|
||||
* print_die.c: Add support for newer DW_OP_GNU_* .
|
||||
2011-12-13 DavidAnderson <davea42@earthlink.net>
|
||||
* dwarfdump.c, common.c: Update version string.
|
||||
* tag_attr_ext.list, tag_common.h: New information on GNU
|
||||
attributes meant allowing a larger row count.
|
||||
2011-12-13 DavidAnderson <davea42@earthlink.net>
|
||||
* tag_common.h: A new attr in the .list means increasing
|
||||
the column count.
|
||||
2011-12-13 DavidAnderson <davea42@earthlink.net>
|
||||
* print_lines.c: Now prints no-column as 0 not -1.
|
||||
And prints the DWARF3/4 line table values when present.
|
||||
* tag_attr_ext.list: Add a GNU extension.
|
||||
2011-10-30 DavidAnderson <davea42@earthlink.net>
|
||||
* configure.in: Removed a couple bogus lines which were
|
||||
reporting strange shell errors.
|
||||
* configure: Regenerated.
|
||||
* dwarfdump.c: Refine the error outputs so bogus reports
|
||||
do not print. Refactor the debuginfo/types prints for
|
||||
better reporting of errors.
|
||||
* globals.h: Refactoring meant changing one prototype here,
|
||||
the print_infos() prototype.
|
||||
* print_die.c: Refactor the debuginfo/types prints for
|
||||
better reporting of errors. Remove an 'error' report
|
||||
about DW_DLE_REF_SIG8_NOT_HANDLED. It's unclear
|
||||
what we might want to do here in future, but an error
|
||||
report is misleading.
|
||||
2011-10-29 DavidAnderson <davea42@earthlink.net>
|
||||
* dwarfdump.c, common.c: Update version strings.
|
||||
2011-10-29 DavidAnderson <davea42@earthlink.net>
|
||||
* dwarfdump.c: Reset the CU hints at each new section.
|
||||
Set up reloc flags so debug_types gets relocated if necessary.
|
||||
* globals.h: Add DEBUG_TYPES for the .debug_types section.
|
||||
Add a type-unit signature pretty-printer function.
|
||||
Add DW_SECTION_REL_DEBUG_TYPES so debug_types can be relocated.
|
||||
* print_reloc.c: Add entries so debug_types can get relocated.
|
||||
* print_die.c: Now we handle both debug_info and debug_types
|
||||
sections. Moved some CU header print operations to little
|
||||
helper functions to clarify the code. Refactored print_infos()
|
||||
to deal with debug_types and debug_info.
|
||||
Using the new libdwarf functions that allow debug_types.
|
||||
* print_lines.c: Delete unused local variable and its setting code.
|
||||
2011-10-26 DavidAnderson <davea42@earthlink.net>
|
||||
* Makefile.in, README: Added Make settings of PREINCS POSTINCS
|
||||
PRELIBS, POSTLIBS to simplify building when libdwarf or libelf
|
||||
are not in the normal locations. Documented usable ways to
|
||||
deal with unusual situations at build time.
|
||||
2011-10-24 DavidAnderson <davea42@earthlink.net>
|
||||
* common.c: Update version string.
|
||||
* dwarfdump.c: Update version string.
|
||||
To get '-c cu-name' to work we need to set a local flag which is now set.
|
||||
* dwarfdump.1: Clearly identify the command line options where
|
||||
URI style input is expected.
|
||||
2011-10-23 DavidAnderson <davea42@earthlink.net>
|
||||
* dwarfdump.c: Fix omission of a 'break' statement for case 'q'.
|
||||
2011-10-23 DavidAnderson <davea42@earthlink.net>
|
||||
* dwarfdump.1: Now command line input strings
|
||||
are translated from uri-style
|
||||
* dwarfdump.c: Translate input strings to from uri style to characters.
|
||||
Fix indentation mistakes.
|
||||
Fix constness issues on character strings.
|
||||
* dwconf.c: Fix constness issues on character strings.
|
||||
* dwconf.h: Fix constness issues on character strings.
|
||||
* globals.h: Fix constness issues on character strings.
|
||||
* makename.c: Fix constness issues on character strings.
|
||||
* makename.h: Fix constness issues on character strings.
|
||||
* uri.c: Fix indentation mistakes.
|
||||
2011-10-22 DavidAnderson <davea42@earthlink.net>
|
||||
* common.c :Update version string.
|
||||
* dwarfdump.c: Update version string. Do not set ranges_flag
|
||||
with -a because that is unsafe to print seperately in general.
|
||||
* dwarfdump.1: Rewrite the man page for completeness and
|
||||
accuracy.
|
||||
2011-10-11 DavidAnderson <davea42@earthlink.net>
|
||||
* common.c: Update version string.
|
||||
* dwarfdump.c: Update version string and translate -S strings
|
||||
from uri-style to standard strings so spaces and other standard
|
||||
characters are easily represented (no quoting problems).
|
||||
Update version string.
|
||||
* print_die.c: For -S -W we were printing the wrong die-level.
|
||||
* uri.h,uri.c: Add the translate_from_uri() function.
|
||||
Fix some of the tests in uri.c to match to- and from-uri.
|
||||
2011-10-09 DavidAnderson <davea42@earthlink.net>
|
||||
* common.c, dwarfdump.c: Update version strings.
|
||||
2011-10-09 DavidAnderson <davea42@earthlink.net>
|
||||
* dwconf.c,print_die.c, print_frames.c: Fix bad indentation.
|
||||
2011-10-09 DavidAnderson <davea42@earthlink.net>
|
||||
* print_die.c (get_location_list): Tests for DW_DLV_ERROR
|
||||
were written without {}, added in the braces.
|
||||
2011-10-08 DavidAnderson <davea42@earthlink.net>
|
||||
* dwarfdump.cc: If doing any relevant checking,
|
||||
instantiate all three possibly-usable BucketGroup objects.
|
||||
That makes it simpler to avoid a coredump when the user
|
||||
provides a nonsensical option set -- at a cost of
|
||||
a very small amount of memory.
|
||||
2011-10-06 DavidAnderson <davea42@earthlink.net>
|
||||
* dwarfdump.c: Removed a newline in a printf to match dwarfdump2.
|
||||
Calls of get_attr_value() now have extra argument, so
|
||||
fix them.
|
||||
* dwarfdump.conf: Having 'mips' be an ABI which really reflected
|
||||
the IRIX abi and IRIX compilers was a mistake. Now that
|
||||
abi works for modern MIPS.
|
||||
* globals.h: get_attr_value() adds an argument.
|
||||
* print_die.c: Expanded the error messages in a couple type_offset_result
|
||||
checks. Worked around the global nature of esb_base by
|
||||
saving it locally while we recursively traverse DW_AT_type like things
|
||||
looking for bad references. Added a 'verbose' argument a few places
|
||||
so (at a critical point) show_form_itself won't add a form
|
||||
string when we really don't want it to.
|
||||
* print_static_funcs.c: Fixed an error string so it says
|
||||
static funcs, not pubnames.
|
||||
* print_lines.c: Ensure we only check for errors when
|
||||
we request such checking.
|
||||
* print_reloc.c: Ensure we don't index off the end of scn_names.
|
||||
Deal with missing names and bad symbol indexes consistently.
|
||||
When working with a .rela, report name as the section name
|
||||
instead of calling it .rel in the relocations output.
|
||||
2011-10-05 DavidAnderson <davea42@earthlink.net>
|
||||
* dwarfdump.c: Increased COMPILER_TABLE_MAX for better reporting.
|
||||
Provide a 'HARMLESS ERROR' title in output if there are any such.
|
||||
One issue is (for relocatable objects) libdwarf attempts to continue
|
||||
even if relocations fail, and a relocation failure is now
|
||||
counted as a harmless error (even if it turns out to be harmful!).
|
||||
When sorting compilers_detected, use the producer name to sort
|
||||
when error counts are identical. If the compiler table fills up,
|
||||
print a note. With -ka, no longer explicitly turn check_frames_extended
|
||||
off, it is off already unless the user turned it on explicitly with
|
||||
-kxe.
|
||||
* print_die.c: The check for a file number (decl_file) was simply wrong.
|
||||
Made some detail changes to reporting.
|
||||
* print_frames.c: Added comments about the inefficiency for getting
|
||||
function names when printing frames (dwarfdump2 does not suffer
|
||||
the same inefficiency).
|
||||
* print_locs.c: Do not use a side effect for updating the index
|
||||
before printing in print_locs().
|
||||
2011-10-03 DavidAnderson <davea42@earthlink.net>
|
||||
* dwarfdump.c: for -kF, add check_lines. Ensure uniformity
|
||||
in the usage-text ending.
|
||||
* print_lines.c: Ensure lines printing suppresses some
|
||||
error reporting when appropriate.
|
||||
2011-10-03 DavidAnderson <davea42@earthlink.net>
|
||||
* print_die.c: Fix the formx code by removing recently-added use of llabs().
|
||||
Fix format botch, and correct small error string mistakes. Empty
|
||||
esb_extra string when it is no longer valid.
|
||||
2011-10-03 DavidAnderson <davea42@earthlink.net>
|
||||
* dwarfdump.c: Minor formatting changes.
|
||||
* print_die.c: Initialize some local varables at definition. Ensure that
|
||||
we do not get a FORM name in a name string (so a test
|
||||
works right). And also ensure a FORM name does not get
|
||||
into a compiler-target setting. Refine the formx_print_value()
|
||||
so it is more complete (like dwarfdump2). Ensure show_form_itself()
|
||||
uses the argument, not a global, for the show-form test.
|
||||
* naming.c: Introduce a {} pair on an 'if'
|
||||
to reduce the possibility of future
|
||||
errors.
|
||||
* print_pubnames.c: Add error details to match dwarfdump2.
|
||||
* print_ranges.c: If not printing, return immediately.
|
||||
* print_reloc.c: A test was coded with = where == was needed.
|
||||
* print_types.c: Move local variable definitions to the
|
||||
block they are used in.
|
||||
2011-09-29 DavidAnderson <davea42@earthlink.net>
|
||||
* dwarfdump.c: Amplifying the -n help string.
|
||||
* print_abbrev.c: Adding the standard test of the section
|
||||
print option before printing the header line for the abbrevs section.
|
||||
* print_die.c: Added a {} pair to avoid eventual bug.
|
||||
* print_frames.c: Reformatted a comment for readability.
|
||||
* print_lines.c: Added a status test for consistency with the rest
|
||||
of the code.
|
||||
* print_reloc.c: One of the assign-and-test removal changes
|
||||
in the previous changes was wrong.
|
||||
2011-09-26 DavidAnderson <davea42@earthlink.net>
|
||||
* dwarfdump.c: Removed duplicate usage_text strings.
|
||||
* print_reloc.c: In case we don't have ELF64 headers,
|
||||
do the last-best-hope internal define in the right place
|
||||
so it actually helps. For some local variables, ensure
|
||||
they have values defined at the definition point.
|
||||
Switch some assign-and-test into two lines.
|
||||
2011-09-20 DavidAnderson <davea42@earthlink.net>
|
||||
* Makefile.in: Fixed typo in comment.
|
||||
* common.c: Use snprintf, not sprintf. Updated version string.
|
||||
* dwarfdump.c: Correct typo and move usage_text to
|
||||
a source position corresponding to that in dwarfdump.cc.
|
||||
Updated version string.
|
||||
2011-09-16 DavidAnderson <davea42@earthlink.net>
|
||||
* dwarfdump.c, common.c: Update version string.
|
||||
2011-09-15 DavidAnderson <davea42@earthlink.net>
|
||||
* dwarfdump.c, common.c: Update version string.
|
||||
2011-09-14 DavidAnderson <davea42@earthlink.net>
|
||||
* dwarfdump.c, common.c: Update version string.
|
||||
2011-09-08 DavidAnderson <davea42@earthlink.net>
|
||||
* config.h, configure.in, dwconf.c, globals.h: Switch
|
||||
compile dependency to configure time HAVE_STDAFX_H
|
||||
instead a system-dependent ifdef.
|
||||
* configure: regenerate.
|
||||
2011-09-08 DavidAnderson <davea42@earthlink.net>
|
||||
* print_frames.c: Ensure each tsearch tree pointer is zeroed
|
||||
after emptying the tree.
|
||||
* addrmap.c: Now we actually free all the records, we were
|
||||
misusing tsearch a little bit.
|
||||
2011-09-05 DavidAnderson <davea42@earthlink.net>
|
||||
* print_frames.c: Now only check duplicate fdes if checking
|
||||
frames.
|
||||
* dwarfdump.conf: Updated to use address_size and includeabi.
|
||||
* dwconf.h, dwconf.c: Adding configure keywords address_size
|
||||
and includeabi.
|
||||
2011-09-02 DavidAnderson <davea42@earthlink.net>
|
||||
* common.c,dwarfdump.c: Update version string.
|
||||
2011-06-07 DavidAnderson <davea42@earthlink.net>
|
||||
* dwarfdump.c,common.c: Updated version string.
|
||||
* dwarfdump.c: Refactor setting of do_print_dwarf
|
||||
and do_check_dwarf into a function. Ensure that one of
|
||||
the refactored new functions is called in every case
|
||||
an option requires such call. Ensured indents ok.
|
||||
* print_lines.c (print_line_numbers_this_cu): When not checking
|
||||
added a check to insure we don't try to call a
|
||||
checking-related function.
|
||||
2011-06-07 DavidAnderson <davea42@earthlink.net>
|
||||
* CODINGSTYLE: Added this new document.
|
||||
* common.c: Updated version string.
|
||||
* dwarfdump.c: Updated version string, fixed indentation.
|
||||
* print_lines.c: Two line table checks moved from
|
||||
decl_file to line_table sections of the summary report
|
||||
and both now show the possibly-wrong pc.
|
||||
Since one is not necessarily a bug, the wording of the
|
||||
message now has 'possibly' in it.
|
||||
* print_die.c: Reinitialize subprogram-relative pc high/low
|
||||
seen_PU_high_address
|
||||
whenever compilation unit changes, and use that field
|
||||
to avoid an erroneous comparison (when checking for an error).
|
||||
Fix some indentation errors introduced recently.
|
||||
2011-06-06 DavidAnderson <davea42@earthlink.net>
|
||||
* dwarfdump.c: Changed the missing-producer-attribute
|
||||
default string used in summary/error
|
||||
outputs to "<CU-missing-DW_AT_producer>"
|
||||
so it is this string clearer.
|
||||
2011-06-06 DavidAnderson <davea42@earthlink.net>
|
||||
* print_die.c: Now we strip off quotes dwarfdump
|
||||
added so -S match=main and the like work.
|
||||
2011-06-06 DavidAnderson <davea42@earthlink.net>
|
||||
* common.c: Updated version string.
|
||||
* dwarfdump.c: Updated version string.
|
||||
* print_die.c: Corrected handling of DW_AT_data_member_location.
|
||||
Corrected handling of 'class constant' function
|
||||
formxdata_print_value() so it does not leak memory.
|
||||
2011-06-05 DavidAnderson <davea42@earthlink.net>
|
||||
* dwarfdump.c: Updated version string.
|
||||
Now -kd forces a summary error report, always.
|
||||
Even if no errors found or even checked-for.
|
||||
* common.c: Updated version string.
|
||||
2011-06-05 DavidAnderson <davea42@earthlink.net>
|
||||
* dwarfdump.c,print_aranges.c,print_reloc.c: A few indents
|
||||
did not match the standard multiple-of-4-spaces. Corrected.
|
||||
2011-06-03 DavidAnderson <davea42@earthlink.net>
|
||||
* checkutil.c (ProcessBucketGroup): Deleted unused
|
||||
local variables.
|
||||
* common.c: Updated version string.
|
||||
* dwarfdump.1: Made the -k discussion more complete and accurate.
|
||||
Most option details are in the dwarfdump help/usage message, not
|
||||
in dwarfdump.1, to keep the man page small.
|
||||
* dwarfdump.c: Updated version string. Made more variables static
|
||||
in recognition they are only touched in this file. Added {} on
|
||||
some if statements to make the body clear. Parenthesized a
|
||||
complex test with && || to clarify intent. Added sanity testing
|
||||
of the 'current compiler' count and its use.
|
||||
* globals.h: Added safe_strcpy() prototype as it is used by multiple
|
||||
source files so we need a visible prototype.
|
||||
* print_aranges.c: Add 'arange end' printing (it is a real DWARF
|
||||
record type, so should be printed). Add a test to avoid duplicated
|
||||
die printing and error-counting when it is not requested.
|
||||
* print_die.c: An = in an if corrected to ==. Parenthesized a
|
||||
complex test with && || to clarify intent. Deleted an unused
|
||||
local variable.
|
||||
* print_lines.c: Deleted unused local variables. Added {} for each
|
||||
struct in an array so the initialization gets done right.
|
||||
* tag_attr.c: Deleted an unused local variable.
|
||||
* tag_tree.c: Deleted an unused local variable.
|
||||
2011-04-23 DavidAnderson <davea42@earthlink.net>
|
||||
* dwarfdump.c, common.c: Updated DWARF_VERSION string.
|
||||
2011-01-04 DavidAnderson <davea42@earthlink.net>
|
||||
* print_frames.h print_static_vars.c Makefile.in
|
||||
print_static_funcs.c print_sections.c print_strings.c print_locs.c
|
||||
print_die.c print_reloc.c print_reloc.h print_lines.c print_pubnames.c
|
||||
dwarfdump.c strstrnocase.c tag_tree.c print_ranges.c print_abbrevs.c
|
||||
print_macros.c configure.in tag_attr.c dwarfdump.1 naming.c
|
||||
esb.c checkutil.c makename.c dwconf.c print_types.c checkutil.h
|
||||
tag_tree.list print_weaknames.c globals.h common.c print_frames.c
|
||||
print_aranges.c common.h: New correctness tests and new
|
||||
formatting of various reports.
|
125
dwarf-compilation.base/contrib/libdwarf/dwarfdump/ChangeLog2012
Normal file
125
dwarf-compilation.base/contrib/libdwarf/dwarfdump/ChangeLog2012
Normal file
|
@ -0,0 +1,125 @@
|
|||
2012-11-29 David Anderson
|
||||
* dwarfdump.c, common.c: Update version string.
|
||||
* dwarfdump.c, print_die.c: Now all follow dicheck
|
||||
indent rules.
|
||||
2012-11-29 David Anderson
|
||||
* dwarfdump.c, common.c: Update version string.
|
||||
2012-11-27 David Anderson
|
||||
* dwarfdump.c, common.c: Update version string.
|
||||
2012-11-20 David Anderson
|
||||
* dwarfdump.c, common.c: Update version string.
|
||||
* print_reloc.c: Inserted missing 'const' qualifiers
|
||||
fixing 3 compiler warnings.
|
||||
2012-11-17 David Anderson
|
||||
* configure regenerated with autoconf 2.69
|
||||
* dwarfdump.c, common.c: Update version string.
|
||||
2012-11-17 David Anderson
|
||||
* addrmap.c,checkutil.c,common.c,dwarfdump.c,dwconf.c,
|
||||
globals.h,naming.c,print_aranges.c,print_die.c,print_frames.c,
|
||||
print_locs.c,print_ranges.c,print_reloc.c,print_reloc.h,
|
||||
print_strings.c,strstrnocase.c,tag_attr.c,tag_common.c,
|
||||
tag_tree.c,uri.c,
|
||||
tag_attr_ext.list,tag_attr.list,tag_tree_ext.list,
|
||||
tag_tree.list : Update copyright year.
|
||||
2012-11-15 CarlosAlbertoEnciso <carlos.alberto.enciso@gmail.com>
|
||||
* addrmap.c: Consistent layout for if statements.
|
||||
* checkutil.c: Incorrect string prefix for .text
|
||||
linkonce section name,
|
||||
is '.text.' for the applicable linke once sections, not
|
||||
simply '.text'
|
||||
Added print of internal (debugging dwarfdump) data not
|
||||
previously printed.
|
||||
* common.c: Consistent layout for if statements.
|
||||
Include "config.h".
|
||||
Minor layout change for #ifdef _DEBUG.
|
||||
Add HAVE_STDAFX_H check.
|
||||
* dwarfdump.1: Changes for new options: -E*, -h, -ls, -kE, plus
|
||||
some minor typo corrections.
|
||||
* dwarfdump.c: Consistent layout for if, for statements.
|
||||
Expand -E option to print the full information for
|
||||
the ELF header
|
||||
(32-bit and 64-bit) to include additional fields (e_ehsize,
|
||||
e_phentsize, e_phnum, e_shentsize, e_shnum, e_shstrndx). Also,
|
||||
depending on the additional option to -E, the index, address,
|
||||
size and name for sections is printed. The additional option
|
||||
follow the convention used for -o option and can include any of
|
||||
the letters: hliaprfoRstxd.
|
||||
-Eh print information for the ELF header
|
||||
-E{liaprfoRs} print information for debug related sections
|
||||
-Ex print information for .text section
|
||||
-Ed same as -E{liaprfoRstx}.
|
||||
-E print the ELF header and the info for all available sections.
|
||||
New option: -kE, the attribute encodings are checked
|
||||
to see if they can use fewer bytes when encoded using LEB128.
|
||||
Expand -l option to print line information with no offsets
|
||||
values (-ls). Useful for comparisons.
|
||||
Expand -S option to print number of occurrences for the
|
||||
searched pattern (-Sv<search_options>.
|
||||
Remove support for internally quoted strings.
|
||||
Remove extra 'break' for case 'o' in 'process_args'.
|
||||
Include the value zero for -# (internal debug level)
|
||||
Fix layout for 'qsort_compare_compiler' and use compiler
|
||||
name in the sort to get a stable sort.
|
||||
Now that name strings are not qoted internally,
|
||||
ensure that we do not expect such quotes in checking
|
||||
compiler names.
|
||||
* dwconf.c: Consistent layout for if statements.
|
||||
* globals.h: Add externs and defines for the items
|
||||
newly needed globally.
|
||||
* naming.c: Consistent layout for if, for statements.
|
||||
* print_aranges.c: Consistent layout for if statements.
|
||||
* print_die.c: Consistent layout for if, for and switch statements.
|
||||
Remove unused symbols 'seen_PU_base_address',
|
||||
'seen_PU_high_address'. Rename 'errno' to
|
||||
'dwerrno' to avoid conflict with system symbol.
|
||||
Missing DWARF_CHECK_COUNT and DWARF_CHECK_ERROR
|
||||
when testing self references category.
|
||||
Support for counting number of occurrences of the pattern being
|
||||
searched (See -S option).
|
||||
Add support for new option -kE; the atrribute
|
||||
encodings are checked to see if they can use
|
||||
fewer bytes when encoded using LEB128. New
|
||||
functions 'check_attributes_encoding',
|
||||
'print_attributes_encoding'
|
||||
and new data structure 'a_attr_encoding' were created.
|
||||
Include DW_TAG_template_alias in the function
|
||||
'get_attr_value' as it
|
||||
refers to a type in the case of checks for type offsets.
|
||||
Remove support for internally quoted strings.
|
||||
Add space so DW_OP_bregx prints more readably.
|
||||
* print_frames.c: Consistent layout for if statements.
|
||||
* print_lines.c: Consistent layout for if statements.
|
||||
Implement the ability to print line information
|
||||
with no offset values (useful when comparisons are
|
||||
required, as the pc values can change
|
||||
but the basic line information remains the same).
|
||||
Minor layout changes.
|
||||
* print_locs.c: Consistent layout for if statements.
|
||||
* print_ranges.c: Consistent layout for if and for statements.
|
||||
* print_reloc.c: Consistent layout for if statements.
|
||||
Move names for relocation types to individual
|
||||
header files based on architecture (ARM, MIPS, PPC,
|
||||
PPC64, X86_64).
|
||||
Fix incorrect layout for 'set_relocation_table_names' function.
|
||||
Use condition compilation symbols (DWARF_RELOC_MIPS,
|
||||
DWARF_RELOC_PPC, DWARF_RELOC_PPC64, DWARF_RELOC_ARM,
|
||||
DWARF_RELOC_X86_64)in the function
|
||||
'set_relocation_table_names' to get relocation
|
||||
table information.
|
||||
Add support for X86_64 architecture.
|
||||
* print_reloc.h: Move definitions for relocation types
|
||||
to individual header files based on architecture
|
||||
(ARM, MIPS, PPC, PPC64, X86_64).
|
||||
* print_strings.c: Consistent layout for if statements.
|
||||
* strstrnocase.c: Consistent layout for if and for statements.
|
||||
* tag_attr.c: Consistent layout for if and for statements.
|
||||
* tag_attr.list: Add some missing attributes and
|
||||
the complete set for DW_TAG_rvalue_reference_type;
|
||||
remove a duplicated DW_AT_name.
|
||||
* tag_common.c: Consistent layout for if statements.
|
||||
* tag_tree.c: Consistent layout for if and for statements.
|
||||
* tag_tree.list: Missing DW_TAG_union_type to allow
|
||||
verification of nested unions.
|
||||
* uri.c: Consistent layout for if and for statements.
|
||||
2012-04-10 DavidAnderson <davea42@earthlink.net>
|
||||
* dwarfdump.c, common.c: Updated version string.
|
|
@ -0,0 +1,88 @@
|
|||
2013-10-17 David Anderson
|
||||
* print_types.c: Remove pointless blank line.
|
||||
2013-08-15 David Anderson
|
||||
* dwarfdump.c: Now calls dwarf_register_printf_callback()
|
||||
so dwarf_print_lines() output is shown (if dwarfdump
|
||||
wants it shown). Update version string.
|
||||
* common.c: Update version string.
|
||||
2013-08-13 David Anderson
|
||||
* esb.c: Add 1 so the esb_append_printf has room for the NUL
|
||||
byte.
|
||||
* print_die.c: Clarified a comment about DW_AT_high_pc
|
||||
and FORM class constant. Fixed indent error.
|
||||
* dwarfdump.c: Fixed indent error.
|
||||
2013-08-08 David Anderson
|
||||
* print_reloc.c: Removed duplicated call to get_scndata().
|
||||
2013-08-07 David Anderson
|
||||
* dwarfdump.c: Changed non-fatal error messages to write
|
||||
to stdout instead of stderr. Making it much easier to
|
||||
have a usable output-with-errors in case of redirection.
|
||||
Updated version string.
|
||||
* checkutil.c: If a certain pointer not set, just do nothing,
|
||||
there is no reason to abort.
|
||||
Added in a missing [ in a debug printf.
|
||||
* common.c: Updated version string.
|
||||
2013-07-30 David Anderson
|
||||
* common.c,dwarfdump.c: updated version string.
|
||||
2013-02-05 David Anderson
|
||||
* dwarfdump.c: Update version string.
|
||||
get_producer_name() now uses struct esb_s;
|
||||
* common.c: Update version string.
|
||||
* print_die.c: Check DW_AT_sibling values for sanity,
|
||||
and when something quite wrong is found, print an error
|
||||
and stop.
|
||||
get_producer_name() now uses struct esb_s;
|
||||
Added sibling_die_global_offset_ to die_stack_data_s
|
||||
so we can check sibling attribute values.
|
||||
get_attr_value() now uses esb_s pointer.
|
||||
* globals.h: get_producer_name() now uses struct esb_s;
|
||||
* print_aranges.c, print_pubnames.c:get_producer_name()
|
||||
now uses struct esb_s;
|
||||
* dwconf.c: The use of esb_s means we need to consider
|
||||
an empty config-file-path as no path and look in default
|
||||
places. We cannot just test for null pointer.
|
||||
2013-02-04 David Anderson
|
||||
* dwarfdump/addrmap.c: Forgot to remove the addr_map_destroy()
|
||||
implementation in #ifndef HAVE_TSEARCH. Now it is removed.
|
||||
2013-02-03 David Anderson
|
||||
* dwarfdump/addrmap.c: Implement HAVE_TDESTROY.
|
||||
tdestroy() is GNU only. Now we allow tsearch without
|
||||
tdestroy even though that means leaking every tsearch
|
||||
map we build. dwarfdump2 has no such leak.
|
||||
* dwarfdump/config.h.in: Add HAVE_TDESTROY.
|
||||
* dwarfdump/configure: Regenerate.
|
||||
* dwarfdump/configure.in: Test for tdestroy() function.
|
||||
* dwarfdump/print_frames.c: Zero out the map pointer.
|
||||
2013-02-01 David Anderson
|
||||
* print_die.c: Replaced use of makename (which did malloc)
|
||||
with use of struct esb_s, avoiding a serious memory leak.
|
||||
Completely removed static struct variables esb_base and
|
||||
esb_extra, ensuring die string print-data is not
|
||||
corrupted by recursive calls.
|
||||
* dwarfdump.c, common.c: Update version string.
|
||||
2013-01-26 David Anderson
|
||||
* dwarfdump.c, common.c: Update version string.
|
||||
* print_die.c: Print DW_OP_GNU_const_type properly using
|
||||
the binary-compatibility version of Dwarf_Loc.
|
||||
2013-01-25 David Anderson
|
||||
* dwarfdump.c, common.c: Update version string.
|
||||
* print_die.c: Print DW_OP_GNU_const_type properly.
|
||||
2013-01-16 David Anderson
|
||||
* dwconf.c: Changed table size to unsigned to eliminate
|
||||
signed/unsigned comparison warnings.
|
||||
* dwconf.h: Changed struct fields to unsigned to eliminate
|
||||
signed/unsigned comparison warnings.
|
||||
* esb.c: Checked for negative vfprintf return to avoid
|
||||
(hopefully impossible) error from crashing the program,
|
||||
and fix comparison warnings.
|
||||
* print_die.c: Changed counts to unsigned to fix
|
||||
signed/unsigned comparison warnings.
|
||||
* print_frames.c: Changed counts to unsigned to fix
|
||||
signed/unsigned comparison warnings.
|
||||
* print_reloc.c: Changed table sizes to unsigned to fix
|
||||
signed/unsigned comparison warnings.
|
||||
* tag_tree.c, tag_attr.c: Changed table sizes to unsigned to fix
|
||||
signed/unsigned comparison warnings.
|
||||
2013-01-16 David Anderson
|
||||
* dwarfdump.c, common.c: Update version string.
|
||||
|
165
dwarf-compilation.base/contrib/libdwarf/dwarfdump/ChangeLog2014
Normal file
165
dwarf-compilation.base/contrib/libdwarf/dwarfdump/ChangeLog2014
Normal file
|
@ -0,0 +1,165 @@
|
|||
2014-12-31 David Anderson
|
||||
* dwarfdump.c, common.c: Updated version string.
|
||||
2014-12-28 David Anderson
|
||||
* dwarfdump.c, common.c: Updated version string.
|
||||
2014-08-15 David Anderson
|
||||
* print_die.c(print_one_die_section): A c99-ism of declarations
|
||||
mixed with statements was present. Moved declaration of 'res'
|
||||
up a few lines.
|
||||
2014-08-05 David Anderson
|
||||
* print_gdbindex.c: A couple places: Fixed indents
|
||||
on a comment.
|
||||
2014-08-05 David Anderson
|
||||
* dwarfdump.c, common.c: Updated version string.
|
||||
2014-08-04 David Anderson
|
||||
* dwarfdump.1: Mention -I option.
|
||||
* dwarfdump.c: Add -I to help output.
|
||||
* print_gdbindex.c: Add cu_list_len argument to
|
||||
print_culist_array so it can pass back the culist length
|
||||
for use by symboltable code. So symboltable code can
|
||||
know what indexes are type units and which compilation
|
||||
units.
|
||||
2014-08-03 David Anderson
|
||||
* dwarfdump.c: Corrected typo in comment.
|
||||
* print_debugfission.c: Removed trailing whitespace.
|
||||
Fixed some small mistakes in the output.
|
||||
* print_die.c: Removed trailing whitespace.
|
||||
Fixed the section name. It was showing .debug_types
|
||||
when not wanted.
|
||||
2014-08-02 David Anderson
|
||||
* print_debugfission.c, print_gdbindex.c: Use the section name
|
||||
strings returned by section-open
|
||||
for object files that have them (like Elf).
|
||||
2014-07-12 David Anderson
|
||||
* print_die.c: Using a new interface to print the
|
||||
actual section name, not just .debug_info or .debug_types.
|
||||
dwarf_get_die_section_name();
|
||||
* dwarfdump.c: Corrected a comment relating to
|
||||
.gdb_index and .debug_[ct]u_index sections
|
||||
* debugfission.c: Fix indentation mistakes.
|
||||
2014-07-11 David Anderson
|
||||
* print_debugfission.c: Prints the offset and size tables.
|
||||
2014-07-10 David Anderson
|
||||
* print_debugfission.c: Prints the hash table values of
|
||||
the .debug_tu_index and .debug_cu_index sections.
|
||||
2014-07-09 David Anderson
|
||||
* print_debugfission.c: Removed trailing whitespace
|
||||
characters.
|
||||
2014-07-09 David Anderson
|
||||
* Makefile.n: Add print_debugfission.o to the list.
|
||||
* globals.h: Add print_debugfission_index() interface.
|
||||
* print_debugfission.c: New file beginning to
|
||||
support print of .debug_tu_index and
|
||||
.debug_cu_index sections (DWARF5).
|
||||
2014-07-02 David Anderson
|
||||
* dwarfdump.c: A missing comma after DW_SECTNAME_GDB_INDEX
|
||||
lead to a core dump.
|
||||
* print_die.c: The printf format for a warning message was
|
||||
messed up. Fixed.
|
||||
2014-07-01 David Anderson
|
||||
* dwarfdump.c, print_gdbindex.c: Fixed indentation and trailing whitespaces.
|
||||
2014-07-01 David Anderson
|
||||
* print_gdbindex.c: Now prints gdb_index symboltable.
|
||||
2014-06-30 David Anderson
|
||||
* print_gdbindex.c: Add types printing.
|
||||
Add addressarea printing.
|
||||
2014-06-29 David Anderson
|
||||
* print_gdbindex.c: Call latest libdwarf interfaces.
|
||||
Fix the formatting a bit.
|
||||
2014-06-28 David Anderson
|
||||
* Makefile.in: Add print_dgbindex.o to objects list.
|
||||
* dwarfdump.1: Add -I to options list (for gdb_index section).
|
||||
* dwarfdump.c: Add gdbindex_flag and a call to print_gdb_index().
|
||||
* globals.h: Add DW_HDR_GDB_INDEX to flags.
|
||||
* print_gdbindex.c: New file, prints .gdb_index section
|
||||
if the section is present in an object.
|
||||
2014-05-20 David Anderson
|
||||
* dwarfdump.c, common.c: Updated version string.
|
||||
* print_die.c: now the dwo_id value prints as hex.
|
||||
2014-05-19 David Anderson
|
||||
* dwarfdump.cc, common.cc: Updated version string.
|
||||
2014-05-19 David Anderson
|
||||
* print_die.c: Removed two unused local variables.
|
||||
2014-05-18 David Anderson
|
||||
* dwarfdump.c,print_die.c: Fixed indent errors and
|
||||
removed trailing whitespace.
|
||||
2014-05-14 David Anderson
|
||||
* print_die.c: Complete printing of DW_FORM_GNU_str_index,
|
||||
DW_FORM_GNU_addr_index,
|
||||
DW_FORM_addrx, DW_FORM_constx.
|
||||
* print_frames.c: Now supports DW_FORM_GNU_addr_index,
|
||||
DW_FORM_addrx, DW_FORM_constx.
|
||||
* dwarfdump.c: Update version string.
|
||||
Trivial text realignment of argument strings
|
||||
in print_error() and print_error_and_continue().
|
||||
* common.c: Update version string.
|
||||
2014-05-11 David Anderson
|
||||
* print_die.c: Add printing of DW_FORM_GNU_str_index, partial
|
||||
of DW_FORM_GNU_addr_index.
|
||||
Support for DW_OP_GNU_const_index too.
|
||||
* dwarfdump.c: Trivial change to error strings so each is unique.
|
||||
Update version string.
|
||||
* common.c: Update version string.
|
||||
2014-04-15 David Anderson
|
||||
* uri.c(hexdig): was testing 0, fixed to be '0'.
|
||||
2014-04-14 David Anderson
|
||||
* dwarfdump.c,common.c: Update version string.
|
||||
2014-04-12 David Anderson
|
||||
* dwarfdump.c,common.c: Update version string.
|
||||
2014-02-13 David Anderson
|
||||
* dwarfdump.cc: Minor changes in the commentary relating
|
||||
to the search paths for dwarfdump.conf. No code changed.
|
||||
2014-02-08 David Anderson
|
||||
* dwarfdump.c,common.c: Update version string.
|
||||
2014-02-08 David Anderson
|
||||
* Makefile.in: Having a single rule build two independent things
|
||||
interacted badly with make -j 2 , so now each rule just builds
|
||||
a single target (see tag*.list builds).
|
||||
2014-02-02 David Anderson
|
||||
* tag_attr.list,tag_attr_ext.list,tag_tree.list,tag_tree_ext.list:
|
||||
Removed trailing whitespace.
|
||||
2014-01-31 David Anderson
|
||||
* addrmap.c: Forgot to add include of dwarf_tsearch.h here. Added.
|
||||
* dwarfdump.c, common.c: Updated version string.
|
||||
2014-01-30 David Anderson
|
||||
* print_die.c: Add limited support for DW_FORM_GNU_ref_alt
|
||||
and DW_FORM_GNU_strp_alt.
|
||||
2014-01-29 David Anderson
|
||||
* addrmap.c addrmap.h checkutil.c,checkutil.h,
|
||||
common.c common.h,dwarf_tsearch.h,dwarfdump.c,dwconf.c,
|
||||
dwconf.h,esb.c,esb.h,globals.h,makename.h,naming.c,naming.h:
|
||||
Remove trailing whitespace.
|
||||
* print_abbrevs.c,print_aranges.c,print_die.c,print_frames.c,
|
||||
print_frames.h,
|
||||
print_lines.c,print_locs.c,print_macros.c,print_pubnames.c,
|
||||
print_ranges.c,
|
||||
print_reloc.c,print_reloc.h,print_sections.c,print_sections.h,
|
||||
print_static_funcs.c,
|
||||
print_static_vars.c,print_strings.c,print_types.c,
|
||||
print_weaknames.c,strstrnocase.c,
|
||||
tag_attr.c,tag_common.c,tag_common.h,tag_tree.c,
|
||||
testesb.c,uri.c,uri.h,uritablebuild.c:
|
||||
Remove trailing whitespace.
|
||||
2014-01-29 David Anderson
|
||||
* dwarf_tsearchbal.c,dwarf_tsearch.h: New source files.
|
||||
* print_frames.c: dwarf_tsearch now built in, we are
|
||||
no longer using libc tsearch.
|
||||
* addrmap.c: Now uses dwarf_tsearch.
|
||||
* configure.in, config.h.in: No longer need HAVE_TSEARCH or
|
||||
HAVE_TDESTROY
|
||||
* configure: regenerated
|
||||
2014-01-10 David Anderson
|
||||
* dwarfdump.c: Change // comments to /* */ comments.
|
||||
* makename.c: Delete blank line and trailing space. Add cast
|
||||
so gcc -ansi compiles without complaint.
|
||||
* print_die.c, uri.c: Change // comments to /* */ comments.
|
||||
* tag_attr.c: Add getopt.h include so gcc -ansi compiles
|
||||
without complaint.
|
||||
* tag_tree.c: Add getopt.h and string.h include so gcc -ansi compiles
|
||||
without complaint. Add cast so strdup call to avoid warning.
|
||||
* addr_map.c: Add cast so strdup call does not cause warning gcc -ansi.
|
||||
2014-01-04 David Anderson
|
||||
* dwarfdump.c: Initialize a local variable to zero and
|
||||
move a declaration (avoiding a c99-ism, the code
|
||||
is not supposed to be using c99 features).
|
||||
|
434
dwarf-compilation.base/contrib/libdwarf/dwarfdump/ChangeLog2015
Normal file
434
dwarf-compilation.base/contrib/libdwarf/dwarfdump/ChangeLog2015
Normal file
|
@ -0,0 +1,434 @@
|
|||
2015-12-31 David Anderson
|
||||
* configure.in: Now allows --enable-shared and --disable-nonshared
|
||||
* configure: regenerated.
|
||||
2015-12-19 David Anderson
|
||||
* dwarfdump.c: Now we print macros alone by CU with -m
|
||||
(at least for DWARF5 macro format)
|
||||
* print_lines.c(print_source_intro): Minor local
|
||||
variable ordering change.
|
||||
* print_macro.c(print_source_intro): Minor local
|
||||
variable ordering change.
|
||||
2015-12-19 David Anderson
|
||||
* print_macro.c: Print the actual macro offset size we will use.
|
||||
2015-12-18 David Anderson
|
||||
* dwarfdump.c,globals.h print_die.c,print_lines.c,
|
||||
print_macro.c,print_pubnames.c,print_ranges.c:
|
||||
Removed globals elf_max_address and elf_address_size
|
||||
in favor of local variables and new
|
||||
global function get_address_size_and_max().
|
||||
2015-12-16 David Anderson
|
||||
* print_aranges.c, print_die.c: Ensure the four
|
||||
error-reporting globals DIE_[CU_][global_]_offset are
|
||||
set properly.
|
||||
2015-12-16 David Anderson
|
||||
* common.c: Update version string.
|
||||
* dwarfdump.c: Update version string. Fix PRINT_CU_INFO()
|
||||
to do what was intended (and not have a side effect).
|
||||
* print_aranges.c: Folded a too-long line.
|
||||
* print_die.c: Folded a line so both offsets listed on same line.
|
||||
* print_macro.c: moved macro_context call above the print of
|
||||
".debug_macro" so if the section does not exist we print nothing.
|
||||
2015-12-15 David Anderson
|
||||
* print_macro.c: Much of printing DWARF5 macros now works.
|
||||
2015-12-13 David Anderson
|
||||
* print_macro.c: Call new function dwarf_get_macro_ops_count() and
|
||||
print returned values.
|
||||
2015-12-12 David Anderson
|
||||
* print_macro.c: Now does -vv intro with cu_die print too.
|
||||
* print_macros.c: Only print .debug_macro name if there are some.
|
||||
2015-12-11 David Anderson
|
||||
* naming.h,naming.c: Added get_MACRO_name().
|
||||
* print_macro.c: Now reads and prints macro5 header.
|
||||
2015-12-11 David Anderson
|
||||
* esb.c: esb_append now checks for NULL string pointer.
|
||||
Added comment esb functions do NOT check for NULL pointers
|
||||
generally.
|
||||
2015-12-10 David Anderson
|
||||
* esb.c: esb_get_copy() failed to account for the trailing NUL.
|
||||
esb_get_copy was not being tested by SELFTEST. Fixed both issues.
|
||||
2015-12-08 David Anderson
|
||||
* common.c,dwarfdump.c: Update version string.
|
||||
* print_frames.c: Fix trailing whitespace.
|
||||
Implement an attempt at DW_CFA_METAWARE_info.
|
||||
2015-12-08 David Anderson
|
||||
* print_frames.c: Fix indents and remove trailing whitespace.
|
||||
Add comments: Errors in DIE info just result in omitting
|
||||
procedure names, no warning/errors.
|
||||
* dwarfdump.c: Deleted Elf64_Ehdr *eh64 declaration
|
||||
that can never be used.
|
||||
2015-11-30 David Anderson
|
||||
* print_frames.c: Remove trailing whitespace.
|
||||
2015-11-30 David Anderson
|
||||
* Makefile.in: Add print_macro.o to build list.
|
||||
* dwarfdump.c: Add macro_flag flag to signal print
|
||||
of DWARF5 debug_macro data.
|
||||
* globals.h: Export new macro print function.
|
||||
* print_die.c: Call new macro print function, skip that attr
|
||||
in checking-only run..
|
||||
2015-11-28 David Anderson
|
||||
* globals.h: Added DEBUG_FRAME_EH_GNU define for consistency..
|
||||
* print_frames.c: use the new dwarf_get_frame_section_name()
|
||||
and dwarf_get_frame_section_name_eh_gnu() functions for
|
||||
section names.
|
||||
* print_lines.c: Use the new dwarf_get_line_section_name_from_die()
|
||||
function for the section name.
|
||||
* print_locs.c,print_macros.c,print_pubnames.c,print_static_funcs.c,
|
||||
print_types.c,print_weaknames.c: Added comments. These are
|
||||
places where the section is either obsolete or the section
|
||||
name is rarely of any use.
|
||||
2015-11-27 David Anderson
|
||||
* dwarfdump.1: Mentions that with zdebug sections offsets
|
||||
refer to expanded object section, not compressed section.
|
||||
* print_aranges.c,print_die.c,print_lines.c,print_ranges.c,
|
||||
print_strings.c: Get the real section name from libdwarf.
|
||||
2015-11-26 David Anderson
|
||||
* common.c,dwarfdump.c: Updated version string.
|
||||
* config.h.in, configure.in, Makefile.in: Deals with
|
||||
zlib when present.
|
||||
2015-11-15 David Anderson
|
||||
* Makefile.in: Now supports building in a clean separate directory.
|
||||
2015-11-11 David Anderson
|
||||
* print_abbrevs.c(dwarf_get_array_info): Initialize local variable.
|
||||
* print_die.c(get_location_list): Initialize local variable.:
|
||||
* dwarf_loc.h: Add declaration of _dwarf_loc_block_sanity_check().
|
||||
* dwarf_loc.c: Call new function _dwarf_loc_block_sanity_check
|
||||
* dwarf_loc2.c: Implement and call new function
|
||||
_dwarf_loc_block_sanity_check to avoid duplicating code.
|
||||
2015-11-07 David Anderson
|
||||
* dwarfdump.1: Documented -x line5=.
|
||||
* dwarfdump.c: Revised -g so it no longer turns on -i.
|
||||
Revised the meaning of -g to mean use old loclist interfaces
|
||||
(for testing the older interfaces with dwarfdump).
|
||||
* print_die.c(get_small_encoding_integer_and_name): a dwarf_dealloc
|
||||
referenced err whereas *err was correct.
|
||||
Revised loclist output making it look a bit like DWARF5
|
||||
even for DWARF2,3,4 output. Reads better, I think.
|
||||
* print_locs.c: -l gets a 'no longer supported' message
|
||||
as it was never safe to do anyway.
|
||||
2015-11-01 David Anderson
|
||||
* configure.in: Add -O0 to --enable-wall.
|
||||
So if a coredump during debugging gdb will work really well.
|
||||
* configure: Regenerated.
|
||||
* print_frames.c: Ommitted a 'return' statement so
|
||||
some output duplicated. Added in the missing return.
|
||||
2015-11-01 David Anderson
|
||||
* Makefile.in, configure.in: Implement --enable-wall for compile-time
|
||||
checking.
|
||||
* configure: Regenerate.
|
||||
* print_die.c: Add DWARF5 DW_OPs and .debug_loc.dwo loclists are
|
||||
handled.
|
||||
Now uses either latest (DWARF5)
|
||||
interfaces or earlier, repurposing the old -g option to select.
|
||||
* print_frames.c,print_frames.h: Printing expressions
|
||||
(in .debug_frame, .eh_frame)
|
||||
now honors -g so DWARF5 expressions handled.
|
||||
* print_lines.c: Fixed some formatting.
|
||||
* print_locs.c: Changes reflecting code calling into print_frames.c
|
||||
2015-10-26 David Anderson
|
||||
* print_die.c: Removed debug printf.Corrected DW_OP_GNU_const_type
|
||||
handling (cannot be fully reported
|
||||
for certain new location operators).
|
||||
2015-10-15 David Anderson
|
||||
* print_die.c: Added DW_FORM_strp_sup,
|
||||
same idea as DW_FORM_GNU_strp_alt.
|
||||
2015-10-15 David Anderson
|
||||
* dwarfdump.c: Add enum line_flag_type_e so we can test
|
||||
all the srclines interfaces (4 of them). Expand -x
|
||||
for that too.
|
||||
* print_die.c: Support DW_FORM_GNU_strp_alt.
|
||||
* print_lines.c: Update for old and new srclines
|
||||
interfaces.
|
||||
* globals.h: Added the enum line_flag_e variable for
|
||||
recording -x line5= value.
|
||||
2015-10-06 David Anderson
|
||||
* dwarfdump.c: Now allow selecting alternate line table
|
||||
reading code so line table routines can be tested thoroughly.
|
||||
* print_lines.c: Uses one of the selected line table routine
|
||||
sets. Adds new line access routine calls to test those too.
|
||||
* globals.h: Declares new flag line_skeleton_flag;
|
||||
* print_die.c: Moved a local declaration to where it is used.
|
||||
Added a missing DW_DLV_ERROR check so in case of error
|
||||
we do not leak memory.
|
||||
2015-09-26 David Anderson
|
||||
* dwarfdump.c, common.c: Update version string.
|
||||
* print_lines.c: Added local variables for clarity
|
||||
in a call, changed the dwarf_srclines_dealloc() location
|
||||
to fully clean up after a two-level line table srcfiles call.
|
||||
2015-09-26 David Anderson
|
||||
* dwarfdump.c, common.c: Update version string.
|
||||
2015-09-24 David Anderson
|
||||
* dwarfdump.c, common.c: Update version string.
|
||||
* print_lines.c: IA in line header hint is
|
||||
really spelled IS. Fixed now.
|
||||
* dwarf_elf_access.c: Added R_IA64* and R_390 relocation ifdefs
|
||||
for cases where they are not in a test machines elf.h or the like.
|
||||
2015-09-23 David Anderson
|
||||
* print_lines.c: Removed accidental newline from output.
|
||||
2015-09-22 David Anderson
|
||||
* print_die.c: Removed trailing whitespace and fixed indentation mistake.
|
||||
* print_lines.c: Fixed indentation and inconsistencies
|
||||
in spelling line table field hints.
|
||||
Leaving IA as has been for a long time
|
||||
though it should be spelled IS.
|
||||
2015-09-19 David Anderson
|
||||
* print_lines.c: Tweaking two-level line table code, mostly
|
||||
comments..
|
||||
2015-09-17 David Anderson
|
||||
* print_lines.c: Adding handling of experimental two-level
|
||||
line table.
|
||||
2015-09-15 Carlos Alberto Enciso
|
||||
* common.c: For Windows version, add a symbol with the
|
||||
release date (taken from the distributed compressed archive),
|
||||
to be used by print_version_details() for better
|
||||
tracking of versions.
|
||||
* print_die.c: The text search (-S), now follows
|
||||
the DW_AT_specification
|
||||
and the DW_AT_abstract_origin attributes,
|
||||
to get the associated name;
|
||||
this finds the declaration and definitions
|
||||
DIEs for a member functions
|
||||
or the abstract and concrete instance DIEs for inlined functions.
|
||||
Fix some C99 issues with local variable declarations in
|
||||
get_attr_value().
|
||||
* print_aranges.c: Add an extra newline in print_aranges().
|
||||
2015-09-15 David Anderson
|
||||
* print_die.c: for case DW_AT_dwo_id a c99-ism has been
|
||||
changed to be like C89.
|
||||
2015-09-14 David Anderson
|
||||
* dwarfdump.c: Remove trailing space.
|
||||
* print_frames.c, globals.h: print_frame_inst_bytes() defined and used
|
||||
in one file, so made a static function, removed from globals.h
|
||||
2015-09-13 David Anderson
|
||||
* dwarfdump.c, common.c: Update version string.
|
||||
2015-09-11 David Anderson
|
||||
* dwarfdump.c: Update usage message to mention
|
||||
-x tied= and update version strings.
|
||||
* common.c: Update version string.
|
||||
2015-09-11 David Anderson
|
||||
* dwarfdump.c: Fixed copy/paste errors so DebugFission
|
||||
code works (see tieddbg in the source).
|
||||
2015-09-11 David Anderson
|
||||
* dwarfdump.c, dwarfdump.1: Added -x tied=<path>
|
||||
option so one can get .debug_addr data when referencing
|
||||
a .dwp or .dwo. Tieing these together.
|
||||
* print_die.c: Fixed indent errors.
|
||||
2015-09-05 David Anderson
|
||||
* tag_attr.list,tag_attr_ext.list,tag_tree.list: removed
|
||||
trailing whitespace.
|
||||
2015-07-12 David Anderson
|
||||
* dwarfdump.c: Use dwoptind dwoptarg, not optind, optarg
|
||||
* dwgetopt.c,dwgetopt.h,dwgetopttest.c,tag_attr.c,
|
||||
tag_tree.c: Use dwoptind dwoptarg etc,
|
||||
not optind, optarg, optopt op6error etc.
|
||||
* print_die.c: updated commentary.
|
||||
2015-05-07 David Anderson
|
||||
* common.c, dwarfdump.c: Update version string.
|
||||
* print_die.c: Print DW_AT_dwo_id properly as a Dwarf_Sig8 value.
|
||||
2015-05-03 David Anderson
|
||||
* print_die.c: Print the fission data from the
|
||||
index section when we print cu header, not when printing cu DIE.
|
||||
Moved cu header/cu die print code to functions, simplifying
|
||||
calling code.
|
||||
2015-05-01 David Anderson
|
||||
* tag_attr.list: Added a DW_AT_signature and
|
||||
moved a couple attributes to match the standard-document
|
||||
order of attributes.
|
||||
2015-03-10 David Anderson
|
||||
* dwarfdump.c: Update version string.
|
||||
* common.c: Update version string.
|
||||
* dwgetopt.c: Was mishandling options
|
||||
missing their required argument and
|
||||
coredumping dwarfdump.
|
||||
* getopttest.c: Added new tests to ensure
|
||||
we have the dwgetopt() fixes working properly.
|
||||
* Makefile.in: Added new test runs to 'make test'.
|
||||
* print_die.c, print_lines.c: Removed instances
|
||||
of trailing whitespace.
|
||||
2015-03-09 David Anderson
|
||||
* Makefile.in: added new tests of dwgetopt.
|
||||
Runs not only dwgetopt but system getopt.
|
||||
* dwarfdump.c: New function set_checks_off()
|
||||
so if printing we don't do checks (intended
|
||||
to be this way for a long time now).
|
||||
Updated version string.
|
||||
* common.c: Updated version string.
|
||||
* print_die.c: Was not always recognizing unit DIES
|
||||
DW_TAG_partial_unit or DW_TAG_type_unit where it saw
|
||||
DW_TAG_compile_unit. Now does so.
|
||||
* dwgetopt.c: Errors could lead to dwarfdump coredump. Fixed.
|
||||
* getopttest.c: Added several new tests. Now one
|
||||
can run single tests and run against either getopt or dwgetopt
|
||||
(set at compile time of getopttest.c).
|
||||
2015-03-03 David Anderson
|
||||
* tag_attr.list: Removed DW_AT_sibling from DW_TAG_partial_unit.
|
||||
DW_TAG_compile_unit. Removed DW_AT_containing_type from
|
||||
DW_TAG_subprogram, DW_TAG_structure_type.
|
||||
* dwarfdump.c,common.c: Update version strings.
|
||||
* print_die.c: Fix indent mistakes. Add comment
|
||||
in _dwarf_print_one_expr_op() that one error is
|
||||
not presently realizable (FreeBSD compiler
|
||||
noticed the situation).
|
||||
* print_ranges.c: Fix indent mistakes.
|
||||
* tag_attr.c: Remove trailing whitespace from a #include line.
|
||||
2015-03-03 Carlos Alberto Enciso
|
||||
* dwarfdump.c: Add allocate_range_array_info(),
|
||||
release_range_array_info() calls to help fix range checking.
|
||||
* globals.h: Add declarations of range checking functions.
|
||||
* print_die.c: Add check_range_array_info() call.
|
||||
Add record_range_array_info_entry() call.
|
||||
Move all the range check code out of print_die.c.
|
||||
Add handling of high_pc as an offset, not just as a value.
|
||||
* print_ranges.c: Delete unneeded includes.
|
||||
Add check_ranges_list() implementation moved from
|
||||
print_die.c. Add new ranges check functions.
|
||||
Range check error messages now appear later in the output,
|
||||
though the content is identical.
|
||||
* tag_attr_ext.list: Add DW_TAG_GNU_call_site and
|
||||
DW_TAG_GNU_call_site_parameter tag attr combinations.
|
||||
* tag_tree_ext.list: Add DW_TAG_GNU_call_site DW_TAG_call_site_parameter
|
||||
2015-02-22 David Anderson
|
||||
* configure.in: removed getopt.h from tests, we use
|
||||
local dwgetopt now.
|
||||
* dwgetopt.h: Function name is dwgetopt. Prototype named right now.
|
||||
Copied from libdwarf dwgetopt.h
|
||||
* configure: regenerated
|
||||
* Makefile.in: build dwgetopt.o
|
||||
* dwgetopt.c: Copied from libdwarf source.
|
||||
* tag_attr.c,tag_tree.c: Now call dwgetopt() instead of getopt().
|
||||
|
||||
2015-02-04 David Anderson
|
||||
* common.c,dwarfdump.c:Updated version string.
|
||||
* print_debugfission.c: Now we are using a Dwarf_Sig8
|
||||
for fission hash so we introduce an esb_s to do
|
||||
the formatting.
|
||||
* tag_attr.c: Now we format a more detailed message when
|
||||
we detect an insufficient static tag_attr or tag_tree
|
||||
array instance. It's code only used at build time so
|
||||
just giving up is fine: someone changed dwarf.h.
|
||||
* tag_attr.list: Adding new TAGs and new Attrs
|
||||
from DWARF5. Since the DWARF5 standard not yet final
|
||||
these could change!
|
||||
* tag_attr_ext.list: Added new GNU attributes.
|
||||
* tag_common.h: updated DW_TAG_last and DW_AT_last
|
||||
STD_TAG_TABLE_ROWS STD_ATTR_TABLE_COLUMNS values
|
||||
due to dwarf.h updates.
|
||||
* tag_tree.list: New entries from DWARF5.
|
||||
2015-01-31 David Anderson
|
||||
* DWARFDUMPCOPYRIGHT: updated to
|
||||
reflect changes today. Old versions
|
||||
of the copyright notices still shown here.
|
||||
* common.c,dwarfdump.c,dwconf.c,esb.c,makename.c,naming.c,
|
||||
print_abbrevs.c,print_aranges.c,print_die.c,print_frames.c,
|
||||
print_lines.c,print_locs.c,print_macros.c,print_pubnames.c,
|
||||
print_ranges.c,print_reloc.c,print_sections.c,print_static_funcs.c,
|
||||
print_static_vars.c,print_strings.c,print_types.c,print_weaknames.c,
|
||||
strstrnocase.c,tag_attr.c,tag_attr.list,tag_attr_ext.list,
|
||||
tag_common.c,tag_tree.c,tag_tree.list,tag_tree_ext.list,
|
||||
uri.c,uritablebuild.c: Removed obsolete SGI postal
|
||||
address and web references.
|
||||
2015-01-31 David Anderson
|
||||
* common.h,dwconf.h,esb.h,globals.h,makename.h,naming.h,
|
||||
print_frames.h,print_reloc.h,print_sections.h,tag_common.h,uri.h:
|
||||
The address and URI for SGI is obsolete and there is no
|
||||
replacement so deleted some lines from the copyright
|
||||
statements.
|
||||
2015-01-30 David Anderson
|
||||
* common.c,dwarfdump.c: Update version string.
|
||||
* globals.h: Added format_sig8_string() to global functions.
|
||||
* print_debug_fission.c: Updated .debug_cu/tu_index hash signature
|
||||
code to match libdwarf (Dwarf_Sig8, not Dwarf_Unsigned).
|
||||
Allow for missing hash (?).
|
||||
* print_die.c: Use format_sig8_string().
|
||||
2015-01-29 David Anderson
|
||||
* print_die.c: Two places used C99-only variable
|
||||
declaration. Moved declarations up to conform to C90.
|
||||
2015-01-24 David Anderson
|
||||
* dwgetopt.c,dwgetopt.h: Using NetBSD getopt source with
|
||||
modifications to support :: for uniform behavior
|
||||
for all users. Not all getopt are the same. Named dwgetopt().
|
||||
* dwgetopttest.c: Does tests of dwgetopt() for conformance
|
||||
with dwarfdump requirements. See 'make selftest'.
|
||||
* Makefile.in: Now has selftest for dwgetopt and
|
||||
links dwgetopt.o into dwarfdump.
|
||||
* esb.c: Now prints PASS on success and counts errors.
|
||||
* dwarfdump.c: Now calls dwgetopt and includes dwgetopt.h
|
||||
Added a new global so we recognize where needed
|
||||
not to do some checks when checking (
|
||||
for debugfission some things not sensible).
|
||||
* globals.h: Removed cu_offset (not needed) and added
|
||||
suppress_checking_on_dwp flags.
|
||||
* print_die.c:renamed cu_offset to be a static: dieprint_cu_offset
|
||||
Reset it when finished with a CU. (-k checks got into trouble
|
||||
when both .debug_info and .debug_types present).
|
||||
2015-01-21 David Anderson
|
||||
* common.c, dwarfdump.c: Update version string.
|
||||
* print_die.c: For a DW_FORM_ref_sig8 type signature
|
||||
value, if not printing the actual FORM print
|
||||
<type signature> so the hex value makes sense.
|
||||
It is obviously not a .debug_info global offset.
|
||||
Now prints debug fission (dwp) information for
|
||||
each CU with such.
|
||||
2015-01-18 David Anderson
|
||||
* common.c, dwarfdump.c: Update version string.
|
||||
2015-01-15 David Anderson
|
||||
* dwarfdump.c: dump_unique_errors_table() ifdef out
|
||||
of normal compiles, it is unused. Unused local variables
|
||||
removed.
|
||||
Update version string.
|
||||
* esb.c: Moved stdarg.h include just after stdio.h include
|
||||
for positioning consistency.
|
||||
* globals.h: Added stdarg.h include just after stdio.h
|
||||
include as we use va_list a lot and so stdarg.h
|
||||
is required.
|
||||
* print_debugfission.c: Remove two unused local variables.
|
||||
* print_frames.c: Remove trailing whitespace.
|
||||
* tag_attr.c: #include stdarg.h. Add {} to array initializers
|
||||
output to avoid compiler warning.
|
||||
* tag_common.c: Move stdarg.h include to just after
|
||||
stdio.h for positioning consistency.
|
||||
Update version string.
|
||||
* tag_tree.c: Revised include order to start with
|
||||
globals.h and to not duplicate includes of stdio.h etc.
|
||||
Add {} to array initializers
|
||||
output to avoid compiler warning.
|
||||
* testesb.c: Add include of stdarg.h.
|
||||
2015-01-12 David Anderson
|
||||
* tag_common.c: Add comments about va_start, va_end.
|
||||
* esb.c: Add comments about va_start, va_end.
|
||||
Add va_end in the selftest code.
|
||||
* common.c: Update version string.
|
||||
* dwarfdump.c: Update version string. Add va_end()
|
||||
and comments about va_end.
|
||||
2015-01-08 David Anderson and Carlos Alberto Enciso
|
||||
* Makefile.in: add selftest: rule, which tests esb.c
|
||||
* dwarfdump.c: Add new options -O file=path, -kD -kG -ku kuf.
|
||||
New checking and reporting features intended to give a
|
||||
report on attribute and tag usage.
|
||||
Update version string.
|
||||
* common.c: Update version string.
|
||||
* esb.c, esb.h: Added new interface using stdarg.
|
||||
Added self-test feature.
|
||||
* dwarf_makename.c: new #pragma (not Linux/Unix related).
|
||||
* print_die.c: Implements collecting the new statistics
|
||||
dwarfdump reports.
|
||||
* print_lines.c: New statistics collected.
|
||||
* tag_attr.c: New checks for the tag/attr table correctness.
|
||||
* tag_attr.list: Fixes duplicated entries.
|
||||
* tag_attr.list_ext: Adds APPLE attribute DW_AT_APPLE_optimized
|
||||
that llvm emits.
|
||||
* tag_common.c: bad_line_input() now allows stdarg calls so
|
||||
its easier to emit good error messages.
|
||||
* tag_common.h: bad_line_input() arg list changed a little. Stdarg now.
|
||||
* tag_tree.c: New tag tree checking done. New statistics
|
||||
available.
|
||||
* tag_tree.list: Adds DW_TAG_unspecified_type,
|
||||
DW_TAG_rvalue_reference_type,
|
||||
DW_TAG_restrict_type.
|
||||
* tag_tree_ext.list: Adds DW_TAG_GNU_template_template_parameter.
|
||||
Fixes duplication of entries.
|
||||
2015-01-05 David Anderson
|
||||
* dwarfdump.c: Don't call dwarf_finish() if
|
||||
the dwarf-init call failed.
|
||||
* common.c,dwarfdump.c: Updated version string.
|
||||
2015-01-01 David Anderson
|
||||
* A new year begins.
|
508
dwarf-compilation.base/contrib/libdwarf/dwarfdump/ChangeLog2016
Normal file
508
dwarf-compilation.base/contrib/libdwarf/dwarfdump/ChangeLog2016
Normal file
|
@ -0,0 +1,508 @@
|
|||
2016-11-24 David Anderson
|
||||
* common.c,dwarfdump.c,tag_attr.c,tag_tree.c:
|
||||
Update version strings.
|
||||
2016-11-24 David Anderson
|
||||
* Makefile.in: Clean *~
|
||||
2016-11-22 David Anderson
|
||||
* print_abbrevs.c: Some -k abbrev warnings did not make it clear that
|
||||
they were checking against a heuristic sanity-check value
|
||||
for the maximum number of attributes, not a genuine
|
||||
maximum.
|
||||
2016-11-22 David Anderson
|
||||
* tag_attr.c: Remove bogus blank line with trailing spaces.
|
||||
2016-11-11 David Anderson
|
||||
* print_frames.c: Apply fix to local_dwarf_decode_s_leb128_chk so
|
||||
it matches libdwarf dwarf_leb.c. A fix for certain bit
|
||||
pattern provoking undefined behavior in C..
|
||||
2016-11-01 David Anderson
|
||||
* tag_attr.c,tag_common.h,tag_attr_ext.list: Adding
|
||||
Ada GNAT gcc attributes DW_AT_GNU_numerator,
|
||||
DW_AT_GNU_denominator, DW_AT_GNU_bias in the extended
|
||||
table for checking.
|
||||
2016-10-21 David Anderson
|
||||
* common.c,dwarfdump.c,tag_attr.c,tag_tree.c: Update
|
||||
version strings.
|
||||
2016-09-30 David Anderson
|
||||
* configure.in: Add additional -fsanitize tests to
|
||||
--enable-sanitize option.
|
||||
* configure: Regenerated.
|
||||
* print_die.c: Ensure << applied to unsigned
|
||||
to avoid undefined operation. We were getting
|
||||
officially undefined behavior.
|
||||
* tag_attr_ext.list: Removed trailing whitespace from
|
||||
two lines.
|
||||
2016-09-30 David Anderson
|
||||
* makename.c: The unused static function value_hashfunc()
|
||||
has been removed.
|
||||
* tag_attr.c, tag_tree.c: Changed (1<<bit) to
|
||||
(((unsigned)1)<<bit) to avoid a runtime error
|
||||
(during dwardump build) about the left shift.
|
||||
2016-09-27 David Anderson
|
||||
* esb.c: Deleted file-static variable that was only
|
||||
used for a test. No longer needed.
|
||||
2016-09-27 David Anderson
|
||||
* print_die.c: Changed the name of experimental
|
||||
loclist operators from LLE to LLEX
|
||||
as these are in use for certain DWARF4 loclist
|
||||
providers. The DWARF5 LLE don't use the same
|
||||
numberic values as the experimental ones.
|
||||
2016-09-23 David Anderson
|
||||
* Makefile.in: A mistake here meant every compile
|
||||
rebuilds all of dwarfdump even with a trivial change.
|
||||
Fixed so now trivial changes just rebuild a minimum.
|
||||
The dependencies here remain incomplete: if you change
|
||||
a data structure you must 'make clean' and recompile
|
||||
everything in dwarfdump.
|
||||
2016-09-22 David Anderson
|
||||
* dwarfdump.c,print_die.c,print_frames.c,print_gdbindex.c:
|
||||
In case of error, dwarf_dealloc the error once it
|
||||
has been printed. Avoiding a small memory leak.
|
||||
2016-09-21 David Anderson
|
||||
* configure.in: Supports --enable-sanitize which
|
||||
sets dwfsanitize so build uses -fsanitize=address .
|
||||
* configure: Regenerated.
|
||||
* Makefile.in: Now uses dwfsanitize (when set)
|
||||
during builds. Added dwarf_tsearchbal.c to the makename
|
||||
build so dwarf_tsearchbal.o is available for tag_tree_build
|
||||
and tag_attr _buildprograms at build time.
|
||||
* dwarfdump.c: Moved all static struct esb_s variables
|
||||
to the top level and ensure they are destructed on
|
||||
normal exit. Destruct all static makename strings, abbrev
|
||||
data, sanitized strings, and ranges strings.
|
||||
Now all allocated memory is freed before a normal exit.
|
||||
* esb.c: Added {} and commentary for clarity.
|
||||
esb_destructor now a bit more careful (redundantly but
|
||||
helpful for a reader).
|
||||
* globals.h: Declared destructors allowing access to
|
||||
static data allocated in certain source files.
|
||||
Fixed the selftest code.
|
||||
* macrocheck.c: Correct selftest code.
|
||||
* makename.c: Now uses dwarf_tsearch to keep a record of
|
||||
strings it allocates and avoids duplicating strings.
|
||||
A destructor gives a way to free the allocated memory.
|
||||
* makename.h: Added declaration of makename_destructor().
|
||||
* print_abbrevs.c: Implemented destruct_abbrev_array() to
|
||||
clean up a static array.
|
||||
* print_die.c: Tidied up declaration/constructor pairs
|
||||
so it's easier to see that all declarations have a constructor
|
||||
call.
|
||||
* print_lines.c: Tidied up declaration/constructor pair
|
||||
so it's easier to see that the constructor is called.
|
||||
* print_locs.c: Tidied up declaration/constructor pair
|
||||
so it's easier to see that the constructor is called.
|
||||
* print_ranges.c: Implemented ranges_esb_string_destructor()
|
||||
to destruct local static esb string at normal dwarfdump exit.
|
||||
* sanitized.c: Implemented sanitized_string_destructor()
|
||||
to destruct local static esb string at normal dwarfdump exit.
|
||||
* strstrnocase.c: Code could do *ct past end of string.
|
||||
Fixed to avoid that.
|
||||
2016-09-15 David Anderson
|
||||
* configure.in: Added check for unistd.h.
|
||||
* configure: regenerated.
|
||||
* dwarfdump.c,tag_attr.c,tag_tree.c: Add #ifdef HAVE_UNISTD_H
|
||||
for unistd.h include.
|
||||
2016-09-15 David Anderson
|
||||
* tag_tree.c: Two local variables had no initializer.
|
||||
Though adding the initializers is logically unnecessary
|
||||
it is the standard way to code in libdwarf/dwarfdump.
|
||||
2016-09-13 David Anderson
|
||||
* print_die.c: Shortened the printing of DW_AT_discr_list
|
||||
to improve readability.
|
||||
2016-09-09 David Anderson
|
||||
* tag_attr.c,tag_tree.c: Further improvements to ensure we do not run
|
||||
off the ends of rows or columns.
|
||||
New commentary on array contents of generated arrays.
|
||||
* tag_tree.c: Further improvements to ensure we do not run
|
||||
off the ends of rows or columns.
|
||||
* tag_attr_ext.list: Removed accidental extra characters.
|
||||
Added DW_AT_GNU_dwo_id to dW_TAG_compile_unit.
|
||||
* tag_common.c: The static declaration of the internal tables
|
||||
used to build table source code was not checked so there
|
||||
were some array entries stepped on. fixed.
|
||||
* tag_common.h: Added commentary. Made the build-time-only
|
||||
static array declaration size macros more explicit.
|
||||
2016-09-09 David Anderson
|
||||
* print_die.c: Fixed compiler warnings introduced
|
||||
in previous commit.
|
||||
2016-09-08 David Anderson
|
||||
* print_die.c: Now we use the new dwarf_discr_list()
|
||||
to read DW_AT_discr_list correctly and print it.
|
||||
* tag_attr.c,tag_tree.c: Now we check for too-small and too-large
|
||||
array sizes and stop the build in case of error.
|
||||
* tag_common.h: Now the static array sizes match
|
||||
the lists.
|
||||
2016-06-13 David Anderson
|
||||
* sanitized.c: Added static keyword to declaration of
|
||||
no_questionable_chars().
|
||||
* print_frames.c: Added a warning about a useless
|
||||
frame operator (if such appears, only checkedwith -f -vvv).
|
||||
Ensure we print rows generated even if a pointless last row
|
||||
(a break becomes continue).
|
||||
* common.c,dwarfdump.c,tag_attr.c,tag_tree.c,gennames.c:
|
||||
Update version string.
|
||||
2016-06-12 David Anderson
|
||||
* common.c,dwarfdump.c,tag_attr.c,tag_tree.c,gennames.c:
|
||||
Update version string.
|
||||
2016-06-12 David Anderson
|
||||
* print_frames.c: Using a new frame interface to reduce
|
||||
dwarfdump runtime on frame printing by 10 percent.
|
||||
2016-06-10 David Anderson
|
||||
* print_frames.c: Added commentary as the previous comment
|
||||
about printing CFA and other registers having a 'duplicate row'
|
||||
was a bit terse.
|
||||
2016-06-08 David Anderson
|
||||
* sanitized.c: Remove trailing whitespace.
|
||||
2016-06-08 David Anderson
|
||||
* common.c,dwarfdump.c,tag_attr.c,tag_tree.c:
|
||||
Update version string.
|
||||
* sanitized.c: Only fix strings that have bad
|
||||
characters in them. This improves dwarfdump performance.
|
||||
2016-06-01 David Anderson
|
||||
* dwarfdump.c, common.c: Update version string.
|
||||
Use DW_VERSION_DATE_STR instead of DWARFDUMP_VERSION
|
||||
* tag_attr.c, tag_tree.c: Use DW_VERSION_DATE_STR instead
|
||||
of __DATE__ __TIME__
|
||||
* Makefile.in: Tweaked for debian build compatibility.
|
||||
2016-05-22 David Anderson
|
||||
* dwarfdump.c, common.c: Update version string.
|
||||
2016-05-20 David Anderson
|
||||
* print_frames.c: One test for erroneous length was
|
||||
incorrectly coded, leading to possible crash when encountering
|
||||
erroneous frame information.
|
||||
2016-05-19 David Anderson
|
||||
* configure.in: Does a better job reporting configure actions.
|
||||
* configure: Regenerated
|
||||
* dwarfdump.1: Fixed spelling errors and moved ./dwarfdump.conf
|
||||
right one space to get the dot off column 1.
|
||||
2016-05-18 David Anderson
|
||||
* print_die.c: Fix typo in error message.
|
||||
* print_frames.c: Do additional checks for incorrect data
|
||||
when printing frame instructions to avoid dwarfdump crash..
|
||||
2016-05-12 David Anderson
|
||||
* print_abbrevs.c,print_aranges.c,print_frames.c,print_sections.c:
|
||||
Removed trailing whitespace. Fixed indentation.
|
||||
* tag_attr.c,tag_tree.c: Ensure calls to libdwarf interfaces
|
||||
in these build-time tools check the status returned.
|
||||
2016-05-10 David Anderson
|
||||
* print_aranges.c: Minor commentary change and
|
||||
rearranging lines for clarity.
|
||||
* print_die.c: formwith->form with
|
||||
in an error message.
|
||||
* print_frames.c: Now checks for bogus expression block
|
||||
lengths and bogus LEB values. LEB reading functions
|
||||
now here and static functions.
|
||||
* print_sections.c: Moved leb reading functions to print_frames.c
|
||||
2016-05-07 David Anderson
|
||||
* dwarfdump.c, common.c: Update version string.
|
||||
* print_frames.c: For local variable added
|
||||
initialization-at-definition.
|
||||
2016-05-06 David Anderson
|
||||
* sanitized.c: Fixed trailing whitespace and
|
||||
added 'static' to local function definition.
|
||||
2016-05-05 David Anderson
|
||||
* Makefile.in: Added sanitized.o to objects to build.
|
||||
* dwarfdump.1: Document '-x nosanitizestrings'.
|
||||
* dwarfdump.c: Set internal flag based on '-x nosanitizestrings'.
|
||||
* globals.h: add extern for the flag no_sanitize_string_garbage
|
||||
and the sanitized() interface.
|
||||
* print_die.c,print_frames.c,print_lines.c,
|
||||
print_macro.c, print_macros.c : Call sanitized() on some strings.
|
||||
* sanitized.c: Changes control characters int output to %xx
|
||||
uri-style (by default). See '-x nosanitizestrings'.
|
||||
2016-05-03 David Anderson
|
||||
* dwarfdump.c: revise print_error_maybe_continue() to
|
||||
print additional useful data.
|
||||
* print_die.c: If dwarf_srcfiles() gets DW_DLV_NO_ENTRY
|
||||
do not print a warning. Normal to have no DW_AT_stmt_list.
|
||||
* print_lines.c: Fix column header 'row' changed to 'lno'.
|
||||
Refine a CHECK message to say a DW_LNE_end_sequence
|
||||
does not exactly match function high address. It is not
|
||||
an error, just something about how the code was emitted.
|
||||
2016-04-30 David Anderson
|
||||
* dwarfdump.c, common.c: Update version string.
|
||||
2016-04-27 David Anderson
|
||||
* dwarfdump.c, common.c: Update version string.
|
||||
2016-04-27 David Anderson
|
||||
* dwarfdump.c: Update version string.
|
||||
Remove a field from printf on error as that duplicates
|
||||
the error number in the error string.
|
||||
2016-04-25 David Anderson
|
||||
* esb.c, dwarfdump.c: Fix a couple indent mistakes.
|
||||
2016-04-25 David Anderson
|
||||
* esb.h, esb.c: The typedef for 'string' is now gone, it
|
||||
was never helpful..
|
||||
* dwarfdump.c: Remove 'string' use.
|
||||
* dwgetopt.c: Moved test-only function to getopttest.c.
|
||||
Added (void) argument to a the functions with no arguments.
|
||||
* getopttest.c: Repaired failures to to renaming
|
||||
to dwoptind etc and added the test-only
|
||||
function from dwgetopt.c
|
||||
* globals.h: Removed 'string' typedef.
|
||||
* print_die.c,print_frames.c, print_lines.c, print_strings.c,
|
||||
tag_attr.c, tag_tree.c: Removed use of 'string' type, use
|
||||
plain old char*.
|
||||
2016-04-21 Carlos Alberto Enciso
|
||||
Printing using the 'esb' module was broken. It seems to work
|
||||
because the default internal buffer size (240), was big enough
|
||||
to receive the resulting output.
|
||||
|
||||
* esb.c, esb.h: Missing prefix 'esb' for 'allocate_more'.
|
||||
Initial buffer size reduced to 16.
|
||||
New function 'esb_open_null_device': open 'null' device.
|
||||
New function 'esb_close_null_device': close 'null' device.
|
||||
New function 'esb_allocate_more_if_needed': allocate more
|
||||
space if required, leaving the contents unchanged, so the
|
||||
caller, does not need to worry about it.
|
||||
There are 2 cases:
|
||||
Windows: use the 'null' device to get the required space
|
||||
UNIX: use a big buffer (512). But if the result is bigger,
|
||||
the original problem will be shown.
|
||||
The function 'esb_append_printf_ap', now takes care of
|
||||
increasing the buffer if needed.
|
||||
|
||||
* dwarfdump.c: In the case of windows, open and close the 'null'
|
||||
device, in order to setup the esb module.
|
||||
2016-04-21 Carlos Alberto Enciso
|
||||
* globals.h: Do not define 'string' for a C++ build; it clashes with
|
||||
the 'std::string'.
|
||||
* print_die.c: Minor typo error.
|
||||
2016-04-21 Carlos Alberto Enciso
|
||||
* For a WINDOWS version, display the 32/64 bits configuration.
|
||||
2016-04-21 Carlos Alberto Enciso
|
||||
* Use the _WIN32 macro to identify a WINDOWS specific code.
|
||||
2016-03-17 David Anderson
|
||||
* print_die.c(print_one_die_section): One dieprint_cu_goffset
|
||||
Dwarf_Unsigned->Dwarf_Off.
|
||||
2016-03-12 David Anderson
|
||||
* print_abbrevs.c(print_abbrevs): Printed output of an abbrev with code
|
||||
and tag but no attributes was simply wrong. Now fixed.
|
||||
Now avoids printing children flag on a null abbrev (a NUL byte
|
||||
meaning no abbrev is there at all, ending a list of abbrevs).
|
||||
* print_die.c: it was difficult, even with -G -v, to identify
|
||||
the actual offset (in .debug_abbrev) of the abbreviations.
|
||||
Now -i -G -v gives a bit more data on abbreviations.
|
||||
2016-03-09 David Anderson
|
||||
* dwarfdump.c,globals.h,print_aranges.c,print_die.c,print_frames.c,
|
||||
print_lines.c,print_macro.c,print_pubnames.c:
|
||||
Remove the global dieprint_cu_offset, use local vars and pass around instead.
|
||||
Ensure the traverse() logic when checking type references do not evaluate
|
||||
references to other sections. Many argument lists got an additional argument or two.
|
||||
2016-03-07 David Anderson
|
||||
* dwarfdump.c: Update version string. Added CU_low_address so
|
||||
CU_base_address is properly used only for the DWARF
|
||||
CU 'base address' notion. Print CU_low_address in PRINT_CU_INFO().
|
||||
* common.c: Update version string
|
||||
* globals.h: New macro DROP_ERROR_INSTANCE(d,r,e) improves consistency
|
||||
where we need to drop a Dwarf_Error instance.
|
||||
* print_die.c: Support for CU_low_address. Use DROP_ERROR_INSTANCE
|
||||
where appropriate.
|
||||
* print_frames.c: Use DROP_ERROR_INSTANCE
|
||||
where appropriate.
|
||||
2016-03-03 Carlos Alberto-Enciso
|
||||
* dwarfdump.c: Missing '_' just for consistency.
|
||||
Print any harmless errors only the required in command line
|
||||
* globals.h: Unused declaration.
|
||||
* print_die.c: When displaying a DW_AT_type offset error, uses the standard
|
||||
0xdddddddd format. Wrap to 80 columns, a long line.
|
||||
2016-02-17 Carlos Alberto-Enciso
|
||||
* dwarfdump/tag_attr_ext.list,dwarfdump/tag_common.h,
|
||||
dwarfdump/tag_tree_ext.list: Tighten up the list limits
|
||||
and add commentary about the list limits.
|
||||
2016-02-14 DavidAnderson
|
||||
* dwarfdump.c,common.c: Updated version strings.
|
||||
* print_die.c,print_strings.c: fixed indent errors.
|
||||
2016-02-14 Carlos Alberto-Enciso
|
||||
* tag_attr_ext.list, tag_tree_ext.list: Adding
|
||||
DW_TAG_GNU_template_parameter_pack,DW_TAG_GNU_formal_parameter_pack.
|
||||
* tag_tree.c: Printed wrong name from tag-tree table in
|
||||
a comment.
|
||||
* tag_common.h: Ext tag table rows count was higher than needed.
|
||||
Ext attr table rows increased to 11.
|
||||
2016-02-13 David Anderson
|
||||
* dwarfdump.c,globals.h,print_aranges.c,print_die.c,
|
||||
print_frames.c,print_lines.c,print_locs.c,print_macro.c,
|
||||
print_pubnames.c,print_reloc.ckprint_static_funcs.c,
|
||||
print_static_vars.c,print_strings.c,print_types.c,
|
||||
print_weaknames.c: Removed global Dwarf_Error err
|
||||
and provided local Dwarf_Error as needed.
|
||||
2016-02-13 David Anderson
|
||||
* configure.in: Add -Wshadow to --enable-shared. Add else and
|
||||
cross-compile [] to the AC_TRY_RUN
|
||||
* configure: Regenerate.
|
||||
* dwarf_tsearchbal.c: Delete shadowed variable p, we use
|
||||
the original instead.
|
||||
* dwarfdump.c: Rename variables to avoid confusing
|
||||
duplicated names (found by -Wshadow). #if 0 the
|
||||
unused function old_get_cu_name(), which should get deleted.
|
||||
* globals.h: Fixed prototypes, #if 0 prototype of
|
||||
the unused function old_get_cu_name().
|
||||
* print_abbrevs.c, print_aranges.c,print_debugfission.c,
|
||||
print_die.c,print_frames.c, print_gdbindex.c, print_lines.c,
|
||||
print_pubnames.c, print_ranges.c, print_sections.c,
|
||||
tag_attr.c, tag_tree.c: Add local Dwarf_Error and
|
||||
rename variables to avoid shadowing confusion.
|
||||
2016-02-10 David Anderson
|
||||
* globals.h: Change enum val from std to singledw5.
|
||||
Some compilation environments reserve 'std'.
|
||||
* dwarfdump.c,print_lines.c: Use the new spelling.
|
||||
2016-02-10 David Anderson
|
||||
* common.c,dwarfdump.c: Update version string.
|
||||
2016-02-07 David Anderson
|
||||
* common.c,dwarfdump.c: Update version string.
|
||||
2016-02-06 David Anderson
|
||||
* print_die.c,tag_attr.c,tag_tree.c: Remove trailing whitespace.
|
||||
2016-02-06 David Anderson
|
||||
* warningcontrol.h: Defines UNUSEDARG macro as needed.
|
||||
* common.c,dwarf_tsearchbal.c,dwarfdump.c,globals.h,
|
||||
macrocheck.c: Now use UNUSEDARG macro so known-unused
|
||||
args do not cause spurious warnings.
|
||||
* configure.in: Sets HAVE_UNUSED_ATTRIBUTE if the compiler
|
||||
in use supports __attribute ((unused)). So we can have
|
||||
lots of warnings turned on without seeing the warnings
|
||||
we wish to ignore for now.
|
||||
* configure,config.h.in: Regenerated.
|
||||
2016-02-06 David Anderson
|
||||
* print_frames.c: Was printing cie index, not fde index,
|
||||
in the fde output. Now prints more sensibly.
|
||||
Now tests do_print_dwarf, the flag it should have been using,
|
||||
to decide whether to print.
|
||||
2016-02-02 David Anderson
|
||||
* dwarfdump.c: Get section sizes so we can do a better
|
||||
sanity check on ofsets (ie, call dwarf_get_section_max_offsets_c()).
|
||||
Check DWARF2 macros for sanity just as we do DWARF5
|
||||
macros. Read DWARF2 macros per-cu, not as a standalone
|
||||
section. Add global data section_high_offsets_global,
|
||||
a struct with all known section sizes.
|
||||
* macrocheck.c: New section size argument for more complete
|
||||
size analysis.
|
||||
* globals.h: Declarations for section_high_offsets_global.
|
||||
* macrocheck.h: Update prototype of print_macro_statistics().
|
||||
* print_die.c: Drop section-as-a-whole macro reporting for
|
||||
macinfo in favor of reporting per CU.
|
||||
* print_macros.c: Allow for print and check runs (not both
|
||||
at once).
|
||||
2016-01-28 David Anderson
|
||||
* dwarfdump.c,common.c: Update version string.
|
||||
* print_die.c: Changed the most frequent global die
|
||||
offset values to print as GOFF=0x...
|
||||
for uniformity with -G and space saving from the
|
||||
string 'global die offset'.
|
||||
2016-01-27 David Anderson
|
||||
* print_die.c: Added a helpertree find call on typedieoffset
|
||||
which is really a better check for known signed/unsigned.
|
||||
2016-01-26 David Anderson
|
||||
* dwarfdump.c,common.c: Update version string.
|
||||
2016-01-26 David Anderson
|
||||
* Makefile.in: Added helpertree.h, and .c.
|
||||
* dwarfdump.c: Added include helpertree.h
|
||||
* print_die.c: Now attempts (harder) to
|
||||
figure out if a constant is really signed or insigned
|
||||
when printing it. Fixes annoyance with printing attributes
|
||||
longer than 27 characters.
|
||||
Unifies a number of printf-style calls into functions, reducing
|
||||
the number of statically visible calls to sprintf.
|
||||
Attempts to remember whether some things are explicitly
|
||||
typed as signed or unsigned.
|
||||
* helpertree.h, helpertree.c: New. Simple use of tsearch
|
||||
to memo-ize signedness.
|
||||
2016-01-20
|
||||
* configure.in: Added more compiler optiosn to --enable-wall
|
||||
* configure: Regenerated
|
||||
* dwarf_tsearchbal.c: Fixed warnings.
|
||||
* dwarfdump.c: Fixed warnings.
|
||||
* dwconf.c: Fixed warnings.
|
||||
* dwconf.h: Fixed warnings.
|
||||
* esb.c: Fixed warnings.
|
||||
* globals.h: Fixed warnings.
|
||||
* print_debugfission.c: Fixed warnings.
|
||||
* print_die.c: Fixed warnings.
|
||||
* print_frames.c: Fixed warnings.
|
||||
* print_sections.c: Fixed warnings.
|
||||
2016-01-20
|
||||
* macrocheck.c: Remove trailing whitespace.
|
||||
* print_lines.c: Only print line context record
|
||||
if we do_print_dwarf is non-zero. The directory index
|
||||
was printing as 0 in the line_context record. Was a typo
|
||||
in the printf, now fixed.
|
||||
2016-01-20
|
||||
* configure.in: Now --enable-wall adds -Wdeclaration-after-statement
|
||||
etc.
|
||||
* configure: Regenerated.
|
||||
* dwarfdump.c: Now all functions have visible prototypes, no ().
|
||||
* dwconf.c: Now local func declared static.
|
||||
* dwgetopt.c: Added include dwgetopt.h. Unused function
|
||||
#if 0 so invisible.
|
||||
* globals.h: Now all functions have prototypes, no ().
|
||||
* macrocheck.c: Removed unused locals. Fixed a
|
||||
dwarf_twalk call to *tree (not just tree).
|
||||
* naming.c: Added include naming.h.
|
||||
* print_gdbindex.c: Made local function static.
|
||||
* tag_attr.c,tag_common.c: Made local function static.
|
||||
2016-01-19 David Anderson
|
||||
* dwarf_tsearchbal.c: Deleted the unused function rotatex().
|
||||
* dwarfdump.c: Remove duplicate trailing ;
|
||||
* esb.c(esb_append): Straighten out the logic
|
||||
and avoid doing append if the to-be-appended
|
||||
string is empty.
|
||||
* globals.h Add ifdef __cplusplus for extern "C".
|
||||
* esb.h,naming.h: Idempotent #ifndef and __cplusplus extern "C" added.
|
||||
* print_frames.c: Ensure local var starts at zero.
|
||||
Move statement to below declarations.
|
||||
* print_lines.c: Ensure declarations before executable statements.
|
||||
2016-01-19 David Anderson
|
||||
* print_frames.c: Fix trailing whitespace and indentation.
|
||||
2016-01-19 David Anderson
|
||||
* print_die.c,tag_tree.c: Change statement ;; by removing
|
||||
second semicolon.
|
||||
2016-01-17 David Anderson
|
||||
* common.c: Update version string
|
||||
* dwarfdump.c: Made reset_overall_CU_error_data() a global.
|
||||
We now try to show CU name etc on case there is an error
|
||||
reading frame data. Update version strin.
|
||||
Added DEBUG_FRAME DEBUG_FRAME_EH to the PRINT_CU_INFO() tests.
|
||||
New function: load_CU_error_data().
|
||||
* print_frames.c: Now uses a local Dwarf_Error
|
||||
in a few places (CU names for frames) instead
|
||||
of the global 'err' so we do not get the errors
|
||||
mixed up.
|
||||
We now try to show CU name etc on case there is an error
|
||||
reading frame data.
|
||||
2016-01-14 David Anderson
|
||||
* common.c: Update version string.
|
||||
* dwarfdump.c: Update version string. Include macrocheck.h.
|
||||
Delete one accidental blank line.
|
||||
* dwarf_tsearchbal.c: Added comment about compiler warning.
|
||||
* dwarf_macrocheck.c: Added missing return statement.
|
||||
Removed trailing whitespace. Fixed broken qsort_compare()
|
||||
* macrocheck.h: Fixed trailing whitespace.
|
||||
* print_abbrevs.c: Generalized an attribute count warning
|
||||
a bit (see GENERAL_MAX_ATTRIB_COUNT). Fixed the code
|
||||
handling the abbrev_array to be correct and a bit simpler.
|
||||
Added new abbreviations tests.
|
||||
* print_die.c: Include macrocheck.h. Fix trailing whitespace.
|
||||
2016-01-12 David Anderson
|
||||
* common.c: Update version string.
|
||||
* dwarfdump.c: Update version string.
|
||||
* print_abbrevs.c: If an abbreviation number is a bit
|
||||
goofy, accomodate it so we do not write to
|
||||
memory we did not allocate. It will
|
||||
be caught a bit later in the run as an invalid DIE
|
||||
or abbreviation.
|
||||
* print_die.c: When we switch sections inside a DIE print
|
||||
save and restore current_section_id to get the best
|
||||
reporting on errors/checks.
|
||||
2016-01-12 David Anderson
|
||||
* common.c,dwarfdump.c: Update version string.
|
||||
2016-01-12 David Anderson
|
||||
* Makefile.in: Adding macrocheck.h, and .c. Adding
|
||||
selftest of macrocheck.c.
|
||||
* dwarfdump.c: Now handles imported DWARF5 macros
|
||||
and adds support for -kw for macro section checking.
|
||||
* globals.h: Adding check_macros flag and macro_check_tree declaration
|
||||
and print_macros_5style_this_cu() declaration..
|
||||
* print_die.c: Now prints imported macros using
|
||||
print_macros_5style_this_cu().
|
||||
* print_macro.c: Now deals with imported macro units using
|
||||
macrocheck.c and .h. Fixed bug for DW_MACRO_define/undef
|
||||
where we did improper string validity check.
|
||||
|
|
@ -0,0 +1,93 @@
|
|||
|
||||
========The dwarfdump copyright=======
|
||||
|
||||
The full text of the GPL version 2 is provided in the file GPL.txt.
|
||||
|
||||
See the end of this file for January 2015 changes.
|
||||
|
||||
Nearly all the files in this directory have contained a GPL
|
||||
copyright, not an LGPL copyright, for years. The following
|
||||
is an example of that copyright as used in the dwarfdump
|
||||
source, and is what SGI always intended (in David
|
||||
Anderson's opinion) to have present in
|
||||
the DWARFDUMPCOPYRIGHT file. (tag_tree.list tag_attr.list
|
||||
acconfig.h have long been marked LGPL and therefore the LGPL
|
||||
copyright, not GPL, applies to those three files.) This GPL
|
||||
copyright text added here to DWARFDUMPCOPYRIGHT Dec 4, 2006
|
||||
|
||||
Copyright (C) 2000,2002,2004,2005 Silicon Graphics, Inc. All Rights Reserved.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of version 2 of the GNU General Public License as
|
||||
published by the Free Software Foundation.
|
||||
|
||||
This program is distributed in the hope that it would be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
Further, this software is distributed without any warranty that it is
|
||||
free of the rightful claim of any third person regarding infringement
|
||||
or the like. Any license provided herein, whether implied or
|
||||
otherwise, applies only to this software file. Patent licenses, if
|
||||
any, provided herein do not apply to combinations of this program with
|
||||
other software, or any other product whatsoever.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write the Free Software Foundation, Inc., 51
|
||||
Franklin Street - Fifth Floor, Boston MA 02110-1301, USA.
|
||||
|
||||
Contact information: Silicon Graphics, Inc., 1500 Crittenden Lane,
|
||||
Mountain View, CA 94043, or:
|
||||
|
||||
http://www.sgi.com
|
||||
|
||||
For further information regarding this notice, see:
|
||||
|
||||
http://oss.sgi.com/projects/GenInfo/NoticeExplan
|
||||
|
||||
|
||||
The following was the entire content of this file before
|
||||
December 24 2006, Being the LGPL text this is in conflict
|
||||
with the individual source files and I (David Anderson)
|
||||
believe the source file copyright was intended for dwarfdump
|
||||
not the LGPL source directly following this note. However the
|
||||
3 files tag_tree.list tag_attr.list acconfig.h have long been
|
||||
marked LGPL and the following copyright applies to those three.
|
||||
|
||||
Copyright (C) 2000,2004 Silicon Graphics, Inc. All Rights Reserved.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of version 2.1 of the GNU Lesser General Public License
|
||||
as published by the Free Software Foundation.
|
||||
|
||||
This program is distributed in the hope that it would be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
Further, this software is distributed without any warranty that it is
|
||||
free of the rightful claim of any third person regarding infringement
|
||||
or the like. Any license provided herein, whether implied or
|
||||
otherwise, applies only to this software file. Patent licenses, if
|
||||
any, provided herein do not apply to combinations of this program with
|
||||
other software, or any other product whatsoever.
|
||||
|
||||
You should have received a copy of the GNU Lesser General Public
|
||||
License along with this program; if not, write the Free Software
|
||||
Foundation, Inc., 59 Temple Place - Suite 330, Boston MA 02111-1307,
|
||||
USA.
|
||||
|
||||
Contact information: Silicon Graphics, Inc., 1500 Crittenden Lane,
|
||||
Mountain View, CA 94043, or:
|
||||
|
||||
http://www.sgi.com
|
||||
|
||||
For further information regarding this notice, see:
|
||||
|
||||
http://oss.sgi.com/projects/GenInfo/NoticeExplan
|
||||
|
||||
|
||||
As of 31 January 2015 the lines
|
||||
with http://www.sgi.com and oss.sgi.com have been removed.
|
||||
sgi.com is readily found on the web and oss.sgi.com
|
||||
no longer exists. No one from SGI still contributes
|
||||
to dwarfdump.
|
339
dwarf-compilation.base/contrib/libdwarf/dwarfdump/GPL.txt
Normal file
339
dwarf-compilation.base/contrib/libdwarf/dwarfdump/GPL.txt
Normal file
|
@ -0,0 +1,339 @@
|
|||
GNU GENERAL PUBLIC LICENSE
|
||||
Version 2, June 1991
|
||||
|
||||
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
Preamble
|
||||
|
||||
The licenses for most software are designed to take away your
|
||||
freedom to share and change it. By contrast, the GNU General Public
|
||||
License is intended to guarantee your freedom to share and change free
|
||||
software--to make sure the software is free for all its users. This
|
||||
General Public License applies to most of the Free Software
|
||||
Foundation's software and to any other program whose authors commit to
|
||||
using it. (Some other Free Software Foundation software is covered by
|
||||
the GNU Lesser General Public License instead.) You can apply it to
|
||||
your programs, too.
|
||||
|
||||
When we speak of free software, we are referring to freedom, not
|
||||
price. Our General Public Licenses are designed to make sure that you
|
||||
have the freedom to distribute copies of free software (and charge for
|
||||
this service if you wish), that you receive source code or can get it
|
||||
if you want it, that you can change the software or use pieces of it
|
||||
in new free programs; and that you know you can do these things.
|
||||
|
||||
To protect your rights, we need to make restrictions that forbid
|
||||
anyone to deny you these rights or to ask you to surrender the rights.
|
||||
These restrictions translate to certain responsibilities for you if you
|
||||
distribute copies of the software, or if you modify it.
|
||||
|
||||
For example, if you distribute copies of such a program, whether
|
||||
gratis or for a fee, you must give the recipients all the rights that
|
||||
you have. You must make sure that they, too, receive or can get the
|
||||
source code. And you must show them these terms so they know their
|
||||
rights.
|
||||
|
||||
We protect your rights with two steps: (1) copyright the software, and
|
||||
(2) offer you this license which gives you legal permission to copy,
|
||||
distribute and/or modify the software.
|
||||
|
||||
Also, for each author's protection and ours, we want to make certain
|
||||
that everyone understands that there is no warranty for this free
|
||||
software. If the software is modified by someone else and passed on, we
|
||||
want its recipients to know that what they have is not the original, so
|
||||
that any problems introduced by others will not reflect on the original
|
||||
authors' reputations.
|
||||
|
||||
Finally, any free program is threatened constantly by software
|
||||
patents. We wish to avoid the danger that redistributors of a free
|
||||
program will individually obtain patent licenses, in effect making the
|
||||
program proprietary. To prevent this, we have made it clear that any
|
||||
patent must be licensed for everyone's free use or not licensed at all.
|
||||
|
||||
The precise terms and conditions for copying, distribution and
|
||||
modification follow.
|
||||
|
||||
GNU GENERAL PUBLIC LICENSE
|
||||
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
|
||||
|
||||
0. This License applies to any program or other work which contains
|
||||
a notice placed by the copyright holder saying it may be distributed
|
||||
under the terms of this General Public License. The "Program", below,
|
||||
refers to any such program or work, and a "work based on the Program"
|
||||
means either the Program or any derivative work under copyright law:
|
||||
that is to say, a work containing the Program or a portion of it,
|
||||
either verbatim or with modifications and/or translated into another
|
||||
language. (Hereinafter, translation is included without limitation in
|
||||
the term "modification".) Each licensee is addressed as "you".
|
||||
|
||||
Activities other than copying, distribution and modification are not
|
||||
covered by this License; they are outside its scope. The act of
|
||||
running the Program is not restricted, and the output from the Program
|
||||
is covered only if its contents constitute a work based on the
|
||||
Program (independent of having been made by running the Program).
|
||||
Whether that is true depends on what the Program does.
|
||||
|
||||
1. You may copy and distribute verbatim copies of the Program's
|
||||
source code as you receive it, in any medium, provided that you
|
||||
conspicuously and appropriately publish on each copy an appropriate
|
||||
copyright notice and disclaimer of warranty; keep intact all the
|
||||
notices that refer to this License and to the absence of any warranty;
|
||||
and give any other recipients of the Program a copy of this License
|
||||
along with the Program.
|
||||
|
||||
You may charge a fee for the physical act of transferring a copy, and
|
||||
you may at your option offer warranty protection in exchange for a fee.
|
||||
|
||||
2. You may modify your copy or copies of the Program or any portion
|
||||
of it, thus forming a work based on the Program, and copy and
|
||||
distribute such modifications or work under the terms of Section 1
|
||||
above, provided that you also meet all of these conditions:
|
||||
|
||||
a) You must cause the modified files to carry prominent notices
|
||||
stating that you changed the files and the date of any change.
|
||||
|
||||
b) You must cause any work that you distribute or publish, that in
|
||||
whole or in part contains or is derived from the Program or any
|
||||
part thereof, to be licensed as a whole at no charge to all third
|
||||
parties under the terms of this License.
|
||||
|
||||
c) If the modified program normally reads commands interactively
|
||||
when run, you must cause it, when started running for such
|
||||
interactive use in the most ordinary way, to print or display an
|
||||
announcement including an appropriate copyright notice and a
|
||||
notice that there is no warranty (or else, saying that you provide
|
||||
a warranty) and that users may redistribute the program under
|
||||
these conditions, and telling the user how to view a copy of this
|
||||
License. (Exception: if the Program itself is interactive but
|
||||
does not normally print such an announcement, your work based on
|
||||
the Program is not required to print an announcement.)
|
||||
|
||||
These requirements apply to the modified work as a whole. If
|
||||
identifiable sections of that work are not derived from the Program,
|
||||
and can be reasonably considered independent and separate works in
|
||||
themselves, then this License, and its terms, do not apply to those
|
||||
sections when you distribute them as separate works. But when you
|
||||
distribute the same sections as part of a whole which is a work based
|
||||
on the Program, the distribution of the whole must be on the terms of
|
||||
this License, whose permissions for other licensees extend to the
|
||||
entire whole, and thus to each and every part regardless of who wrote it.
|
||||
|
||||
Thus, it is not the intent of this section to claim rights or contest
|
||||
your rights to work written entirely by you; rather, the intent is to
|
||||
exercise the right to control the distribution of derivative or
|
||||
collective works based on the Program.
|
||||
|
||||
In addition, mere aggregation of another work not based on the Program
|
||||
with the Program (or with a work based on the Program) on a volume of
|
||||
a storage or distribution medium does not bring the other work under
|
||||
the scope of this License.
|
||||
|
||||
3. You may copy and distribute the Program (or a work based on it,
|
||||
under Section 2) in object code or executable form under the terms of
|
||||
Sections 1 and 2 above provided that you also do one of the following:
|
||||
|
||||
a) Accompany it with the complete corresponding machine-readable
|
||||
source code, which must be distributed under the terms of Sections
|
||||
1 and 2 above on a medium customarily used for software interchange; or,
|
||||
|
||||
b) Accompany it with a written offer, valid for at least three
|
||||
years, to give any third party, for a charge no more than your
|
||||
cost of physically performing source distribution, a complete
|
||||
machine-readable copy of the corresponding source code, to be
|
||||
distributed under the terms of Sections 1 and 2 above on a medium
|
||||
customarily used for software interchange; or,
|
||||
|
||||
c) Accompany it with the information you received as to the offer
|
||||
to distribute corresponding source code. (This alternative is
|
||||
allowed only for noncommercial distribution and only if you
|
||||
received the program in object code or executable form with such
|
||||
an offer, in accord with Subsection b above.)
|
||||
|
||||
The source code for a work means the preferred form of the work for
|
||||
making modifications to it. For an executable work, complete source
|
||||
code means all the source code for all modules it contains, plus any
|
||||
associated interface definition files, plus the scripts used to
|
||||
control compilation and installation of the executable. However, as a
|
||||
special exception, the source code distributed need not include
|
||||
anything that is normally distributed (in either source or binary
|
||||
form) with the major components (compiler, kernel, and so on) of the
|
||||
operating system on which the executable runs, unless that component
|
||||
itself accompanies the executable.
|
||||
|
||||
If distribution of executable or object code is made by offering
|
||||
access to copy from a designated place, then offering equivalent
|
||||
access to copy the source code from the same place counts as
|
||||
distribution of the source code, even though third parties are not
|
||||
compelled to copy the source along with the object code.
|
||||
|
||||
4. You may not copy, modify, sublicense, or distribute the Program
|
||||
except as expressly provided under this License. Any attempt
|
||||
otherwise to copy, modify, sublicense or distribute the Program is
|
||||
void, and will automatically terminate your rights under this License.
|
||||
However, parties who have received copies, or rights, from you under
|
||||
this License will not have their licenses terminated so long as such
|
||||
parties remain in full compliance.
|
||||
|
||||
5. You are not required to accept this License, since you have not
|
||||
signed it. However, nothing else grants you permission to modify or
|
||||
distribute the Program or its derivative works. These actions are
|
||||
prohibited by law if you do not accept this License. Therefore, by
|
||||
modifying or distributing the Program (or any work based on the
|
||||
Program), you indicate your acceptance of this License to do so, and
|
||||
all its terms and conditions for copying, distributing or modifying
|
||||
the Program or works based on it.
|
||||
|
||||
6. Each time you redistribute the Program (or any work based on the
|
||||
Program), the recipient automatically receives a license from the
|
||||
original licensor to copy, distribute or modify the Program subject to
|
||||
these terms and conditions. You may not impose any further
|
||||
restrictions on the recipients' exercise of the rights granted herein.
|
||||
You are not responsible for enforcing compliance by third parties to
|
||||
this License.
|
||||
|
||||
7. If, as a consequence of a court judgment or allegation of patent
|
||||
infringement or for any other reason (not limited to patent issues),
|
||||
conditions are imposed on you (whether by court order, agreement or
|
||||
otherwise) that contradict the conditions of this License, they do not
|
||||
excuse you from the conditions of this License. If you cannot
|
||||
distribute so as to satisfy simultaneously your obligations under this
|
||||
License and any other pertinent obligations, then as a consequence you
|
||||
may not distribute the Program at all. For example, if a patent
|
||||
license would not permit royalty-free redistribution of the Program by
|
||||
all those who receive copies directly or indirectly through you, then
|
||||
the only way you could satisfy both it and this License would be to
|
||||
refrain entirely from distribution of the Program.
|
||||
|
||||
If any portion of this section is held invalid or unenforceable under
|
||||
any particular circumstance, the balance of the section is intended to
|
||||
apply and the section as a whole is intended to apply in other
|
||||
circumstances.
|
||||
|
||||
It is not the purpose of this section to induce you to infringe any
|
||||
patents or other property right claims or to contest validity of any
|
||||
such claims; this section has the sole purpose of protecting the
|
||||
integrity of the free software distribution system, which is
|
||||
implemented by public license practices. Many people have made
|
||||
generous contributions to the wide range of software distributed
|
||||
through that system in reliance on consistent application of that
|
||||
system; it is up to the author/donor to decide if he or she is willing
|
||||
to distribute software through any other system and a licensee cannot
|
||||
impose that choice.
|
||||
|
||||
This section is intended to make thoroughly clear what is believed to
|
||||
be a consequence of the rest of this License.
|
||||
|
||||
8. If the distribution and/or use of the Program is restricted in
|
||||
certain countries either by patents or by copyrighted interfaces, the
|
||||
original copyright holder who places the Program under this License
|
||||
may add an explicit geographical distribution limitation excluding
|
||||
those countries, so that distribution is permitted only in or among
|
||||
countries not thus excluded. In such case, this License incorporates
|
||||
the limitation as if written in the body of this License.
|
||||
|
||||
9. The Free Software Foundation may publish revised and/or new versions
|
||||
of the General Public License from time to time. Such new versions will
|
||||
be similar in spirit to the present version, but may differ in detail to
|
||||
address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the Program
|
||||
specifies a version number of this License which applies to it and "any
|
||||
later version", you have the option of following the terms and conditions
|
||||
either of that version or of any later version published by the Free
|
||||
Software Foundation. If the Program does not specify a version number of
|
||||
this License, you may choose any version ever published by the Free Software
|
||||
Foundation.
|
||||
|
||||
10. If you wish to incorporate parts of the Program into other free
|
||||
programs whose distribution conditions are different, write to the author
|
||||
to ask for permission. For software which is copyrighted by the Free
|
||||
Software Foundation, write to the Free Software Foundation; we sometimes
|
||||
make exceptions for this. Our decision will be guided by the two goals
|
||||
of preserving the free status of all derivatives of our free software and
|
||||
of promoting the sharing and reuse of software generally.
|
||||
|
||||
NO WARRANTY
|
||||
|
||||
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
|
||||
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
|
||||
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
|
||||
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
|
||||
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
|
||||
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
|
||||
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
|
||||
REPAIR OR CORRECTION.
|
||||
|
||||
12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
|
||||
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
|
||||
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
|
||||
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
|
||||
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
|
||||
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
|
||||
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
|
||||
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
|
||||
POSSIBILITY OF SUCH DAMAGES.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
How to Apply These Terms to Your New Programs
|
||||
|
||||
If you develop a new program, and you want it to be of the greatest
|
||||
possible use to the public, the best way to achieve this is to make it
|
||||
free software which everyone can redistribute and change under these terms.
|
||||
|
||||
To do so, attach the following notices to the program. It is safest
|
||||
to attach them to the start of each source file to most effectively
|
||||
convey the exclusion of warranty; and each file should have at least
|
||||
the "copyright" line and a pointer to where the full notice is found.
|
||||
|
||||
<one line to give the program's name and a brief idea of what it does.>
|
||||
Copyright (C) <year> <name of author>
|
||||
|
||||
This program 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; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
|
||||
This program 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 this program; if not, write to the Free Software Foundation, Inc.,
|
||||
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
|
||||
Also add information on how to contact you by electronic and paper mail.
|
||||
|
||||
If the program is interactive, make it output a short notice like this
|
||||
when it starts in an interactive mode:
|
||||
|
||||
Gnomovision version 69, Copyright (C) year name of author
|
||||
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
||||
This is free software, and you are welcome to redistribute it
|
||||
under certain conditions; type `show c' for details.
|
||||
|
||||
The hypothetical commands `show w' and `show c' should show the appropriate
|
||||
parts of the General Public License. Of course, the commands you use may
|
||||
be called something other than `show w' and `show c'; they could even be
|
||||
mouse-clicks or menu items--whatever suits your program.
|
||||
|
||||
You should also get your employer (if you work as a programmer) or your
|
||||
school, if any, to sign a "copyright disclaimer" for the program, if
|
||||
necessary. Here is a sample; alter the names:
|
||||
|
||||
Yoyodyne, Inc., hereby disclaims all copyright interest in the program
|
||||
`Gnomovision' (which makes passes at compilers) written by James Hacker.
|
||||
|
||||
<signature of Ty Coon>, 1 April 1989
|
||||
Ty Coon, President of Vice
|
||||
|
||||
This General Public License does not permit incorporating your program into
|
||||
proprietary programs. If your program is a subroutine library, you may
|
||||
consider it more useful to permit linking proprietary applications with the
|
||||
library. If this is what you want to do, use the GNU Lesser General
|
||||
Public License instead of this License.
|
256
dwarf-compilation.base/contrib/libdwarf/dwarfdump/Makefile.in
Normal file
256
dwarf-compilation.base/contrib/libdwarf/dwarfdump/Makefile.in
Normal file
|
@ -0,0 +1,256 @@
|
|||
# Makefile for dwarfdump
|
||||
# This is made very simple so it should work with
|
||||
# any 'make'.
|
||||
# The Makefile does assume that libdwarf is at ../libdwarf
|
||||
# from the dwarfdump2 source directory.
|
||||
#
|
||||
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
prefix = @prefix@
|
||||
exec_prefix = @exec_prefix@
|
||||
bindir = $(exec_prefix)/bin
|
||||
libdir = $(exec_prefix)/lib
|
||||
mandir = $(exec_prefix)/share/man
|
||||
man1dir = $(mandir)/man1
|
||||
|
||||
|
||||
INSTALL = @INSTALL@
|
||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
||||
INSTALL_DATA = @INSTALL_DATA@
|
||||
DATAROOT = @datarootdir@
|
||||
SHELL = /bin/sh
|
||||
CC = @CC@
|
||||
AR = @AR@
|
||||
ARFLAGS = @ARFLAGS@
|
||||
RM = rm
|
||||
RANLIB = @RANLIB@
|
||||
DEFS = @DEFS@
|
||||
# ../libdwarf gets us to local headers and a libdwarf
|
||||
# archive, usually, so we assume it.
|
||||
dwfwall = @dwfwall@
|
||||
dwfsanitize = @dwfsanitize@
|
||||
dwfzlib = @dwfzlib@
|
||||
LIBDWARF_PATH = ../libdwarf
|
||||
DIRINC = $(srcdir)/../libdwarf
|
||||
LIBS = @LIBS@ -L../libdwarf -ldwarf -lelf $(dwfzlib)
|
||||
INCLUDES = -I. -I$(srcdir) -I../libdwarf -I$(srcdir)/../libdwarf
|
||||
CFLAGS = $(PREINCS) @CPPFLAGS@ @CFLAGS@ $(INCLUDES) $(dwfwall) $(dwfsanitize) -DCONFPREFIX=${libdir} $(POSTINCS)
|
||||
LDFLAGS = $(PRELIBS) @LDFLAGS@ $(LIBS) $(dwfsanitize) $(POSTLIBS)
|
||||
#VG = valgrind --leak-check=full --show-leak-kinds=all
|
||||
VG =
|
||||
|
||||
|
||||
INSTALL = cp
|
||||
|
||||
binprefix =
|
||||
|
||||
FINALOBJECTS = \
|
||||
addrmap.o \
|
||||
checkutil.o \
|
||||
dwarfdump.o \
|
||||
dwconf.o \
|
||||
esb.o \
|
||||
glflags.o \
|
||||
helpertree.o \
|
||||
macrocheck.o \
|
||||
print_abbrevs.o \
|
||||
print_aranges.o \
|
||||
print_debugfission.o \
|
||||
print_die.o \
|
||||
print_dnames.o \
|
||||
print_frames.o \
|
||||
print_gdbindex.o \
|
||||
print_lines.o \
|
||||
print_locs.o \
|
||||
print_macro.o \
|
||||
print_macros.o \
|
||||
print_pubnames.o \
|
||||
print_ranges.o \
|
||||
print_reloc.o \
|
||||
print_sections.o \
|
||||
print_section_groups.o \
|
||||
print_static_funcs.o \
|
||||
print_static_vars.o \
|
||||
print_strings.o \
|
||||
print_types.o \
|
||||
print_weaknames.o \
|
||||
sanitized.o \
|
||||
section_bitmaps.o \
|
||||
strstrnocase.o \
|
||||
uri.o
|
||||
GEN_HFILES = common.o \
|
||||
tmp-tt-table.c \
|
||||
tmp-ta-table.c \
|
||||
tmp-ta-ext-table.c \
|
||||
tmp-tt-ext-table.c
|
||||
|
||||
all: dwarfdump
|
||||
|
||||
HEADERS = $(srcdir)/checkutil.h \
|
||||
$(srcdir)/common.h \
|
||||
$(srcdir)/dwconf.h \
|
||||
$(srcdir)/dwgetopt.h \
|
||||
$(srcdir)/esb.h \
|
||||
$(srcdir)/globals.h \
|
||||
$(srcdir)/macrocheck.h \
|
||||
$(srcdir)/makename.h \
|
||||
$(srcdir)/dwarf_tsearch.h \
|
||||
$(srcdir)/print_frames.h \
|
||||
$(srcdir)/section_bitmaps.h \
|
||||
$(srcdir)/uri.h
|
||||
|
||||
$(FINALOBJECTS): $(GEN_HFILES) $(HEADERS) $(srcdir)/naming.c
|
||||
|
||||
default: $(TARGETS)
|
||||
|
||||
dwarfdump: $(FINALOBJECTS) dwarf_tsearchbal.o makename.o naming.o common.o dwgetopt.o
|
||||
$(CC) $(CFLAGS) -o $@ $(FINALOBJECTS) common.o makename.o naming.o dwgetopt.o dwarf_tsearchbal.o $(LDFLAGS)
|
||||
|
||||
dwgetopt.o: $(srcdir)/dwgetopt.h $(srcdir)/dwgetopt.c
|
||||
$(CC) $(CFLAGS) -c $(srcdir)/dwgetopt.c
|
||||
|
||||
dwarf_tsearchbal.o: $(srcdir)/dwarf_tsearch.h $(srcdir)/dwarf_tsearchbal.c
|
||||
$(CC) $(CFLAGS) -c $(srcdir)/dwarf_tsearchbal.c
|
||||
|
||||
makename.o: $(srcdir)/makename.h $(srcdir)/makename.c
|
||||
$(CC) $(CFLAGS) -c $(srcdir)/makename.c
|
||||
|
||||
common.o: $(srcdir)/common.c $(srcdir)/common.h
|
||||
$(CC) $(CFLAGS) -c $(srcdir)/common.c
|
||||
|
||||
naming.o: $(srcdir)/naming.c $(srcdir)/naming.h
|
||||
$(CC) $(CFLAGS) -c $(srcdir)/naming.c
|
||||
|
||||
# We need this as naming.o has external references we cannot have
|
||||
# in the tree builds.
|
||||
trivial_naming.o: $(srcdir)/naming.c
|
||||
$(CC) $(CFLAGS) -DTRIVIAL_NAMING -c $(srcdir)/naming.c -o trivial_naming.o
|
||||
|
||||
tag_tree_build: $(srcdir)/tag_tree.c $(DIRINC)/dwarf.h $(HEADERS) tag_common.o makename.o common.o trivial_naming.o dwgetopt.o dwarf_tsearchbal.o
|
||||
LD_LIBRARY_PATH=$$LD_LIBRARY_PATH:$(LIBDWARF_PATH) $(CC) $(CFLAGS) $(srcdir)/tag_tree.c tag_common.o common.o makename.o dwarf_tsearchbal.o trivial_naming.o dwgetopt.o $(LDFLAGS) -o tag_tree_build
|
||||
|
||||
tag_attr_build: $(srcdir)/tag_attr.c $(DIRINC)/dwarf.h $(HEADERS) tag_common.o makename.o common.o trivial_naming.o dwgetopt.o dwarf_tsearchbal.o
|
||||
$(CC) $(CFLAGS) $(srcdir)/tag_attr.c tag_common.o common.o makename.o trivial_naming.o dwarf_tsearchbal.o dwgetopt.o $(LDFLAGS) -o tag_attr_build
|
||||
|
||||
# Plain GNU C dash E does not work on a .list,
|
||||
# so copy to a .c name to run
|
||||
# the following four table creations.
|
||||
tmp-tt-table.c: $(srcdir)/tag_tree.list tag_tree_build
|
||||
-rm -f tmp-t1.c
|
||||
cp $(srcdir)/tag_tree.list tmp-t1.c
|
||||
$(CC) $(CFLAGS) -E tmp-t1.c > ./tmp-tag-tree-build1.tmp
|
||||
LD_LIBRARY_PATH=$$LD_LIBRARY_PATH:$(LIBDWARF_PATH) ./tag_tree_build -s -i tmp-tag-tree-build1.tmp -o tmp-tt-table.c
|
||||
|
||||
tmp-tt-ext-table.c: $(srcdir)/tag_tree_ext.list tag_tree_build
|
||||
-rm -f tmp-t4.c
|
||||
cp $(srcdir)/tag_tree_ext.list tmp-t4.c
|
||||
$(CC) $(CFLAGS) -E tmp-t4.c > ./tmp-tag-tree-build4.tmp
|
||||
LD_LIBRARY_PATH=$$LD_LIBRARY_PATH:$(LIBDWARF_PATH) ./tag_tree_build -e -i tmp-tag-tree-build4.tmp -o tmp-tt-ext-table.c
|
||||
|
||||
tmp-ta-table.c: $(srcdir)/tag_attr.list tag_attr_build
|
||||
-rm -f tmp-t2.c
|
||||
cp $(srcdir)/tag_attr.list tmp-t2.c
|
||||
$(CC) $(CFLAGS) -E tmp-t2.c > ./tmp-tag-attr-build2.tmp
|
||||
LD_LIBRARY_PATH=$$LD_LIBRARY_PATH:$(LIBDWARF_PATH) ./tag_attr_build -s -i tmp-tag-attr-build2.tmp -o tmp-ta-table.c
|
||||
|
||||
tmp-ta-ext-table.c: $(srcdir)/tag_attr_ext.list tag_attr_build
|
||||
-rm -f tmp-t3.c
|
||||
cp $(srcdir)/tag_attr_ext.list tmp-t3.c
|
||||
$(CC) $(CFLAGS) -E tmp-t3.c > ./tmp-tag-attr-build3.tmp
|
||||
LD_LIBRARY_PATH=$$LD_LIBRARY_PATH:$(LIBDWARF_PATH) ./tag_attr_build -e -i tmp-tag-attr-build3.tmp -o tmp-ta-ext-table.c
|
||||
|
||||
|
||||
test: esb.o dwgetopt.o
|
||||
echo "ESB test"
|
||||
$(CC) $(CFLAGS) -o test $(srcdir)/testesb.c esb.o
|
||||
$(VG) ./test
|
||||
-rm -f ./test
|
||||
echo "dwgetopt test"
|
||||
$(CC) $(CFLAGS) -o getopttest $(srcdir)/getopttest.c dwgetopt.o
|
||||
$(VG) ./getopttest
|
||||
-rm -f ./getopttest
|
||||
echo "Now use system getopt to validate our tests"
|
||||
$(CC) $(CFLAGS) -DGETOPT_FROM_SYSTEM -o getopttestnat $(srcdir)/getopttest.c dwgetopt.o
|
||||
./getopttestnat -c 1
|
||||
./getopttestnat -c 2
|
||||
./getopttestnat -c 3
|
||||
./getopttestnat -c 5
|
||||
./getopttestnat -c 6
|
||||
./getopttestnat -c 7
|
||||
./getopttestnat -c 8
|
||||
-rm -f ./getopttestnat
|
||||
-rm -f ./selfesb
|
||||
-rm -f ./selfmc
|
||||
-rm -f ./selfmakename
|
||||
-rm -f ./selfsection_bitmaps
|
||||
-rm -f ./selfprint_reloc
|
||||
$(CC) -g -c $(INCLUDES) $(srcdir)/esb.c
|
||||
$(CC) -g -c $(INCLUDES) $(srcdir)/dwarf_tsearchbal.c
|
||||
$(CC) -g -DSELFTEST $(INCLUDES) $(srcdir)/makename.c dwarf_tsearchbal.o -o selfmakename
|
||||
$(CC) -DSELFTEST $(INCLUDES) -g $(srcdir)/helpertree.c esb.o dwarf_tsearchbal.o -o selfhelpertree
|
||||
./selfhelpertree
|
||||
rm -f ./selfhelpertree
|
||||
./selfmakename
|
||||
rm -f ./selfmakename
|
||||
$(CC) -DSELFTEST $(INCLUDES) -g $(srcdir)/macrocheck.c esb.o dwarf_tsearchbal.o -o selfmc
|
||||
./selfmc
|
||||
rm -f ./selfmc
|
||||
$(CC) -DSELFTEST -g $(srcdir)/esb.c -o selfesb
|
||||
./selfesb
|
||||
rm -f ./selfesb
|
||||
$(CC) -DSELFTEST -I../libdwarf -g section_bitmaps.c -o selfsection_bitmaps
|
||||
./selfsection_bitmaps
|
||||
rm -f ./selfsection_bitmaps
|
||||
$(CC) -DSELFTEST -I../libdwarf -g print_reloc.c esb.o -o selfprint_reloc
|
||||
./selfprint_reloc
|
||||
rm -f ./selfprint_reloc
|
||||
|
||||
# This simply assumes that a default INSTALL (cp) command
|
||||
# will work and leave sensible permissions on the resulting files.
|
||||
# Some adjustment might be required, see README.
|
||||
install: all
|
||||
$(INSTALL) dwarfdump $(bindir)/dwarfdump
|
||||
$(INSTALL) $(srcdir)/dwarfdump.conf $(libdir)/dwarfdump.conf
|
||||
$(INSTALL) $(srcdir)/dwarfdump.1 $(man1dir)/dwarfdump.1
|
||||
|
||||
uninstall:
|
||||
-rm -f $(bindir)/dwarfdump
|
||||
-rm -f $(man1dir)/dwarfdump.1
|
||||
-rm -f $(libdir)/dwarfdump.conf
|
||||
|
||||
clean:
|
||||
rm -f *.o dwarfdump
|
||||
rm -f _tag_attr_table.c
|
||||
rm -f _tag_attr_ext_table.c
|
||||
rm -f _tag_tree_table.c
|
||||
rm -f _tag_tree_ext_table.c
|
||||
-rm -f tag_attr_build*.tmp
|
||||
-rm -f tag_tree_build*.tmp
|
||||
rm -f tag_tree_build
|
||||
rm -f tag_attr_build
|
||||
-rm -f _*.c _*.h
|
||||
-rm -f tmp-*.c tmp-*.h tmp-*.tmp
|
||||
rm -f gennames
|
||||
rm -f dwarf_names_new.c
|
||||
rm -f dwarf_names_new.h
|
||||
rm -f dwarf_names_enum.h
|
||||
rm -f dwarf_names.h
|
||||
rm -f dwarf_names.c
|
||||
rm -f a.out
|
||||
rm -f getopttest
|
||||
rm -f getopttestnat
|
||||
rm -f selfhelpertree
|
||||
rm -f selfmc
|
||||
rm -f *~
|
||||
|
||||
distclean: clean
|
||||
rm -f config.log config.h config.cache config.status
|
||||
rm -rf autom4te.cache
|
||||
rm -rf Makefile
|
||||
|
||||
shar:
|
||||
@echo "shar not set up yet"
|
||||
dist:
|
||||
@echo "dist not set up yet"
|
262
dwarf-compilation.base/contrib/libdwarf/dwarfdump/NEWS
Normal file
262
dwarf-compilation.base/contrib/libdwarf/dwarfdump/NEWS
Normal file
|
@ -0,0 +1,262 @@
|
|||
May 17, 2017
|
||||
Now dwarfdump understands both split-dwarf and COMDAT sections
|
||||
(it calls the section-groups 'Groups')
|
||||
so it is possible to properly print all such. A traditional
|
||||
DWARF2,3,4,5 consumer can ignore section groups.
|
||||
To print in more complicate situations the -x groupnumber=3
|
||||
(3 as an example) lets you choose a specific group/comdat to print.
|
||||
Dwarfdump prints out a section-groupnumber table when appropriate
|
||||
a making it easy to know what groups are present.
|
||||
March 24, 2017
|
||||
dwarfdump: Now argv[0] is checked before setting the program_name
|
||||
global variable. If it contains '/dwarfdump.O' that part of
|
||||
the string is shortened to '/dwarfdump'.
|
||||
Doing this removes a need for the regressiontests to use sed
|
||||
and shortens the regressiontests runtime on one machine from
|
||||
77 minutes to 23 minutes.
|
||||
September 20, 2016
|
||||
dwarfdump now frees all memory it used when it terminates normally.
|
||||
No malloc space left behind.
|
||||
It gets a clean report from
|
||||
valgrind --leak-check=full --show-leak-kinds=all
|
||||
May 5, 2016
|
||||
By default dwarfdump sanitizes strings, so if a corrupted
|
||||
DWARF file has non-printable bytes in a string they are
|
||||
each turned into %xx (% followed by
|
||||
two hex digits for a single string character).
|
||||
This is safe for terminals to print and shows the actual value.
|
||||
The '-x nosanitizestrings' option turns off this feature so bytes
|
||||
are shown as printf and your system show them.
|
||||
The same format as uri style, but only using % on characters
|
||||
that may have bad effects if printed to a terminal (not,
|
||||
for example, space or tab characters).
|
||||
Nor are normal '%' in a string altered (in uri such would be
|
||||
turned to %25 or to %%).
|
||||
February 25, 2015
|
||||
Copied dwgetopt.c dwgetopt.h from libdwarf so dwarfdump can
|
||||
use dwgetopt() and still build without necessarily
|
||||
having the libdwarfsource easily available.
|
||||
Some environments do not have a getopt() so copying
|
||||
dwgetopt.h,.h here ensures we have this functionality
|
||||
for everyone.
|
||||
January 08, 2015
|
||||
dwarfdump does new checking. See options -kD -kG -ku -kuf.
|
||||
In addition, dwarfdump output can be written to a file without
|
||||
using redirection by using the new -O file=<path>
|
||||
option.
|
||||
January 29, 2014
|
||||
Now using dwarf_tsearch() so tsearch is available on every platform.
|
||||
November 17, 2012
|
||||
Added new checking options.
|
||||
To get good relocation-handling dwarfdump now expects to read
|
||||
headers from libdwarf with the relocation numbers. That means
|
||||
building dwarfdump separate from the libdwarf source is no
|
||||
longer as useful as it was. It is best to build libdwarf
|
||||
and dwarfdump together for decent handling of relocatable
|
||||
objects.
|
||||
December 13, 2011
|
||||
Now prints missing line table column number as 0 (now
|
||||
matching the DWARF spec), the previous
|
||||
practice of printing -1 was always wrong.
|
||||
And prints the DWARF3/4 new line table fields (when present).
|
||||
October 29, 2011
|
||||
Added support for printing .debug_types (type unit) data.
|
||||
October 26, 2011
|
||||
Added new features to Makefile.in and documented in README
|
||||
how to build dwarfdump with headers or libraries in
|
||||
non-standard places.
|
||||
October 23, 2011
|
||||
By default the various places with string option values
|
||||
and file paths all use URI transformation on input and
|
||||
if the transformation does anything at all dwarfdump reports
|
||||
the input and transformed strings. This makes it easy
|
||||
to deal with strings and expressions and file paths
|
||||
that are difficult to express in a shell (or that getopt
|
||||
mangles). Options -q and -U give you control over this process.
|
||||
October 07, 2011
|
||||
The -x abi=mips frame register abi in dwarfdump.conf is now
|
||||
usable with modern MIPS objects as well as old IRIX objects.
|
||||
There are other mips-* frame register setups described
|
||||
in dwarfdump.conf for anyone testing that nothing new has
|
||||
been added that conflicts with old IRIX/MIPS frame generation.
|
||||
June 04, 2011
|
||||
Error checking is now distinct from section printing, making
|
||||
error checking (the -k options) much easier to work with on
|
||||
large objects.
|
||||
So compiler-created errors can be found, the error reporting
|
||||
now prints context information.
|
||||
March 29, 2011
|
||||
Added many new correctness tests. Changed the format of
|
||||
various items (line data prints in a more compact form, numbers
|
||||
are more uniformly hexadecimal fixed length where that makes sense).
|
||||
All the source files are uniformly indented to a multiple of 4
|
||||
characters and all intent-tabs in the source have been removed.
|
||||
Major logic changes involved changing error-reporting to be
|
||||
more detailed and adding new tests for incorrect DWARF.
|
||||
Now reports error summary by the compiler name, not just overall.
|
||||
January 26, 2010
|
||||
Changed the default frame-data register names from MIPS to
|
||||
a generic set of registers.
|
||||
Try '-x abi=mips' to get the traditional old MIPS register
|
||||
naming.
|
||||
June 22, 2009
|
||||
Added the -S option to dwarfdump.
|
||||
June 10, 2009
|
||||
Moved the gennames.c code to libdwarf.
|
||||
May 4, 2009
|
||||
Replaced awk source-generation of certain functions
|
||||
with new gennames.c code.
|
||||
Now we can print an object with an address_size that
|
||||
varies by compilation unit.
|
||||
April 4, 2009
|
||||
Corrected aspects of the frame-printing by ensuring we pass
|
||||
all the information libdwarf needs for fully consistent behavior.
|
||||
Three newly defined libdwarf calls calls made to ensure
|
||||
that better behavior (specifically having dwarfdump consistently
|
||||
recognize when registers are the cfa, undefined-value or same-value
|
||||
pseudo registers). Updated dwarfdump.conf to set these same
|
||||
things consistently.
|
||||
Mar 22, 2009
|
||||
The -f and -F flags no longer also imply -i (it just
|
||||
did not make sense to tie them (cannot recall why
|
||||
it might have been tied before).
|
||||
Mar 20, 2009
|
||||
Moved print_* functions from print_sections.c to individual
|
||||
source files. Hopefully making the code a bit easier
|
||||
to read.
|
||||
Feb 16, 2009
|
||||
Added the -C option. It is a sort of 'pedantic' option
|
||||
as it turns on warnings about certain commonly used
|
||||
non-standard tag->tag and tag->attr relationships.
|
||||
Added the tag_attr_ext.list tag_tree_ext.list files which
|
||||
define the 'common use' extensions.
|
||||
Feb 14, 2009
|
||||
Added configure option --enable-nonstandardprintf
|
||||
which makes it easy to get printf of Dwarf_Unsigned (etc)
|
||||
types correct even for non-standard compilers.
|
||||
December 30, 2008
|
||||
Now we print the .debug_ranges section (with -N)
|
||||
and the data for DW_AT_ranges (with -i).
|
||||
December 8, 2008
|
||||
The -M option now causes printing of FORM details.
|
||||
And -v adds details about abbreviation 'indexes' into
|
||||
an abbreviation table (.debug_abbrev)
|
||||
providing more detail for folks debugging or
|
||||
improving their understanding of DWARF data.
|
||||
April 9, 2008
|
||||
Added -H <num> to limit the number of compilation-units/FDEs
|
||||
dwarfdump prints in one run. Added -n to eliminate function-name
|
||||
printing in .debug_frame output (with a large-enough debug_info
|
||||
section function-name printing is too slow). The function name
|
||||
printing will be fixed in another release.
|
||||
December 8, 2007
|
||||
Had to add an ugly configure conditional as libelf has
|
||||
unconditional use of off64_t in recent libelf.h
|
||||
July 3, 2007
|
||||
Now with -v dwarf expression blocks in frame operations
|
||||
are printed expanded out.
|
||||
July 2, 2007
|
||||
Added a new abi -x abi=general usable for any cpu with
|
||||
up to 1000 registers.
|
||||
May 7, 2007
|
||||
Sun Microsystems contributes new dwarf.h extensions and a new -G option
|
||||
to dwarfdump -i (so one can see the 'global' offset to DIEs).
|
||||
Thanks to Chris Quenelle of Sun.
|
||||
April 17, 2006
|
||||
New -x name=<conf file> -x abi=<abiname> and configuration file
|
||||
enable sensible printing of a wide range of .debug_frame eh_frame
|
||||
correctly without recompiling dwarfdump or touching libdwarf.h or
|
||||
dwarf.h.
|
||||
March 29, 2005
|
||||
Now handles DWARF3. For non-MIPS objects, the list of register
|
||||
names in print_sections.c is not appropriate, #define
|
||||
DWARFDUMP_TURN_OFF_MIPS_REG_NAMES to turn off the MIPS names.
|
||||
December 1, 2005
|
||||
Added new DWARF3 TAGs and ATtributes to the -k lists,
|
||||
clarified the -k reporting, and made the build more robust
|
||||
in the face of errors in the *.list relationship-spec-files.
|
||||
|
||||
August 1, 2005
|
||||
Now print_die.c deals with long loclists without a coredump.
|
||||
Added esb.h esb.c (and testesb.c for testing) to encapsulate
|
||||
getting space for possibly-long strings.
|
||||
Now print_die.c uses snprintf() not sprintf (hopefully this
|
||||
will not inconvenience anyone, snprintf() has been available
|
||||
on most systems for years now).
|
||||
Altered print of location lists a little bit - for better appearance.
|
||||
|
||||
July 15, 2005
|
||||
Now completely frees all allocated memory. Various
|
||||
routines were not calling dealloc() code and
|
||||
new libdwarf dealloc routines are now used where those
|
||||
are needed.
|
||||
|
||||
Now prints DWARF3 .debug_pubtypes section (with -a or -y).
|
||||
The .debug_pubtypes section and SGI-specific .debug_typenames
|
||||
are equivalent so they are treated alike.
|
||||
|
||||
Mar 21, 2005
|
||||
The -f flag now prints only .debug_frame data. The .eh_frame section
|
||||
(GNU exceptions data) now prints with -F (not -a).
|
||||
Printing gcc 3.3 or 3.4 .eh_frame with zR augmentation
|
||||
does not work at this time, so do not use -F
|
||||
to print such an object.
|
||||
The line section print now prints a CU-DIE offset for each such DIEs
|
||||
line information. This makes it much easier to correctly associate
|
||||
-l (or -v -l) output with -v -v -l when debugging a faulty
|
||||
linetable in an executable.
|
||||
With -v -v -l (two -v) the output of line info continues to be a
|
||||
completely different format than zero or one -v, the two-v
|
||||
form showing the detailed line table opcodes.
|
||||
With g++ 3.3.3 one sees bad line addresses at times as the
|
||||
DW_LNE_set_address address for header files do not always
|
||||
get their relocations applied. I am told this is fixed in 3.4.x.
|
||||
|
||||
|
||||
Mar 18, 2005
|
||||
In correcting printing of macro information the format
|
||||
of the macro (-m) output has changed substantially.
|
||||
Much more complete now. Still could use enhancement.
|
||||
|
||||
Oct 28, 2004
|
||||
Updated contact address in copyright: SGI moved 1/4 mile
|
||||
to a new address: 1500 Crittenden Lane.
|
||||
|
||||
Oct 02, 2003
|
||||
Now fully supports .debug_loc section.
|
||||
|
||||
June 14, 2001
|
||||
Now calling a new function dwarf_get_arange_cu_header_offset()
|
||||
in libdwarf and printing the returned cu header offset for
|
||||
aranges entries. Making it easier to track down internal
|
||||
errors in the dwarf2 data. Also added small other
|
||||
consistency checks, printing a message and exit()ing on
|
||||
error.
|
||||
|
||||
April 14, 2000
|
||||
The libdwarf copyright has changed to
|
||||
version 2.1 of the GNU Lesser General Public License.
|
||||
Anyone holding a version of libdwarf that was published
|
||||
before this new copyright
|
||||
is allowed to use
|
||||
the copyright published in that earlier libdwarf source
|
||||
on the earlier source
|
||||
or to use
|
||||
this new copyright on the earlier source,
|
||||
at their option.
|
||||
|
||||
July 21, 1999
|
||||
Added gnu extensions to the frame information printer
|
||||
and handling for egcs eh_frame printing.
|
||||
libdwarf changes mean this now can print little-endian
|
||||
object dwarf on a big-endian system and vice-versa.
|
||||
|
||||
December, 1998
|
||||
added dwarfdump to the dwarf public source distribution.
|
||||
|
||||
June, 1994
|
||||
libdwarf consumer interface changed completely so updated to match.
|
||||
|
||||
May, 1993
|
||||
Initial version of dwarfdump for dwarf version 2
|
||||
written at sgi.
|
82
dwarf-compilation.base/contrib/libdwarf/dwarfdump/README
Normal file
82
dwarf-compilation.base/contrib/libdwarf/dwarfdump/README
Normal file
|
@ -0,0 +1,82 @@
|
|||
I would prefer you try using ../dwarfdump2, not this source.
|
||||
If you must use this for some reason, could you let me know why?
|
||||
Thanks.
|
||||
|
||||
To build dwarfdump, first build libdwarf in the neighboring
|
||||
directory then type
|
||||
./configure
|
||||
make
|
||||
|
||||
Installation is a bit primitive.
|
||||
sudo make install
|
||||
may or may not work.
|
||||
Some or all of the following might be required on Unix or Linux or MacOS:
|
||||
sudo mkdir -p /usr/local/share/man/man1/
|
||||
sudo mkdir -p /usr/local/lib
|
||||
sudo mkdir -p /usr/local/bin
|
||||
Then retry the 'sudo make install' and (if necessary) try
|
||||
sudo chmod a+x /usr/local/bin/dwarfdump
|
||||
sudo chmod a+r /usr/local/share/man/man1/dwarfdump.1
|
||||
sudo chmod a+r /usr/local/lib/dwarfdump.conf
|
||||
You don't really need the dwarfdump.1 man page,
|
||||
but you might as well have it. If the man page is not visible
|
||||
with 'man dwarfdump' try 'man manpath' for hints.
|
||||
|
||||
If you don't need others using dwarfdump on your computer,
|
||||
just
|
||||
cp dwarfdump $HOME/bin/dwarfdump
|
||||
(by convention many people put personal executables in $HOME/bin
|
||||
and fix up $PATH to refer there) which suffices as 'installation'.
|
||||
Also
|
||||
cp dwarfdump.conf $HOME
|
||||
|
||||
To use dwarf or libdwarf, you may want to install dwarf.h
|
||||
and libdwarf.h somewhere convenient.
|
||||
You can just copy those two headers to /usr/local/include by hand
|
||||
(or anywhere, really, that you have permission to copy to)
|
||||
(you may need to use -I/usr/local/include on compile lines
|
||||
to reference them there, but see below on configure and make).
|
||||
|
||||
Notice that dwarf_names.c and dwarf_names.h are supplied by
|
||||
the release though the Makefile can and may rebuild them.
|
||||
Some users find it difficult to get a reliable awk(1) program,
|
||||
so for them these prebuilt versions may be useful.
|
||||
|
||||
If your headers or libelf/libdwarf are not in the expected places,
|
||||
use the make command line to add flags and include directories.
|
||||
For example
|
||||
./configure
|
||||
PREINCS="-I /usr/local/include" POSTINCS="-I /home/x/include" make
|
||||
PREINCS content is inserted before CFLAGS as make(1) is running.
|
||||
POSTINCS content is added after the CFLAGS value.
|
||||
|
||||
To set LDFLAGS,
|
||||
do so at configure time, for example:
|
||||
./configure LDFLAGS="-L /some/dir"
|
||||
And/or use PRELIBS and/or POSTLIBS at 'make' time similar to the use
|
||||
of PREINCS and POSTINCS.
|
||||
|
||||
If the libdwarf directory
|
||||
has both libdwarf.so and libdwarf.a, the libdwarf.so
|
||||
will be picked up and
|
||||
"./tag_tree_build: error while loading shared libraries:
|
||||
libdwarf.so: cannot open shared object file:
|
||||
No such file or directory"
|
||||
will probably result.
|
||||
Either: remove libdwarf.so and rebuild or set
|
||||
the environment variable LD_LIBRARY_PATH to the directory
|
||||
containing the .so or use LDFLAGS to set rpath (see just below).
|
||||
It is perhaps simpler to ensure that the libdwarf directory
|
||||
only has an archive, not a shared-library.
|
||||
But sometimes one wants a shared library.
|
||||
In that case
|
||||
one can set ld's -rpath on the gcc command line like this:
|
||||
LDFLAGS="-Wl,-rpath=/some/path/libdir"
|
||||
so the shared library can be found at run time automatically.
|
||||
|
||||
The same problem may arise with libelf, and the same approach
|
||||
will solve the problem.
|
||||
|
||||
|
||||
|
||||
David Anderson. davea42 at earthlink dot net.
|
123
dwarf-compilation.base/contrib/libdwarf/dwarfdump/addrmap.c
Normal file
123
dwarf-compilation.base/contrib/libdwarf/dwarfdump/addrmap.c
Normal file
|
@ -0,0 +1,123 @@
|
|||
/*
|
||||
Copyright 2010-2012 David Anderson. All rights reserved.
|
||||
Portions Copyright 2012 SN Systems Ltd. All rights reserved.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of version 2 of the GNU General Public License as
|
||||
published by the Free Software Foundation.
|
||||
|
||||
This program is distributed in the hope that it would be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
Further, this software is distributed without any warranty that it is
|
||||
free of the rightful claim of any third person regarding infringement
|
||||
or the like. Any license provided herein, whether implied or
|
||||
otherwise, applies only to this software file. Patent licenses, if
|
||||
any, provided herein do not apply to combinations of this program with
|
||||
other software, or any other product whatsoever.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write the Free Software Foundation, Inc., 51
|
||||
Franklin Street - Fifth Floor, Boston MA 02110-1301, USA.
|
||||
|
||||
*/
|
||||
|
||||
/* If memory full we do not exit, we just keep going as if
|
||||
all were well. */
|
||||
|
||||
#include "globals.h"
|
||||
#include <stdio.h>
|
||||
#include "addrmap.h"
|
||||
#include "dwarf_tsearch.h"
|
||||
|
||||
|
||||
static struct Addr_Map_Entry *
|
||||
addr_map_create_entry(Dwarf_Unsigned k,char *name)
|
||||
{
|
||||
struct Addr_Map_Entry *mp =
|
||||
(struct Addr_Map_Entry *)malloc(sizeof(struct Addr_Map_Entry));
|
||||
if (!mp) {
|
||||
return 0;
|
||||
}
|
||||
mp->mp_key = k;
|
||||
if (name) {
|
||||
mp->mp_name = (char *)strdup(name);
|
||||
} else {
|
||||
mp->mp_name = 0;
|
||||
}
|
||||
return mp;
|
||||
}
|
||||
static void
|
||||
addr_map_free_func(void *mx)
|
||||
{
|
||||
struct Addr_Map_Entry *m = mx;
|
||||
if (!m) {
|
||||
return;
|
||||
}
|
||||
free(m->mp_name);
|
||||
m->mp_name = 0;
|
||||
free(m);
|
||||
return;
|
||||
}
|
||||
|
||||
static int
|
||||
addr_map_compare_func(const void *l, const void *r)
|
||||
{
|
||||
const struct Addr_Map_Entry *ml = l;
|
||||
const struct Addr_Map_Entry *mr = r;
|
||||
if (ml->mp_key < mr->mp_key) {
|
||||
return -1;
|
||||
}
|
||||
if (ml->mp_key > mr->mp_key) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
struct Addr_Map_Entry *
|
||||
addr_map_insert( Dwarf_Unsigned addr,char *name,void **tree1)
|
||||
{
|
||||
void *retval = 0;
|
||||
struct Addr_Map_Entry *re = 0;
|
||||
struct Addr_Map_Entry *e;
|
||||
e = addr_map_create_entry(addr,name);
|
||||
/* tsearch records e's contents unless e
|
||||
is already present . We must not free it till
|
||||
destroy time if it got added to tree1. */
|
||||
retval = dwarf_tsearch(e,tree1, addr_map_compare_func);
|
||||
if (retval) {
|
||||
re = *(struct Addr_Map_Entry **)retval;
|
||||
if (re != e) {
|
||||
/* We returned an existing record, e not needed. */
|
||||
addr_map_free_func(e);
|
||||
} else {
|
||||
/* Record e got added to tree1, do not free record e. */
|
||||
}
|
||||
}
|
||||
return re;
|
||||
}
|
||||
struct Addr_Map_Entry *
|
||||
addr_map_find(Dwarf_Unsigned addr,void **tree1)
|
||||
{
|
||||
void *retval = 0;
|
||||
struct Addr_Map_Entry *re = 0;
|
||||
struct Addr_Map_Entry *e = 0;
|
||||
|
||||
e = addr_map_create_entry(addr,NULL);
|
||||
retval = dwarf_tfind(e,tree1, addr_map_compare_func);
|
||||
if (retval) {
|
||||
re = *(struct Addr_Map_Entry **)retval;
|
||||
}
|
||||
/* The one we created here must be deleted, it is dead.
|
||||
We look at the returned one instead. */
|
||||
addr_map_free_func(e);
|
||||
return re;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
addr_map_destroy(void *map)
|
||||
{
|
||||
/* tdestroy is not part of Posix, it is a GNU libc function. */
|
||||
dwarf_tdestroy(map,addr_map_free_func);
|
||||
}
|
33
dwarf-compilation.base/contrib/libdwarf/dwarfdump/addrmap.h
Normal file
33
dwarf-compilation.base/contrib/libdwarf/dwarfdump/addrmap.h
Normal file
|
@ -0,0 +1,33 @@
|
|||
/*
|
||||
Copyright 2010 David Anderson. All rights reserved.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of version 2 of the GNU General Public License as
|
||||
published by the Free Software Foundation.
|
||||
|
||||
This program is distributed in the hope that it would be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
Further, this software is distributed without any warranty that it is
|
||||
free of the rightful claim of any third person regarding infringement
|
||||
or the like. Any license provided herein, whether implied or
|
||||
otherwise, applies only to this software file. Patent licenses, if
|
||||
any, provided herein do not apply to combinations of this program with
|
||||
other software, or any other product whatsoever.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write the Free Software Foundation, Inc., 51
|
||||
Franklin Street - Fifth Floor, Boston MA 02110-1301, USA.
|
||||
|
||||
*/
|
||||
|
||||
struct Addr_Map_Entry {
|
||||
Dwarf_Unsigned mp_key;
|
||||
char * mp_name;
|
||||
};
|
||||
|
||||
struct Addr_Map_Entry * addr_map_insert(Dwarf_Unsigned addr,
|
||||
char *name, void **map);
|
||||
struct Addr_Map_Entry * addr_map_find(Dwarf_Unsigned addr, void **map);
|
||||
void addr_map_destroy(void *map);
|
572
dwarf-compilation.base/contrib/libdwarf/dwarfdump/checkutil.c
Normal file
572
dwarf-compilation.base/contrib/libdwarf/dwarfdump/checkutil.c
Normal file
|
@ -0,0 +1,572 @@
|
|||
/*
|
||||
Copyright (C) 2011 SN Systems Ltd. All Rights Reserved.
|
||||
Portions Copyright (C) 2011-2012 David Anderson. All Rights Reserved.
|
||||
Portions Copyright 2012 SN Systems Ltd. All rights reserved.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of version 2 of the GNU General Public License as
|
||||
published by the Free Software Foundation.
|
||||
|
||||
This program is distributed in the hope that it would be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
Further, this software is distributed without any warranty that it is
|
||||
free of the rightful claim of any third person regarding infringement
|
||||
or the like. Any license provided herein, whether implied or
|
||||
otherwise, applies only to this software file. Patent licenses, if
|
||||
any, provided herein do not apply to combinations of this program with
|
||||
other software, or any other product whatsoever.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write the Free Software Foundation, Inc., 51
|
||||
Franklin Street - Fifth Floor, Boston MA 02110-1301, USA.
|
||||
|
||||
*/
|
||||
/*
|
||||
|
||||
These simple list-processing functions are in support
|
||||
of checking DWARF for compiler-errors of various sorts.
|
||||
|
||||
|
||||
*/
|
||||
|
||||
#include "globals.h"
|
||||
#include <assert.h>
|
||||
|
||||
/* Private function */
|
||||
static void DumpFullBucketGroup(Bucket_Group *pBucketGroup);
|
||||
static int FindDataIndexInBucket(Bucket_Group *pBucketGroup,
|
||||
Bucket_Data *pBucketData);
|
||||
static void PrintBucketData(Bucket_Group *pBucketGroup,
|
||||
Bucket_Data *pBucketData);
|
||||
static void ProcessBucketGroup(Bucket_Group *pBucketGroup,
|
||||
void (*pFunction)(Bucket_Group *pBucketGroup,Bucket_Data *pBucketData));
|
||||
|
||||
Bucket_Group *
|
||||
AllocateBucketGroup(int kind)
|
||||
{
|
||||
Bucket_Group *pBucketGroup = (Bucket_Group *)calloc(1,sizeof(Bucket_Group));
|
||||
pBucketGroup->kind = kind;
|
||||
return pBucketGroup;
|
||||
}
|
||||
|
||||
void
|
||||
ReleaseBucketGroup(Bucket_Group *pBucketGroup)
|
||||
{
|
||||
Bucket *pBucket = 0;
|
||||
Bucket *pNext = 0;
|
||||
|
||||
assert(pBucketGroup);
|
||||
for (pBucket = pBucketGroup->pHead; pBucket; /*pBucket = pBucket->pNext*/) {
|
||||
pNext = pBucket->pNext;
|
||||
free(pBucket);
|
||||
pBucket = pNext;
|
||||
}
|
||||
pBucketGroup->pHead = NULL;
|
||||
pBucketGroup->pTail = NULL;
|
||||
free(pBucketGroup);
|
||||
}
|
||||
|
||||
void
|
||||
ResetBucketGroup(Bucket_Group *pBucketGroup)
|
||||
{
|
||||
Bucket *pBucket = 0;
|
||||
|
||||
assert(pBucketGroup);
|
||||
for (pBucket = pBucketGroup->pHead; pBucket; pBucket = pBucket->pNext) {
|
||||
pBucket->nEntries = 0;
|
||||
}
|
||||
ResetSentinelBucketGroup(pBucketGroup);
|
||||
}
|
||||
|
||||
/* Reset sentinels in a Bucket Group. */
|
||||
void
|
||||
ResetSentinelBucketGroup(Bucket_Group *pBucketGroup)
|
||||
{
|
||||
/* Sanity checks */
|
||||
assert(pBucketGroup);
|
||||
pBucketGroup->pFirst = NULL;
|
||||
pBucketGroup->pLast = NULL;
|
||||
}
|
||||
|
||||
void PrintBucketGroup(Bucket_Group *pBucketGroup,Dwarf_Bool bFull)
|
||||
{
|
||||
if (pBucketGroup) {
|
||||
if (bFull) {
|
||||
DumpFullBucketGroup(pBucketGroup);
|
||||
} else {
|
||||
if (pBucketGroup->pFirst && pBucketGroup->pLast) {
|
||||
printf("\nBegin Traversing, First = 0x%08" DW_PR_DUx
|
||||
", Last = 0x%08" DW_PR_DUx "\n",
|
||||
pBucketGroup->pFirst->key,pBucketGroup->pLast->key);
|
||||
ProcessBucketGroup(pBucketGroup,PrintBucketData);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
PrintBucketData(Bucket_Group *pBucketGroup,Bucket_Data *pBucketData)
|
||||
{
|
||||
int nCount = 0;
|
||||
assert(pBucketGroup);
|
||||
assert(pBucketData);
|
||||
|
||||
nCount = FindDataIndexInBucket(pBucketGroup,pBucketData);
|
||||
printf("[%06d] Key = 0x%08" DW_PR_DUx ", Base = 0x%08" DW_PR_DUx
|
||||
", Low = 0x%08" DW_PR_DUx ", High = 0x%08" DW_PR_DUx
|
||||
", Flag = %d, Name = '%s'\n",
|
||||
++nCount,
|
||||
pBucketData->key,
|
||||
pBucketData->base,
|
||||
pBucketData->low,
|
||||
pBucketData->high,
|
||||
pBucketData->bFlag,
|
||||
pBucketData->name);
|
||||
}
|
||||
|
||||
static void
|
||||
DumpFullBucketGroup(Bucket_Group *pBucketGroup)
|
||||
{
|
||||
int nBucketNo = 1;
|
||||
int nIndex = 0;
|
||||
int nCount = 0;
|
||||
Bucket *pBucket = 0;
|
||||
Bucket_Data *pBucketData = 0;
|
||||
|
||||
assert(pBucketGroup);
|
||||
printf("\nBucket Group at 0x%lx [lower 0x%lx upper 0x%lx]\n",
|
||||
(unsigned long)pBucketGroup,
|
||||
(unsigned long)pBucketGroup->lower,
|
||||
(unsigned long)pBucketGroup->upper);
|
||||
for (pBucket = pBucketGroup->pHead; pBucket && pBucket->nEntries;
|
||||
pBucket = pBucket->pNext) {
|
||||
|
||||
printf("LowPC & HighPC records for bucket %d, at 0x%08lx\n",
|
||||
nBucketNo++,(unsigned long)pBucket);
|
||||
for (nIndex = 0; nIndex < pBucket->nEntries; ++nIndex) {
|
||||
pBucketData = &pBucket->Entries[nIndex];
|
||||
printf("[%06d] Key = 0x%08" DW_PR_DUx ", Base = 0x%08" DW_PR_DUx
|
||||
", Low = 0x%08" DW_PR_DUx ", High = 0x%08" DW_PR_DUx
|
||||
", Flag = %d, Name = '%s'\n",
|
||||
++nCount,
|
||||
pBucketData->key,
|
||||
pBucketData->base,
|
||||
pBucketData->low,
|
||||
pBucketData->high,
|
||||
pBucketData->bFlag,
|
||||
pBucketData->name);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Insert entry into Bucket Group.
|
||||
We make no check for duplicate information. */
|
||||
void
|
||||
AddEntryIntoBucketGroup(Bucket_Group *pBucketGroup,
|
||||
Dwarf_Addr key,Dwarf_Addr base,
|
||||
Dwarf_Addr low,Dwarf_Addr high,
|
||||
const char *name,
|
||||
Dwarf_Bool bFlag)
|
||||
{
|
||||
Bucket *pBucket = 0;
|
||||
Bucket_Data data;
|
||||
|
||||
data.bFlag = bFlag;
|
||||
data.name = name;
|
||||
data.key = key;
|
||||
data.base = base;
|
||||
data.low = low;
|
||||
data.high = high;
|
||||
|
||||
assert(pBucketGroup);
|
||||
if (!pBucketGroup->pHead) {
|
||||
/* Allocate first bucket */
|
||||
pBucket = (Bucket *)calloc(1,sizeof(Bucket));
|
||||
pBucketGroup->pHead = pBucket;
|
||||
pBucketGroup->pTail = pBucket;
|
||||
pBucket->nEntries = 1;
|
||||
pBucket->Entries[0] = data;
|
||||
return;
|
||||
}
|
||||
|
||||
pBucket = pBucketGroup->pTail;
|
||||
|
||||
/* Check if we have a previous allocated set of
|
||||
buckets (have been cleared */
|
||||
if (pBucket->nEntries) {
|
||||
if (pBucket->nEntries < BUCKET_SIZE) {
|
||||
pBucket->Entries[pBucket->nEntries++] = data;
|
||||
} else {
|
||||
/* Allocate new bucket */
|
||||
pBucket = (Bucket *)calloc(1,sizeof(Bucket));
|
||||
pBucketGroup->pTail->pNext = pBucket;
|
||||
pBucketGroup->pTail = pBucket;
|
||||
pBucket->nEntries = 1;
|
||||
pBucket->Entries[0] = data;
|
||||
}
|
||||
} else {
|
||||
/* We have an allocated bucket with zero entries; search for the
|
||||
first available bucket to be used as the current
|
||||
insertion point */
|
||||
for (pBucket = pBucketGroup->pHead; pBucket;
|
||||
pBucket = pBucket->pNext) {
|
||||
|
||||
if (pBucket->nEntries < BUCKET_SIZE) {
|
||||
pBucket->Entries[pBucket->nEntries++] = data;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* For Groups where entries are individually deleted, this does
|
||||
that work. */
|
||||
Dwarf_Bool
|
||||
DeleteKeyInBucketGroup(Bucket_Group *pBucketGroup,Dwarf_Addr key)
|
||||
{
|
||||
int nIndex = 0;
|
||||
Bucket *pBucket = 0;
|
||||
Bucket_Data *pBucketData = 0;
|
||||
|
||||
/* Sanity checks */
|
||||
assert(pBucketGroup);
|
||||
|
||||
/* For now do a linear search */
|
||||
for (pBucket = pBucketGroup->pHead; pBucket && pBucket->nEntries;
|
||||
pBucket = pBucket->pNext) {
|
||||
|
||||
for (nIndex = 0; nIndex < pBucket->nEntries; ++nIndex) {
|
||||
pBucketData = &pBucket->Entries[nIndex];
|
||||
if (pBucketData->key == key) {
|
||||
Bucket_Data data = {FALSE,NULL,0,0,0,0};
|
||||
int nStart;
|
||||
for (nStart = nIndex + 1; nStart < pBucket->nEntries;
|
||||
++nStart) {
|
||||
|
||||
pBucket->Entries[nIndex] = pBucket->Entries[nStart];
|
||||
++nIndex;
|
||||
}
|
||||
pBucket->Entries[nIndex] = data;
|
||||
--pBucket->nEntries;
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Search to see if the address is in the range between
|
||||
low and high addresses in some Bucked Data record.
|
||||
This matches == if high is exact match (which usually means
|
||||
one-past-true-high). */
|
||||
Dwarf_Bool
|
||||
FindAddressInBucketGroup(Bucket_Group *pBucketGroup,Dwarf_Addr address)
|
||||
{
|
||||
int nIndex = 0;
|
||||
Bucket *pBucket = 0;
|
||||
Bucket_Data *pBucketData = 0;
|
||||
|
||||
assert(pBucketGroup);
|
||||
/* For now do a linear search */
|
||||
for (pBucket = pBucketGroup->pHead; pBucket && pBucket->nEntries;
|
||||
pBucket = pBucket->pNext) {
|
||||
|
||||
for (nIndex = 0; nIndex < pBucket->nEntries; ++nIndex) {
|
||||
pBucketData = &pBucket->Entries[nIndex];
|
||||
if (address >= pBucketData->low &&
|
||||
address <= pBucketData->high) {
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Search an entry (Bucket Data) in the Bucket Set */
|
||||
Bucket_Data *FindDataInBucketGroup(Bucket_Group *pBucketGroup,Dwarf_Addr key)
|
||||
{
|
||||
int mid = 0;
|
||||
int low = 0;
|
||||
int high = 0;
|
||||
Bucket *pBucket = 0;
|
||||
Bucket_Data *pBucketData = 0;
|
||||
|
||||
assert(pBucketGroup);
|
||||
|
||||
for (pBucket = pBucketGroup->pHead; pBucket; pBucket = pBucket->pNext) {
|
||||
/* Get lower and upper references */
|
||||
if (pBucket->nEntries) {
|
||||
low = 0;
|
||||
high = pBucket->nEntries;
|
||||
while (low < high) {
|
||||
mid = low + (high - low) / 2;
|
||||
if (pBucket->Entries[mid].key < key) {
|
||||
low = mid + 1;
|
||||
} else {
|
||||
high = mid;
|
||||
}
|
||||
}
|
||||
if ((low < pBucket->nEntries) &&
|
||||
(pBucket->Entries[low].key == key)) {
|
||||
|
||||
pBucketData = &pBucket->Entries[low];
|
||||
/* Update sentinels to allow traversing the table */
|
||||
if (!pBucketGroup->pFirst) {
|
||||
pBucketGroup->pFirst = pBucketData;
|
||||
}
|
||||
pBucketGroup->pLast = pBucketData;
|
||||
return pBucketData;
|
||||
}
|
||||
}
|
||||
}
|
||||
return (Bucket_Data *)NULL;
|
||||
}
|
||||
|
||||
/* Find the Bucket that contains a given Bucket Data
|
||||
and return its local index. Else return -1. */
|
||||
static int
|
||||
FindDataIndexInBucket(Bucket_Group *pBucketGroup,Bucket_Data *pBucketData)
|
||||
{
|
||||
Bucket *pBucket = 0;
|
||||
Bucket_Data *pLower = 0;
|
||||
Bucket_Data *pUpper = 0;
|
||||
|
||||
/* Sanity checks */
|
||||
assert(pBucketGroup);
|
||||
assert(pBucketData);
|
||||
|
||||
/* Use sentinels if any. */
|
||||
if (pBucketGroup->pFirst && pBucketGroup->pLast &&
|
||||
pBucketData >= pBucketGroup->pFirst &&
|
||||
pBucketData <= pBucketGroup->pLast) {
|
||||
|
||||
/* Find bucket that contains the first sentinel */
|
||||
for (pBucket = pBucketGroup->pHead; pBucket && pBucket->nEntries;
|
||||
pBucket = pBucket->pNext) {
|
||||
|
||||
pLower = &pBucket->Entries[0];
|
||||
pUpper = &pBucket->Entries[pBucket->nEntries - 1];
|
||||
|
||||
/* Check if the first sentinel is in this bucket. */
|
||||
if (pBucketGroup->pFirst >= pLower &&
|
||||
pBucketGroup->pFirst <= pUpper) {
|
||||
/* We have found the bucket, return the index. */
|
||||
return pBucketData - pBucketGroup->pFirst;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
/* Find bucket that contains the entry */
|
||||
for (pBucket = pBucketGroup->pHead; pBucket && pBucket->nEntries;
|
||||
pBucket = pBucket->pNext) {
|
||||
|
||||
pLower = &pBucket->Entries[0];
|
||||
pUpper = &pBucket->Entries[pBucket->nEntries - 1];
|
||||
|
||||
/* Check if the first sentinel is in this bucket */
|
||||
if (pBucketData >= pLower && pBucketData <= pUpper) {
|
||||
/* We have found the bucket, return the index */
|
||||
return pBucketData - pLower;
|
||||
}
|
||||
}
|
||||
}
|
||||
/* Invalid data; just return index indicating not-found */
|
||||
return -1;
|
||||
}
|
||||
|
||||
/* Search an entry (Bucket Data) in the Bucket Group.
|
||||
The key is an offset, a DIE offset
|
||||
within Visited info. */
|
||||
Bucket_Data *FindKeyInBucketGroup(Bucket_Group *pBucketGroup,Dwarf_Addr key)
|
||||
{
|
||||
int nIndex = 0;
|
||||
Bucket *pBucket = 0;
|
||||
Bucket_Data *pBucketData = 0;
|
||||
|
||||
/* Sanity checks */
|
||||
assert(pBucketGroup);
|
||||
|
||||
/* For now do a linear search */
|
||||
for (pBucket = pBucketGroup->pHead; pBucket && pBucket->nEntries;
|
||||
pBucket = pBucket->pNext) {
|
||||
for (nIndex = 0; nIndex < pBucket->nEntries; ++nIndex) {
|
||||
pBucketData = &pBucket->Entries[nIndex];
|
||||
if (pBucketData->key == key) {
|
||||
return pBucketData;
|
||||
}
|
||||
}
|
||||
}
|
||||
return (Bucket_Data *)NULL;
|
||||
}
|
||||
|
||||
/* Search an entry (Bucket Data) in the Bucket Set by name.
|
||||
Used to find link-once section names. */
|
||||
Bucket_Data *
|
||||
FindNameInBucketGroup(Bucket_Group *pBucketGroup,char *name)
|
||||
{
|
||||
int nIndex = 0;
|
||||
Bucket *pBucket = 0;
|
||||
Bucket_Data *pBucketData = 0;
|
||||
|
||||
assert(pBucketGroup);
|
||||
/* For now do a linear search. */
|
||||
for (pBucket = pBucketGroup->pHead; pBucket && pBucket->nEntries;
|
||||
pBucket = pBucket->pNext) {
|
||||
for (nIndex = 0; nIndex < pBucket->nEntries; ++nIndex) {
|
||||
pBucketData = &pBucket->Entries[nIndex];
|
||||
if (!strcmp(pBucketData->name,name)) {
|
||||
return pBucketData;
|
||||
}
|
||||
}
|
||||
}
|
||||
return (Bucket_Data *)NULL;
|
||||
}
|
||||
|
||||
/* Check if an address valid or not. That is,
|
||||
check if it is in the lower -> upper range of a bucket.
|
||||
It checks <= and >= so the lower end
|
||||
and one-past on the upper end matches.
|
||||
*/
|
||||
Dwarf_Bool
|
||||
IsValidInBucketGroup(Bucket_Group *pBucketGroup,Dwarf_Addr address)
|
||||
{
|
||||
Bucket *pBucket = 0;
|
||||
Bucket_Data *pBucketData = 0;
|
||||
int nIndex = 0;
|
||||
|
||||
assert(pBucketGroup);
|
||||
/* Check the address is within the allowed limits */
|
||||
if (address >= pBucketGroup->lower &&
|
||||
address <= pBucketGroup->upper) {
|
||||
for (pBucket = pBucketGroup->pHead;
|
||||
pBucket && pBucket->nEntries;
|
||||
pBucket = pBucket->pNext) {
|
||||
for (nIndex = 0; nIndex < pBucket->nEntries; ++nIndex) {
|
||||
pBucketData = &pBucket->Entries[nIndex];
|
||||
if (address >= pBucketData->low &&
|
||||
address <= pBucketData->high) {
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/* Reset limits for values in the Bucket Set */
|
||||
void
|
||||
ResetLimitsBucketSet(Bucket_Group *pBucketGroup)
|
||||
{
|
||||
assert(pBucketGroup);
|
||||
pBucketGroup->lower = 0;
|
||||
pBucketGroup->upper = 0;
|
||||
}
|
||||
|
||||
/* Limits are set only for ranges, so only in pRangesInfo. */
|
||||
void
|
||||
SetLimitsBucketGroup(Bucket_Group *pBucketGroup,
|
||||
Dwarf_Addr lower,Dwarf_Addr upper)
|
||||
{
|
||||
assert(pBucketGroup);
|
||||
if (lower < upper) {
|
||||
pBucketGroup->lower = lower;
|
||||
pBucketGroup->upper = upper;
|
||||
}
|
||||
}
|
||||
|
||||
/* Traverse Bucket Set and execute a supplied function */
|
||||
static void
|
||||
ProcessBucketGroup(Bucket_Group *pBucketGroup,
|
||||
void (*pFunction)(Bucket_Group *pBucketGroup,Bucket_Data *pBucketData))
|
||||
{
|
||||
int nIndex = 0;
|
||||
int nStart = 0;
|
||||
Bucket *pBucket = 0;
|
||||
Bucket_Data *pBucketData = 0;
|
||||
Bucket_Data *pLower = 0;
|
||||
Bucket_Data *pUpper = 0;
|
||||
Dwarf_Bool bFound = FALSE;
|
||||
|
||||
/* Sanity checks */
|
||||
assert(pBucketGroup);
|
||||
|
||||
/* No sentinels present; do nothing */
|
||||
if (!pBucketGroup->pFirst || !pBucketGroup->pLast) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* Find bucket that contains the first sentinel */
|
||||
for (pBucket = pBucketGroup->pHead; pBucket && pBucket->nEntries;
|
||||
pBucket = pBucket->pNext) {
|
||||
|
||||
pLower = &pBucket->Entries[0];
|
||||
pUpper = &pBucket->Entries[pBucket->nEntries - 1];
|
||||
|
||||
/* Check if the first sentinel is in this bucket */
|
||||
if (pBucketGroup->pFirst >= pLower && pBucketGroup->pFirst <= pUpper) {
|
||||
/* Low sentinel is in this bucket */
|
||||
bFound = TRUE;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* Invalid sentinel; do nothing */
|
||||
if (!bFound) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* Calculate index for first sentinel */
|
||||
nStart = pBucketGroup->pFirst - pLower;
|
||||
|
||||
/* Start traversing from found bucket */
|
||||
for (; pBucket && pBucket->nEntries; pBucket = pBucket->pNext) {
|
||||
for (nIndex = nStart; nIndex < pBucket->nEntries; ++nIndex) {
|
||||
pBucketData = &pBucket->Entries[nIndex];
|
||||
if (pBucketData > pBucketGroup->pLast) {
|
||||
return;
|
||||
}
|
||||
/* Call the user supplied function */
|
||||
if (pFunction) {
|
||||
pFunction(pBucketGroup,pBucketData);
|
||||
}
|
||||
}
|
||||
/* For next bucket start with first entry */
|
||||
nStart = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/* Check if a given (lopc,hipc) are valid for a linkonce.
|
||||
We pass in the linkonce (instead of
|
||||
referencing the global pLinkonceInfo) as that means
|
||||
searches for pLinkonceInfo find all the uses,
|
||||
making understanding of the code a tiny bit easier.
|
||||
The section name created is supposed to be the appropriate
|
||||
linkonce section name.
|
||||
*/
|
||||
Dwarf_Bool IsValidInLinkonce(Bucket_Group *pLo,
|
||||
const char *name,Dwarf_Addr lopc,Dwarf_Addr hipc)
|
||||
{
|
||||
#define SECTION_NAME_LEN 2048 /* Guessing a sensible length */
|
||||
static char section_name[SECTION_NAME_LEN];
|
||||
Bucket_Data *pBucketData = 0;
|
||||
/* Since text is quite uniformly just this name, no need to get it
|
||||
from elsewhere, though it will not work for non-elf. */
|
||||
const char *lo_text = ".text.";
|
||||
|
||||
/* Build the name that represents the linkonce section (.text).
|
||||
This is not defined in DWARF so not correct for all
|
||||
compilers. */
|
||||
snprintf(section_name,sizeof(section_name),"%s%s",lo_text,name);
|
||||
|
||||
pBucketData = FindNameInBucketGroup(pLo,section_name);
|
||||
if (pBucketData) {
|
||||
if (lopc >= pBucketData->low && lopc <= pBucketData->high) {
|
||||
if (hipc >= pBucketData->low && hipc <= pBucketData->high) {
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
|
@ -0,0 +1,98 @@
|
|||
/*
|
||||
Copyright (C) 2011 SN Systems Ltd. All Rights Reserved.
|
||||
Portions Copyright (C) 2011 David Anderson. All Rights Reserved.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of version 2 of the GNU General Public License as
|
||||
published by the Free Software Foundation.
|
||||
|
||||
This program is distributed in the hope that it would be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
Further, this software is distributed without any warranty that it is
|
||||
free of the rightful claim of any third person regarding infringement
|
||||
or the like. Any license provided herein, whether implied or
|
||||
otherwise, applies only to this software file. Patent licenses, if
|
||||
any, provided herein do not apply to combinations of this program with
|
||||
other software, or any other product whatsoever.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write the Free Software Foundation, Inc., 51
|
||||
Franklin Street - Fifth Floor, Boston MA 02110-1301, USA.
|
||||
|
||||
*/
|
||||
|
||||
#ifndef CHECKUTIL_H
|
||||
#define CHECKUTIL_H
|
||||
|
||||
/* Map information.
|
||||
Depending on the specific functions used various
|
||||
fields here are either used or ignored.
|
||||
|
||||
*/
|
||||
typedef struct {
|
||||
Dwarf_Bool bFlag; /* General flag */
|
||||
const char *name; /* Generic name */
|
||||
Dwarf_Addr key; /* Used for binary search, the key
|
||||
is either a pc address or a DIE offset
|
||||
depending on which bucket table is in use. */
|
||||
Dwarf_Addr base; /* Used for base address */
|
||||
Dwarf_Addr low; /* Used for Low PC */
|
||||
Dwarf_Addr high; /* Used for High PC */
|
||||
} Bucket_Data;
|
||||
|
||||
/* This groups Bucket_Data records into
|
||||
a 'bucket' so that a single malloc creates
|
||||
BUCKET_SIZE entries. The intent is to reduce
|
||||
overhead (as compared to having next/previous
|
||||
pointers in each Bucket_Data and mallocing
|
||||
each Bucket_Data individually.
|
||||
*/
|
||||
|
||||
#define BUCKET_SIZE 2040
|
||||
typedef struct bucket {
|
||||
int nEntries;
|
||||
Bucket_Data Entries[BUCKET_SIZE];
|
||||
struct bucket *pNext;
|
||||
} Bucket;
|
||||
|
||||
/* This Forms the head record of a list of Buckets.
|
||||
*/
|
||||
typedef struct {
|
||||
int kind; /* Kind of bucket */
|
||||
Dwarf_Addr lower; /* Lower value for data */
|
||||
Dwarf_Addr upper; /* Upper value for data */
|
||||
Bucket_Data *pFirst; /* First sentinel */
|
||||
Bucket_Data *pLast; /* Last sentinel */
|
||||
Bucket *pHead; /* First bucket in set */
|
||||
Bucket *pTail; /* Last bucket in set */
|
||||
} Bucket_Group;
|
||||
|
||||
Bucket_Group *AllocateBucketGroup(int kind);
|
||||
void ReleaseBucketGroup(Bucket_Group *pBucketGroup);
|
||||
void ResetBucketGroup(Bucket_Group *pBucketGroup);
|
||||
void ResetSentinelBucketGroup(Bucket_Group *pBucketGroup);
|
||||
|
||||
void PrintBucketGroup(Bucket_Group *pBucketGroup,Dwarf_Bool bFull);
|
||||
|
||||
void AddEntryIntoBucketGroup(Bucket_Group *pBucketGroup,
|
||||
Dwarf_Addr key,Dwarf_Addr base,Dwarf_Addr low,Dwarf_Addr high,
|
||||
const char *name, Dwarf_Bool bFlag);
|
||||
|
||||
Dwarf_Bool DeleteKeyInBucketGroup(Bucket_Group *pBucketGroup,Dwarf_Addr key);
|
||||
|
||||
Dwarf_Bool FindAddressInBucketGroup(Bucket_Group *pBucketGroup,Dwarf_Addr address);
|
||||
Bucket_Data *FindDataInBucketGroup(Bucket_Group *pBucketGroup,Dwarf_Addr key);
|
||||
Bucket_Data *FindKeyInBucketGroup(Bucket_Group *pBucketGroup,Dwarf_Addr key);
|
||||
Bucket_Data *FindNameInBucketGroup(Bucket_Group *pBucketGroup,char *name);
|
||||
|
||||
Dwarf_Bool IsValidInBucketGroup(Bucket_Group *pBucketGroup,Dwarf_Addr pc);
|
||||
|
||||
void ResetLimitsBucketSet(Bucket_Group *pBucketGroup);
|
||||
void SetLimitsBucketGroup(Bucket_Group *pBucketGroup,Dwarf_Addr lower,Dwarf_Addr upper);
|
||||
Dwarf_Bool IsValidInLinkonce(Bucket_Group *pLo,
|
||||
const char *name,Dwarf_Addr lopc,Dwarf_Addr hipc);
|
||||
|
||||
|
||||
#endif /* CHECKUTIL_H */
|
92
dwarf-compilation.base/contrib/libdwarf/dwarfdump/common.c
Normal file
92
dwarf-compilation.base/contrib/libdwarf/dwarfdump/common.c
Normal file
|
@ -0,0 +1,92 @@
|
|||
/*
|
||||
Copyright (C) 2008-2010 SN Systems. All Rights Reserved.
|
||||
Portions Copyright (C) 2008-2017 David Anderson. All Rights Reserved.
|
||||
Portions Copyright (C) 2011-2012 SN Systems Ltd. . All Rights Reserved.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of version 2 of the GNU General Public License as
|
||||
published by the Free Software Foundation.
|
||||
|
||||
This program is distributed in the hope that it would be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
Further, this software is distributed without any warranty that it is
|
||||
free of the rightful claim of any third person regarding infringement
|
||||
or the like. Any license provided herein, whether implied or
|
||||
otherwise, applies only to this software file. Patent licenses, if
|
||||
any, provided herein do not apply to combinations of this program with
|
||||
other software, or any other product whatsoever.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write the Free Software Foundation, Inc., 51
|
||||
Franklin Street - Fifth Floor, Boston MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
/* These do little except on Windows */
|
||||
|
||||
#include "common.h"
|
||||
#include "config.h"
|
||||
#include "globals.h"
|
||||
#include "warningcontrol.h"
|
||||
#include <stdio.h>
|
||||
/* Windows specific header files */
|
||||
#ifdef HAVE_STDAFX_H
|
||||
#include "stdafx.h"
|
||||
#endif /* HAVE_STDAFX_H */
|
||||
|
||||
#define DW_VERSION_DATE_STR " 2017-10-13 19:09:46-07:00 "
|
||||
#define RELEASE_DATE "20160307"
|
||||
|
||||
/* The Linux/Unix version does not want a version string to print
|
||||
unless -V is on the command line. */
|
||||
void
|
||||
print_version_details(UNUSEDARG const char * name,int alwaysprint)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
#ifdef _DEBUG
|
||||
char *acType = "Debug";
|
||||
#else
|
||||
char *acType = "Release";
|
||||
#endif /* _DEBUG */
|
||||
#ifdef _WIN64
|
||||
char *bits = "64";
|
||||
#else
|
||||
char *bits = "32";
|
||||
#endif /* _WIN64 */
|
||||
static char acVersion[64];
|
||||
snprintf(acVersion,sizeof(acVersion),
|
||||
"[%s %s %s Win%s (%s)]",__DATE__,__TIME__,acType,bits,RELEASE_DATE);
|
||||
printf("%s %s\n",sanitized(name),acVersion);
|
||||
#else /* !_WIN32 */
|
||||
if (alwaysprint) {
|
||||
printf("%s\n",DW_VERSION_DATE_STR);
|
||||
}
|
||||
#endif /* _WIN32 */
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
print_args(UNUSEDARG int argc, UNUSEDARG char *argv[])
|
||||
{
|
||||
#ifdef _WIN32
|
||||
int index = 1;
|
||||
printf("Arguments: ");
|
||||
for (index = 1; index < argc; ++index) {
|
||||
printf("%s ",sanitized(argv[index]));
|
||||
}
|
||||
printf("\n");
|
||||
#endif /* _WIN32 */
|
||||
}
|
||||
|
||||
void
|
||||
print_usage_message(const char *program_name_in, const char **text)
|
||||
{
|
||||
unsigned i = 0;
|
||||
#ifndef _WIN32
|
||||
fprintf(stderr,"Usage: %s <options> <object file>\n", program_name_in);
|
||||
#endif /* _WIN32 */
|
||||
for (i = 0; *text[i]; ++i) {
|
||||
fprintf(stderr,"%s\n", text[i]);
|
||||
}
|
||||
}
|
32
dwarf-compilation.base/contrib/libdwarf/dwarfdump/common.h
Normal file
32
dwarf-compilation.base/contrib/libdwarf/dwarfdump/common.h
Normal file
|
@ -0,0 +1,32 @@
|
|||
/*
|
||||
Copyright (C) 2009-2010 SN Systems. All Rights Reserved.
|
||||
Portions Copyright (C) 2009-2010 David Anderson. All Rights Reserved.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of version 2 of the GNU General Public License as
|
||||
published by the Free Software Foundation.
|
||||
|
||||
This program is distributed in the hope that it would be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
Further, this software is distributed without any warranty that it is
|
||||
free of the rightful claim of any third person regarding infringement
|
||||
or the like. Any license provided herein, whether implied or
|
||||
otherwise, applies only to this software file. Patent licenses, if
|
||||
any, provided herein do not apply to combinations of this program with
|
||||
other software, or any other product whatsoever.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write the Free Software Foundation, Inc., 51
|
||||
Franklin Street - Fifth Floor, Boston MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef COMMON_INCLUDED_H
|
||||
#define COMMON_INCLUDED_H
|
||||
|
||||
void print_args(int argc, char *argv[]);
|
||||
void print_version_details(const char *name, int alwaysprint);
|
||||
void print_usage_message(const char *program_name, const char **text);
|
||||
|
||||
#endif /* COMMON_INCLUDED_H */
|
103
dwarf-compilation.base/contrib/libdwarf/dwarfdump/config.h.in
Normal file
103
dwarf-compilation.base/contrib/libdwarf/dwarfdump/config.h.in
Normal file
|
@ -0,0 +1,103 @@
|
|||
/* config.h.in. Generated from configure.in by autoheader. */
|
||||
|
||||
/* Define to 1 if the elf64_getehdr function is in libelf.a. */
|
||||
#undef HAVE_ELF64_GETEHDR
|
||||
|
||||
/* Define to 1 if the Elf64_Rel structure has r_info field. */
|
||||
#undef HAVE_ELF64_R_INFO
|
||||
|
||||
/* Define to 1 if you have the <elf.h> header file. */
|
||||
#undef HAVE_ELF_H
|
||||
|
||||
/* Define to 1 if you have the <inttypes.h> header file. */
|
||||
#undef HAVE_INTTYPES_H
|
||||
|
||||
/* Define to 1 if you have the <libelf.h> header file. */
|
||||
#undef HAVE_LIBELF_H
|
||||
|
||||
/* Define to 1 if you have the <libelf/libelf.h> header file. */
|
||||
#undef HAVE_LIBELF_LIBELF_H
|
||||
|
||||
/* Define 1 if off64 is defined via libelf with GNU_SOURCE. */
|
||||
#undef HAVE_LIBELF_OFF64_OK
|
||||
|
||||
/* Define to header that first defines elf. */
|
||||
#undef HAVE_LOCATION_OF_LIBELFHEADER
|
||||
|
||||
/* Define to 1 if you have the <memory.h> header file. */
|
||||
#undef HAVE_MEMORY_H
|
||||
|
||||
/* Define 1 if need nonstandard printf format for 64bit */
|
||||
#undef HAVE_NONSTANDARD_PRINTF_64_FORMAT
|
||||
|
||||
/* Define 1 if plain libelf builds. */
|
||||
#undef HAVE_RAW_LIBELF_OK
|
||||
|
||||
/* Define 1 if regex seems to be defined */
|
||||
#undef HAVE_REGEX
|
||||
|
||||
/* Define to 1 if you have the <sgidefs.h> header file. */
|
||||
#undef HAVE_SGIDEFS_H
|
||||
|
||||
/* Define 1 if we have the Windows specific header stdafx.h */
|
||||
#undef HAVE_STDAFX_H
|
||||
|
||||
/* Define to 1 if you have the <stdint.h> header file. */
|
||||
#undef HAVE_STDINT_H
|
||||
|
||||
/* Define to 1 if you have the <stdlib.h> header file. */
|
||||
#undef HAVE_STDLIB_H
|
||||
|
||||
/* Define to 1 if you have the <strings.h> header file. */
|
||||
#undef HAVE_STRINGS_H
|
||||
|
||||
/* Define to 1 if you have the <string.h> header file. */
|
||||
#undef HAVE_STRING_H
|
||||
|
||||
/* Define to 1 if you have the <sys/stat.h> header file. */
|
||||
#undef HAVE_SYS_STAT_H
|
||||
|
||||
/* Define to 1 if you have the <sys/types.h> header file. */
|
||||
#undef HAVE_SYS_TYPES_H
|
||||
|
||||
/* Define to 1 if you have the <unistd.h> header file. */
|
||||
#undef HAVE_UNISTD_H
|
||||
|
||||
/* Define 1 if __attribute__ ((unused)) compiles ok. */
|
||||
#undef HAVE_UNUSED_ATTRIBUTE
|
||||
|
||||
/* Define 1 if zlib (decompression library) seems available. */
|
||||
#undef HAVE_ZLIB
|
||||
|
||||
/* See if __uint32_t is predefined in the compiler. */
|
||||
#undef HAVE___UINT32_T
|
||||
|
||||
/* Define 1 if sys/types.h defines __uint32_t. */
|
||||
#undef HAVE___UINT32_T_IN_SYS_TYPES_H
|
||||
|
||||
/* See if __uint64_t is predefined in the compiler. */
|
||||
#undef HAVE___UINT64_T
|
||||
|
||||
/* Define 1 if sys/types.h defines __uint64_t. */
|
||||
#undef HAVE___UINT64_T_IN_SYS_TYPES_H
|
||||
|
||||
/* Define to the address where bug reports for this package should be sent. */
|
||||
#undef PACKAGE_BUGREPORT
|
||||
|
||||
/* Define to the full name of this package. */
|
||||
#undef PACKAGE_NAME
|
||||
|
||||
/* Define to the full name and version of this package. */
|
||||
#undef PACKAGE_STRING
|
||||
|
||||
/* Define to the one symbol short name of this package. */
|
||||
#undef PACKAGE_TARNAME
|
||||
|
||||
/* Define to the home page for this package. */
|
||||
#undef PACKAGE_URL
|
||||
|
||||
/* Define to the version of this package. */
|
||||
#undef PACKAGE_VERSION
|
||||
|
||||
/* Define to 1 if you have the ANSI C header files. */
|
||||
#undef STDC_HEADERS
|
|
@ -0,0 +1,109 @@
|
|||
/* config.h.in. Generated from configure.in by autoheader. */
|
||||
|
||||
/* Define to 1 if the elf32_getehdr function is in libelf.a. */
|
||||
#cmakedefine HAVE_ELF32_GETEHDR 1
|
||||
|
||||
/* Define to 1 if the elf64_getehdr function is in libelf.a. */
|
||||
#cmakedefine HAVE_ELF64_GETEHDR 1
|
||||
|
||||
/* Define to 1 if the Elf64_Rel structure has r_info field. */
|
||||
#cmakedefine HAVE_ELF64_R_INFO 1
|
||||
|
||||
/* Define to 1 if you have the <elf.h> header file. */
|
||||
#cmakedefine HAVE_ELF_H 1
|
||||
|
||||
/* Define to 1 if you have the <inttypes.h> header file. */
|
||||
#cmakedefine HAVE_INTTYPES_H 1
|
||||
|
||||
/* Define to 1 if you have the <libelf.h> header file. */
|
||||
#cmakedefine HAVE_LIBELF_H 1
|
||||
|
||||
/* Define to 1 if you have the <libelf/libelf.h> header file. */
|
||||
#cmakedefine HAVE_LIBELF_LIBELF_H 1
|
||||
|
||||
/* Define 1 if off64 is defined via libelf with GNU_SOURCE. */
|
||||
#cmakedefine HAVE_LIBELF_OFF64_OK 1
|
||||
|
||||
/* Define to 1 if you have the <memory.h> header file. */
|
||||
#cmakedefine HAVE_MEMORY_H 1
|
||||
|
||||
/* Define 1 if need nonstandard printf format for 64bit */
|
||||
#cmakedefine HAVE_NONSTANDARD_PRINTF_64_FORMAT 1
|
||||
|
||||
/* Define 1 if plain libelf builds. */
|
||||
#cmakedefine HAVE_RAW_LIBELF_OK 1
|
||||
|
||||
/* Define 1 if regex seems to be defined */
|
||||
#cmakedefine HAVE_REGEX 1
|
||||
|
||||
/* Define to 1 if you have the <sgidefs.h> header file. */
|
||||
#cmakedefine HAVE_SGIDEFS_H 1
|
||||
|
||||
/* Define 1 if we have the Windows specific header stdafx.h */
|
||||
#cmakedefine HAVE_STDAFX_H 1
|
||||
|
||||
/* Define 1 if we have the Windows header Windows.h */
|
||||
#cmakedefine HAVE_WINDOWS_H 1
|
||||
|
||||
/* Define to 1 if you have the <stdint.h> header file. */
|
||||
#cmakedefine HAVE_STDINT_H 1
|
||||
|
||||
/* Define to 1 if you have the <stdlib.h> header file. */
|
||||
#cmakedefine HAVE_STDLIB_H 1
|
||||
|
||||
/* Define to 1 if you have the <strings.h> header file. */
|
||||
#cmakedefine HAVE_STRINGS_H 1
|
||||
|
||||
/* Define to 1 if you have the <string.h> header file. */
|
||||
#cmakedefine HAVE_STRING_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/stat.h> header file. */
|
||||
#cmakedefine HAVE_SYS_STAT_H 1
|
||||
|
||||
/* Define to 1 if you have the <sys/types.h> header file. */
|
||||
#cmakedefine HAVE_SYS_TYPES_H 1
|
||||
|
||||
/* Define to 1 if you have the <unistd.h> header file. */
|
||||
#cmakedefine HAVE_UNISTD_H 1
|
||||
|
||||
/* Define 1 if __attribute__ ((unused)) compiles ok. */
|
||||
#cmakedefine HAVE_UNUSED_ATTRIBUTE 1
|
||||
|
||||
/* Define 1 if zlib (decompression library) seems available. */
|
||||
#cmakedefine HAVE_ZLIB 1
|
||||
|
||||
/* See if __uint32_t is predefined in the compiler. */
|
||||
#cmakedefine HAVE___UINT32_T 1
|
||||
|
||||
/* Define 1 if sys/types.h defines __uint32_t. */
|
||||
#cmakedefine HAVE___UINT32_T_IN_SYS_TYPES_H 1
|
||||
|
||||
/* See if __uint64_t is predefined in the compiler. */
|
||||
#cmakedefine HAVE___UINT64_T 1
|
||||
|
||||
/* Define 1 if sys/types.h defines __uint64_t. */
|
||||
#cmakedefine HAVE___UINT64_T_IN_SYS_TYPES_H 1
|
||||
|
||||
/* Define to header that first defines elf. */
|
||||
#cmakedefine LOCATION_OF_LIBELFHEADER @LOCATION_OF_LIBELFHEADER@
|
||||
|
||||
/* Define to the address where bug reports for this package should be sent. */
|
||||
#cmakedefine PACKAGE_BUGREPORT @PACKAGE_BUGREPORT@
|
||||
|
||||
/* Define to the full name of this package. */
|
||||
#cmakedefine PACKAGE_NAME @PACKAGE_NAME@
|
||||
|
||||
/* Define to the full name and version of this package. */
|
||||
#cmakedefine PACKAGE_STRING @PACKAGE_STRING@
|
||||
|
||||
/* Define to the one symbol short name of this package. */
|
||||
#cmakedefine PACKAGE_TARNAME @PACKAGE_TARNAME@
|
||||
|
||||
/* Define to the home page for this package. */
|
||||
#cmakedefine PACKAGE_URL @PACKAGE_URL@
|
||||
|
||||
/* Define to the version of this package. */
|
||||
#cmakedefine PACKAGE_VERSION @PACKAGE_VERSION@
|
||||
|
||||
/* Define to 1 if you have the ANSI C header files. */
|
||||
#cmakedefine STDC_HEADERS 1
|
5271
dwarf-compilation.base/contrib/libdwarf/dwarfdump/configure
vendored
Executable file
5271
dwarf-compilation.base/contrib/libdwarf/dwarfdump/configure
vendored
Executable file
File diff suppressed because it is too large
Load diff
|
@ -0,0 +1,134 @@
|
|||
include(AutoconfHelper)
|
||||
|
||||
ac_init()
|
||||
ac_check_headers(elf.h libelf.h libelf/libelf.h sgidefs.h sys/types.h stdafx.h Windows.h)
|
||||
ac_check_lib(${LIBELF_LIBRARIES} elf elf32_getehdr)
|
||||
ac_check_lib(${LIBELF_LIBRARIES} elf elf64_getehdr)
|
||||
|
||||
# Find out where the elf header is.
|
||||
if(HAVE_ELF_H)
|
||||
set(HAVE_LOCATION_OF_LIBELFHEADER "<elf.h>")
|
||||
elseif(HAVE_LIBELF_H)
|
||||
set(HAVE_LOCATION_OF_LIBELFHEADER "<libelf.h>")
|
||||
elseif(HAVE_LIBELF_LIBELF_H)
|
||||
set(HAVE_LOCATION_OF_LIBELFHEADER "<libelf/libelf.h>")
|
||||
endif()
|
||||
|
||||
ac_try_compile("
|
||||
#include ${HAVE_LOCATION_OF_LIBELFHEADER}
|
||||
int main()
|
||||
{
|
||||
Elf64_Rel *p; int i; i = p->r_info;
|
||||
return 0;
|
||||
}"
|
||||
HAVE_ELF64_R_INFO)
|
||||
|
||||
ac_try_compile("
|
||||
int main()
|
||||
{
|
||||
__uint32_t p;
|
||||
p = 3;
|
||||
return 0;
|
||||
}"
|
||||
HAVE___UINT32_T)
|
||||
|
||||
ac_try_compile("
|
||||
int main()
|
||||
{
|
||||
__uint64_t p;
|
||||
p = 3;
|
||||
return 0;
|
||||
}"
|
||||
HAVE___UINT64_T)
|
||||
|
||||
ac_try_compile("
|
||||
#include <sys/types.h>
|
||||
int main()
|
||||
{
|
||||
__uint32_t p;
|
||||
p = 3;
|
||||
return 0;
|
||||
}"
|
||||
HAVE___UINT32_T_IN_SYS_TYPES_H)
|
||||
|
||||
ac_try_compile("
|
||||
#include <sys/types.h>
|
||||
int main()
|
||||
{
|
||||
__uint64_t p;
|
||||
p = 3;
|
||||
return 0;
|
||||
}"
|
||||
HAVE___UINT64_T_IN_SYS_TYPES_H)
|
||||
|
||||
ac_try_compile([=[
|
||||
#include <sys/types.h>
|
||||
#include <regex.h>
|
||||
int main()
|
||||
{
|
||||
int i;
|
||||
regex_t r;
|
||||
int cflags = REG_EXTENDED;
|
||||
const char *s = "abc";
|
||||
i = regcomp(&r,s,cflags);
|
||||
regfree(&r);
|
||||
return 0;
|
||||
}]=]
|
||||
HAVE_REGEX)
|
||||
|
||||
ac_try_compile("
|
||||
static unsigned foo( unsigned x, __attribute__ ((unused)) int y)
|
||||
{
|
||||
unsigned x2 = x + 1;
|
||||
return x2;
|
||||
}
|
||||
|
||||
int main(void) {
|
||||
unsigned y = 0;
|
||||
y = foo(12,y);
|
||||
return 0;
|
||||
}"
|
||||
HAVE_UNUSED_ATTRIBUTE)
|
||||
message("Checking if __attribute__ unused compiles ok... ${HAVE_UNUSED_ATTRIBUTE}")
|
||||
|
||||
ac_try_compile([=[
|
||||
#include "zlib.h"
|
||||
int main()
|
||||
{
|
||||
Bytef dest[100];
|
||||
uLongf destlen = 100;
|
||||
Bytef *src = 0;
|
||||
uLong srclen = 3;
|
||||
int res = uncompress(dest,&destlen,src,srclen);
|
||||
if (res == Z_OK) {
|
||||
/* ALL IS WELL */
|
||||
}
|
||||
return 0;
|
||||
}]=]
|
||||
HAVE_ZLIB)
|
||||
message(STATUS "Checking zlib.h usability... ${HAVE_ZLIB}")
|
||||
if(HAVE_ZLIB)
|
||||
set(dwfzlib "z")
|
||||
endif()
|
||||
|
||||
ac_try_compile("
|
||||
#include <libelf.h>
|
||||
int main()
|
||||
{
|
||||
int p; p = 0;
|
||||
return 0;
|
||||
}"
|
||||
HAVE_RAW_LIBELF_OK)
|
||||
|
||||
ac_try_compile("
|
||||
#define _GNU_SOURCE
|
||||
#include <libelf.h>
|
||||
int main()
|
||||
{
|
||||
off64_t p; p = 0;
|
||||
return 0;
|
||||
}"
|
||||
HAVE_LIBELF_OFF64_OK)
|
||||
message(STATUS "Checking is off64_t type supported... ${HAVE_LIBELF_OFF64_OK}")
|
||||
|
||||
configure_file(config.h.in.cmake config.h)
|
168
dwarf-compilation.base/contrib/libdwarf/dwarfdump/configure.in
Normal file
168
dwarf-compilation.base/contrib/libdwarf/dwarfdump/configure.in
Normal file
|
@ -0,0 +1,168 @@
|
|||
dnl Process this file with autoconf to produce a configure script.
|
||||
AC_INIT(dwarfdump.c)
|
||||
AC_CONFIG_HEADER(config.h)
|
||||
|
||||
AC_PROG_CC
|
||||
AC_GCC_TRADITIONAL
|
||||
AC_PROG_INSTALL
|
||||
AC_CHECK_TOOL(RANLIB, ranlib, :)
|
||||
AC_CHECK_TOOL(AR, ar)
|
||||
dnl AC_ARFLAGS
|
||||
|
||||
AC_CHECK_HEADERS(elf.h unistd.h libelf.h libelf/libelf.h sgidefs.h sys/types.h)
|
||||
|
||||
dnl Windows seems to have libelf.h with the normal elf.h
|
||||
dnl data embedded. No literal elf.h is present.
|
||||
dnl Get a best estimate of elf header data location.
|
||||
AC_MSG_CHECKING(where is basic elf data)
|
||||
if test "$ac_cv_header_elf_h" = yes; then
|
||||
AC_DEFINE(HAVE_LOCATION_OF_LIBELFHEADER,[<elf.h>], [Define to header that first defines elf])
|
||||
AC_MSG_RESULT(<elf.h>)
|
||||
elif test "$ac_cv_header_libelf_h" = yes; then
|
||||
AC_DEFINE(HAVE_LOCATION_OF_LIBELFHEADER, [<libelf.h>],
|
||||
[Define to header that first defines elf.])
|
||||
AC_MSG_RESULT(<libelf.h>)
|
||||
elif test "$ac_cv_header_libelf_libelf_h" = yes; then
|
||||
AC_DEFINE(HAVE_LOCATION_OF_LIBELFHEADER,[<libelf/libelf.h>],
|
||||
[Define to header that first defines elf.])
|
||||
AC_MSG_RESULT(<libelf/libelf.h>)
|
||||
else
|
||||
AC_MSG_RESULT(NO standard ELF HEADERS found)
|
||||
fi
|
||||
|
||||
AC_CHECK_LIB(elf,elf64_getehdr,
|
||||
AC_DEFINE(HAVE_ELF64_GETEHDR,1,
|
||||
[Define to 1 if the elf64_getehdr function is in libelf.a.]))
|
||||
|
||||
dnl default-disabled shared
|
||||
dnl we allow the argument but the result is ignored.
|
||||
shrd=''
|
||||
AC_ARG_ENABLE(shared,AC_HELP_STRING([--enable-shared],
|
||||
[build shared library libdwarf.so and use it if present]))
|
||||
AS_IF([ test "x$enable_shared" = "xyes"], [
|
||||
shrd='--enable-shared'])
|
||||
|
||||
nonshrd=''
|
||||
dnl default-enabled nonshared
|
||||
dnl we allow the argument but the result is ignored.
|
||||
AC_SUBST(build_nonshared,[none.a])
|
||||
AC_ARG_ENABLE(nonshared,AC_HELP_STRING([--disable-nonshared],
|
||||
[do not build archive library libdwarf.a]))
|
||||
AS_IF([ test "x$enable_nonshared" = "xno"], [
|
||||
nonshrd='--disable-shared'
|
||||
])
|
||||
|
||||
|
||||
dnl This adds compiler options for gcc to get as complete
|
||||
dnl diagnostics as seems to make sense (subject to change...).
|
||||
AC_MSG_CHECKING(compile with -Wall)
|
||||
AC_SUBST(dwfwall,[])
|
||||
AC_ARG_ENABLE(wall,AC_HELP_STRING([--enable-wall],
|
||||
[Add -Wall (default is none)]),
|
||||
[ AC_MSG_RESULT(yes)
|
||||
AC_SUBST(dwfwall,["-Wall -O0 -Wpointer-arith -Wmissing-declarations -Wmissing-prototypes -Wdeclaration-after-statement -Wextra -Wcomment -Wformat -Wpedantic -Wuninitialized -Wno-long-long -Wshadow"]) ],
|
||||
[ AC_SUBST(dwfwall,[])
|
||||
AC_MSG_RESULT(no) ])
|
||||
|
||||
dnl This adds compiler option -fsanitize=address etc (gcc compiler run-time checks))
|
||||
AC_SUBST(dwfsanitize,[])
|
||||
AC_MSG_CHECKING(build -fsanitize-address)
|
||||
AC_ARG_ENABLE(sanitize,AC_HELP_STRING([--enable-sanitize],
|
||||
[Add -fsanitize (default is not to)]),
|
||||
[ AC_SUBST(dwfsanitize,["-fsanitize=address -fsanitize=leak -fsanitize=undefined"])
|
||||
AC_MSG_RESULT(yes) ],
|
||||
[ AC_SUBST(dwfsanitize,[])
|
||||
AC_MSG_RESULT(no)
|
||||
]
|
||||
)
|
||||
|
||||
AC_TRY_COMPILE([#include "stdafx.h"],[ int p; p = 27;] ,
|
||||
AC_DEFINE(HAVE_STDAFX_H,1,
|
||||
[Define 1 if we have the Windows specific header stdafx.h]))
|
||||
|
||||
AC_TRY_COMPILE([#include HAVE_LOCATION_OF_LIBELFHEADER], Elf64_Rel *p; int i; i = p->r_info; ,AC_DEFINE(HAVE_ELF64_R_INFO,1,
|
||||
[Define to 1 if the Elf64_Rel structure has r_info field.]))
|
||||
AC_TRY_COMPILE([], __uint32_t p; p = 3; ,AC_DEFINE(HAVE___UINT32_T,
|
||||
1,[See if __uint32_t is predefined in the compiler. ]))
|
||||
AC_TRY_COMPILE([], __uint64_t p; p = 3; ,AC_DEFINE(HAVE___UINT64_T,
|
||||
1,[See if __uint64_t is predefined in the compiler. ]))
|
||||
AC_TRY_COMPILE([#include <sys/types.h>],[ __uint32_t p; p = 3;] ,
|
||||
AC_DEFINE(HAVE___UINT32_T_IN_SYS_TYPES_H,1,
|
||||
[Define 1 if sys/types.h defines __uint32_t.]))
|
||||
AC_TRY_COMPILE([#include <sys/types.h>],[ __uint64_t p; p = 3;] ,
|
||||
AC_DEFINE(HAVE___UINT64_T_IN_SYS_TYPES_H,1,
|
||||
[Define 1 if sys/types.h defines __uint64_t.]))
|
||||
|
||||
AC_TRY_COMPILE([#include <sys/types.h>
|
||||
#include <regex.h>],[ int i;
|
||||
regex_t r;
|
||||
int cflags = REG_EXTENDED;
|
||||
const char *s = "abc";
|
||||
i = regcomp(&r,s,cflags);
|
||||
regfree(&r);
|
||||
]; ,
|
||||
AC_DEFINE(HAVE_REGEX,1,
|
||||
[Define 1 if regex seems to be defined]))
|
||||
|
||||
AC_MSG_CHECKING(checking if __attribute__ unused compiles ok)
|
||||
AC_TRY_RUN([
|
||||
static unsigned foo( unsigned x, __attribute__ ((unused)) int y)
|
||||
{ unsigned x2 = x + 1;
|
||||
return x2;
|
||||
}
|
||||
int main(void) {
|
||||
unsigned y = 0;
|
||||
y = foo(12,y);
|
||||
return 0;
|
||||
}
|
||||
] ,
|
||||
[AC_DEFINE(HAVE_UNUSED_ATTRIBUTE,1,
|
||||
[Define 1 if __attribute__ ((unused)) compiles ok.])
|
||||
AC_MSG_RESULT(yes) ],
|
||||
[AC_MSG_RESULT(no) ])
|
||||
|
||||
AC_SUBST(dwfzlib,[])
|
||||
AC_MSG_CHECKING(checking zlib present )
|
||||
AC_TRY_COMPILE([#include "zlib.h"],[
|
||||
Bytef dest[100];
|
||||
uLongf destlen = 100;
|
||||
Bytef *src = 0;
|
||||
uLong srclen = 3;
|
||||
int res = uncompress(dest,&destlen,src,srclen);
|
||||
if (res == Z_OK) {
|
||||
/* ALL IS WELL */
|
||||
}
|
||||
] ,
|
||||
[AC_DEFINE(HAVE_ZLIB,1,
|
||||
[Define 1 if zlib (decompression library) seems available.])
|
||||
AC_SUBST(dwfzlib,[-lz])
|
||||
AC_MSG_RESULT(yes)
|
||||
],
|
||||
[AC_MSG_RESULT(no)])
|
||||
|
||||
|
||||
dnl this is ignored in dwarfdump.
|
||||
AC_ARG_ENABLE(nonstandardprintf,AC_HELP_STRING([--enable-nonstandardprintf],
|
||||
[Use a special printf format for 64bit (default is NO)]),
|
||||
[ AC_DEFINE([HAVE_NONSTANDARD_PRINTF_64_FORMAT],[1],
|
||||
[Define 1 if need nonstandard printf format for 64bit] )],
|
||||
[ ])
|
||||
|
||||
AC_TRY_COMPILE([
|
||||
#include <libelf.h>
|
||||
],[ int p; p = 0; ] ,
|
||||
AC_DEFINE(HAVE_RAW_LIBELF_OK,1,
|
||||
[Define 1 if plain libelf builds.]))
|
||||
|
||||
AC_MSG_CHECKING(is off64_t type supported)
|
||||
AC_TRY_COMPILE([
|
||||
#define _GNU_SOURCE
|
||||
#include <libelf.h>
|
||||
],[ off64_t p; p = 0;] ,
|
||||
[AC_DEFINE(HAVE_LIBELF_OFF64_OK,1,
|
||||
[Define 1 if off64 is defined via libelf with GNU_SOURCE.])
|
||||
AC_MSG_RESULT(yes)],
|
||||
[ AC_MSG_RESULT(no) ])
|
||||
|
||||
|
||||
AC_OUTPUT(Makefile)
|
|
@ -0,0 +1,111 @@
|
|||
/* Copyright (c) 2013, David Anderson
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with
|
||||
or without modification, are permitted provided that the
|
||||
following conditions are met:
|
||||
|
||||
Redistributions of source code must retain the above
|
||||
copyright notice, this list of conditions and the following
|
||||
disclaimer.
|
||||
|
||||
Redistributions in binary form must reproduce the above
|
||||
copyright notice, this list of conditions and the following
|
||||
disclaimer in the documentation and/or other materials
|
||||
provided with the distribution.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
|
||||
CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
|
||||
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
|
||||
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
|
||||
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
|
||||
NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
|
||||
OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
|
||||
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
*/
|
||||
|
||||
/* The following interfaces follow tsearch (See the Single
|
||||
Unix Specification) but the implementation is
|
||||
written without reference to the source code
|
||||
of any version of tsearch. Only uses
|
||||
of tsearch were examined, not tsearch source code.
|
||||
|
||||
See http://reality.sgiweb.org/davea/tsearch.html
|
||||
for information about tsearch.
|
||||
|
||||
We are matching the standard functional
|
||||
interface here, but to avoid interfering with
|
||||
libc implementations or code using libc
|
||||
implementations, we change all the names.
|
||||
|
||||
*/
|
||||
|
||||
/* The DW_VISIT values passed back to you through
|
||||
the callback function in dwarf_twalk();
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
dwarf_preorder,
|
||||
dwarf_postorder,
|
||||
dwarf_endorder,
|
||||
dwarf_leaf
|
||||
}
|
||||
DW_VISIT;
|
||||
|
||||
/* void * return values are actually
|
||||
void **key so you must dereference these
|
||||
once to get a key you passed in.
|
||||
|
||||
*/
|
||||
|
||||
|
||||
void *dwarf_tsearch(const void * /*key*/, void ** /*rootp*/,
|
||||
int (* /*compar*/)(const void *, const void *));
|
||||
|
||||
void *dwarf_tfind(const void * /*key*/, void *const * /*rootp*/,
|
||||
int (* /*compar*/)(const void *, const void *));
|
||||
|
||||
/*
|
||||
dwarf_tdelete() returns NULL if it cannot delete anything
|
||||
or if the tree is now empty (if empty, *rootp
|
||||
is set NULL by dwarf_tdelete()).
|
||||
If the delete succeeds and the tree is non-empty returns
|
||||
a pointer to the parent node of the deleted item,
|
||||
unless the deleted item was at the root, in which
|
||||
case the returned pointer relates to the new root.
|
||||
*/
|
||||
void *dwarf_tdelete(const void * /*key*/, void ** /*rootp*/,
|
||||
int (* /*compar*/)(const void *, const void *));
|
||||
|
||||
void dwarf_twalk(const void * /*root*/,
|
||||
void (* /*action*/)(const void * /*nodep*/,
|
||||
const DW_VISIT /*which*/,
|
||||
const int /*depth*/));
|
||||
|
||||
/* dwarf_tdestroy() cannot set the root pointer NULL, you must do
|
||||
so on return from dwarf_tdestroy(). */
|
||||
void dwarf_tdestroy(void * /*root*/,
|
||||
void (* /*free_node*/)(void * /*nodep*/));
|
||||
|
||||
|
||||
/* Prints a simple tree representation to stdout. For debugging.
|
||||
*/
|
||||
void dwarf_tdump(const void*root,
|
||||
char *(* /*keyprint*/)(const void *),
|
||||
const char *msg);
|
||||
|
||||
/* Returns NULL and does nothing
|
||||
unless the implemenation used uses a hash tree. */
|
||||
void * dwarf_initialize_search_hash( void **treeptr,
|
||||
unsigned long(*hashfunc)(const void *key),
|
||||
unsigned long size_estimate);
|
||||
|
||||
|
||||
|
||||
|
1003
dwarf-compilation.base/contrib/libdwarf/dwarfdump/dwarf_tsearchbal.c
Normal file
1003
dwarf-compilation.base/contrib/libdwarf/dwarfdump/dwarf_tsearchbal.c
Normal file
File diff suppressed because it is too large
Load diff
665
dwarf-compilation.base/contrib/libdwarf/dwarfdump/dwarfdump.1
Normal file
665
dwarf-compilation.base/contrib/libdwarf/dwarfdump/dwarfdump.1
Normal file
|
@ -0,0 +1,665 @@
|
|||
.TH DWARFDUMP
|
||||
.SH NAME
|
||||
dwarfdump \- dumps DWARF debug information of an ELF object
|
||||
.SH SYNOPSIS
|
||||
.B dwarfdump [options] \f2objectfilename\fP
|
||||
.SH DESCRIPTION
|
||||
The
|
||||
.B dwarfdump
|
||||
command prints or checks DWARF sections as requested by specific options.
|
||||
With no options (but with the required \f2objectfilename\fP )
|
||||
all sections print (but some sections cannot be printed independently
|
||||
safely, so those are only printed at offsets where the .debug_info section
|
||||
refers to those sections).
|
||||
.PP
|
||||
As of June 2011 the printing options and the checking options
|
||||
are mutually exclusive (if checking options are selected
|
||||
the section details are not printed). When errors are encountered
|
||||
dwarfdump does attempt to print sufficient context so that
|
||||
one can understand exactly where the error is in the DWARF.
|
||||
This change makes checking really large object files
|
||||
much easier.
|
||||
.PP
|
||||
The format is intended to be human readable.
|
||||
If a script is to parse the output, the
|
||||
.B \-d
|
||||
option is useful.
|
||||
.PP
|
||||
Not all sections actually exist in any given object file.
|
||||
.PP
|
||||
The format may change from release to release, so it is
|
||||
unwise to depend too heavily on the format.
|
||||
.PP
|
||||
Frame information (.debug_frame and .eh_frame) is heavily
|
||||
dependent on the ABI/ISA of the object file.
|
||||
By default we use a generic set of register names
|
||||
handling up to 100 registers named r0-100.
|
||||
The '-R' option uses a built-in generic register name set
|
||||
handling up to 1200 registers named r0-r1199.
|
||||
The '-x abi=<abi>'
|
||||
description below shows how to name an abi and use that to guide
|
||||
the -f or -F processing.
|
||||
Unless the cpu for the object file being dumped has many registers,
|
||||
do not use -R or -x abi=generic as those can be needlessly
|
||||
slow dumping frame sections. Instead, use the correct
|
||||
abi (if it exists in dwarfdump.conf) or a generic such
|
||||
as -x abi=generic100 or -x abi=generic500.
|
||||
To get MIPS/IRIX register names names and call the old version 2 libdwarf
|
||||
frame interface use the option '-x abi=mips'.
|
||||
Without '-R' or '-x abi=<abi>' dwarfdump ignores
|
||||
the dwarfdump.conf file and uses compiled-in generic set of
|
||||
register names.
|
||||
If no '-x name=<path>' is given, dwarfdump
|
||||
looks for "./dwarfdump.conf", "$HOME/.dwarfdump.conf", "<install-prefix>/lib/dwarfdump.conf" and takes the first it finds.
|
||||
If one or more '-x name=<path>' is given the last of these is
|
||||
used and all other such files are ignored.
|
||||
.PP
|
||||
If '-x nosanitizestrings' is given then unprintable characters
|
||||
are not translated to '%xx' (two digit hex
|
||||
preceded by the '%' character) (with
|
||||
this option bogus characters
|
||||
in strings could cause terminal windows to behave oddly).
|
||||
.PP
|
||||
Some -k (checking) options print so-called harmless errors.
|
||||
These are compiler errors that do not cause any
|
||||
known problem and are only detected inside libdwarf itself.
|
||||
These are difficult to properly report in dwarfdump and
|
||||
any error strings may not appear close to the time the
|
||||
error was encountered.
|
||||
.PP
|
||||
If zlib compression was used on the DWARF sections
|
||||
in the object file being read the
|
||||
real section names such as .zdebug_info etc will be reported by
|
||||
dwarfdump.
|
||||
When dwarfdump says something is at offset 55
|
||||
of .zdebug_info (or the like) keep in mind that
|
||||
the offset applies to the
|
||||
uncompressed section (in memory),
|
||||
not the .zdebug_ compressed section
|
||||
in \f2objectfilename\fP.
|
||||
.SH URI STYLE INPUT STRINGS
|
||||
.PP
|
||||
The <objectfilename> and the options taking name strings look for URIs and
|
||||
translate the URI strings to characters by default
|
||||
(see -x, -c<compiler name>, -S, -u).
|
||||
So any single % character is treated as if the following two
|
||||
characters are hex digits representing the underlying true character.
|
||||
Various characters are meaningful to shells (such as bash or sh)
|
||||
and to getopt (such as the space character)
|
||||
If the URI translation does anything it prints the before and after
|
||||
of the URI translation on standard output, so inspection of the first
|
||||
lines of output will show if URI did anything.
|
||||
The actual options themselves are assumed to be non-URI.
|
||||
So in the option '-cS&T' the -c portion must be non-URI, but the
|
||||
& character might cause input issues so '-cS%26T' could be used instead.
|
||||
To actually input a single % character (in a name, for example),
|
||||
double it to %% on the command line.
|
||||
.PP
|
||||
Options -U (turning off URI interpretation) and -q (making finding
|
||||
URI sequences silent) give finer control of URI interpretation.
|
||||
PP
|
||||
As an example, to get a string'a b' make the string 'a%20b'
|
||||
(here the quote (') is for exposition not part of the string, though
|
||||
quote is certainly problematic in a name).
|
||||
Instead of escaping " quotes in the string, type %25, as in
|
||||
'a "b' should be typed 'a%20%25b'
|
||||
Any characters can be typed in URI style, not just characters
|
||||
which are problematic to the shell or getopt.
|
||||
We strongly suggest you not type URI-style characters where
|
||||
such are not needed or use
|
||||
the % character itself in command line strings unless you must.
|
||||
.SH PRINTING OPTIONS
|
||||
.TP
|
||||
.B \-a
|
||||
Print each section as independently as possible. Sections that
|
||||
can safely be printed independently (like .debug_abbrev)
|
||||
have relevant info printed in the report (sometimes dependent
|
||||
on -v).
|
||||
|
||||
.TP
|
||||
.B \-b
|
||||
Print the .debug_abbrev section. Because the DWARF specifications
|
||||
do not rule out garbage data areas in .debug_abbrev (if they are not
|
||||
referenced from .debug_info) any garbage bytes can result in
|
||||
this print failing.
|
||||
|
||||
.TP
|
||||
.B \-c
|
||||
Print locations lists.
|
||||
|
||||
.TP
|
||||
.B \-E
|
||||
Print ELF header information and index, address and size for all sections.
|
||||
.TP
|
||||
.B \-Eh
|
||||
Effectively does nothing (use another tool to print
|
||||
the Elf file header).
|
||||
.TP
|
||||
.B \-El
|
||||
Print index, address and size for the .debug_line section.
|
||||
.TP
|
||||
.B \-Ei
|
||||
Print index, address and size for the .debug_info section.
|
||||
.TP
|
||||
.B \-Ea
|
||||
Print index, address and size for the .debug_abbrev section.
|
||||
.TP
|
||||
.B \-Ep
|
||||
Print index, address and size for the .debug_pubnames section.
|
||||
.TP
|
||||
.B \-Er
|
||||
Print index, address and size for the .debug_aranges section.
|
||||
.TP
|
||||
.B \-Ef
|
||||
Print index, address and size for the .debug_frame section.
|
||||
.TP
|
||||
.B \-Eo
|
||||
Print index, address and size for the .debug_loc section.
|
||||
.TP
|
||||
.B \-ER
|
||||
Print index, address and size for the .debug_ranges section.
|
||||
.TP
|
||||
.B \-Es
|
||||
Print index, address and size for the .debug_string section.
|
||||
.TP
|
||||
.B \-Et
|
||||
Print index, address and size for the .debug_pubtypes section.
|
||||
.TP
|
||||
.B \-Ex
|
||||
Print index, address and size for the .text section.
|
||||
.TP
|
||||
.B \-Ed
|
||||
Print index, address and size for the .text and .debug_* sections.
|
||||
|
||||
.TP
|
||||
.B \-f
|
||||
Print the .debug_frame section.
|
||||
.TP
|
||||
.B \-F
|
||||
Print the .eh_frame section.
|
||||
|
||||
.TP
|
||||
.B \-h
|
||||
Print IRIX exception tables (unsupported).
|
||||
|
||||
.TP
|
||||
.B \-i
|
||||
Print the .debug_info section.
|
||||
|
||||
.TP
|
||||
.B \-I
|
||||
Print the .gdb_index, .debug_cu_index, .debug_tu_index sections
|
||||
if any exist.
|
||||
|
||||
.TP
|
||||
.B \-l
|
||||
Print the .debug_info section and the associated line section data.
|
||||
.TP
|
||||
.B \-ls
|
||||
Print the .debug_info section and the associated line section data, but omits
|
||||
the <pc> address. Useful when a comparison is required.
|
||||
|
||||
.TP
|
||||
.B \-m
|
||||
Print the .debug_macinfo section.
|
||||
|
||||
.TP
|
||||
.B \-N
|
||||
Print .debug_ranges section. Because the DWARF specifications
|
||||
do not rule out garbage data areas in .debug_ranges (if they are not
|
||||
referenced from .debug_info) any garbage bytes can result in
|
||||
this print failing.
|
||||
|
||||
.TP
|
||||
.B \-p
|
||||
Print the .debug_pubnames section.
|
||||
|
||||
.TP
|
||||
.B \-r
|
||||
Print the .debug_aranges section.
|
||||
.TP
|
||||
.B \-s
|
||||
Print .debug_string section.
|
||||
|
||||
.TP
|
||||
.B \-ta
|
||||
Print the IRIX only sections .debug_static_funcs and .debug_static_vars.
|
||||
|
||||
.TP
|
||||
.B \-tf
|
||||
Print the IRIX only section .debug_static_funcs.
|
||||
.TP
|
||||
.B \-tv
|
||||
Print the IRIX only section .debug_static_vars.
|
||||
|
||||
.TP
|
||||
.B \-w
|
||||
Print the IRIX-only .debug_weaknames section.
|
||||
|
||||
.TP
|
||||
.B \-y
|
||||
Print the .debug_pubtypes section (and .debug_typenames,
|
||||
an SGI IRIX-only section).
|
||||
|
||||
.PP
|
||||
Having dwarfdump print relocations may help establish whether
|
||||
dwarfdump understands any relocations that might exist.
|
||||
|
||||
.TP
|
||||
.B \-o
|
||||
Print all relocation records as well as we can manage.
|
||||
.TP
|
||||
.B \-oi
|
||||
Print .rel*debug_info relocations.
|
||||
.TP
|
||||
.B \-ol
|
||||
Print .rel*debug_line relocation.
|
||||
.TP
|
||||
.B \-op
|
||||
Print .rel*debug_pubnames relocation.
|
||||
.TP
|
||||
.B \-oa
|
||||
Has no effect.
|
||||
.TP
|
||||
.B \-or
|
||||
Print .rel*debug_aranges relocations.
|
||||
.TP
|
||||
.B \-of
|
||||
Print .rel*debug_frame relocations.
|
||||
.TP
|
||||
.B \-oo
|
||||
Print .rel*debug_loc relocations.
|
||||
.TP
|
||||
.B \-oR
|
||||
Print .rel*debug_ranges relocations.
|
||||
|
||||
.TP
|
||||
.B \-g
|
||||
Normally used only for testing libdwarf, this tells dwarfdump to
|
||||
use an older dwarf_loclist() interface
|
||||
function (a function that cannot handle all
|
||||
DWARF4 or DWARF5
|
||||
location lists).
|
||||
Before November 2015 it implied -i, now you should use
|
||||
-i -g to also get .debug_info printed.
|
||||
.TP
|
||||
.B \-V
|
||||
Print a dwarfdump date/version string and stop.
|
||||
|
||||
.SH CHECKING OPTIONS
|
||||
.TP
|
||||
.B \-cg
|
||||
Restricts checking to compilers whose
|
||||
producer string starts with 'GNU'
|
||||
and turns off -cs.
|
||||
|
||||
.TP
|
||||
.B \-cs
|
||||
Restricts checking to compilers whose
|
||||
producer string starts with 'SN'
|
||||
and turns off -cg.
|
||||
.TP
|
||||
.B \-cname
|
||||
Restricts checking to compilers whose
|
||||
producer string contains 'name' (not case sensitive).
|
||||
The 'name' is read as a URI string.
|
||||
|
||||
.TP
|
||||
.B \-ka
|
||||
Turns on all checking options except -kxe (-kxe might
|
||||
be slow enough one mignt not want to use it routinely.)
|
||||
|
||||
.TP
|
||||
.B \-kb
|
||||
Checks for certain abbreviations section errors when reading DIEs.
|
||||
.TP
|
||||
.B \-kc
|
||||
Checks for errors in constants in debug_info.
|
||||
.TP
|
||||
.B \-kd
|
||||
Turns on full reporting of error totals per producer.
|
||||
(the default shows less detail).
|
||||
.TP
|
||||
.B \-kD
|
||||
Turns on reporting of duplicated attributes.
|
||||
Duplicated attributes on a single DW_TAG are
|
||||
improper DWARF, but at least one compiler
|
||||
emitted such.
|
||||
.TP
|
||||
.B \-ke
|
||||
Turns on reading pubnames and checking for fde errors.
|
||||
.TP
|
||||
.B \-kE
|
||||
Checks the integer encoding representation in debug_info,
|
||||
computing whether these integer values
|
||||
could fit in fewer bytes if represented in LEB128.
|
||||
|
||||
.TP
|
||||
.B \-kf
|
||||
Turns on checking for FDE errors.
|
||||
.TP
|
||||
.B \-kF
|
||||
Turns on checking for line table errors.
|
||||
.TP
|
||||
.B \-kg
|
||||
Turns on checking for unused gaps in .debug_info (these
|
||||
gaps are not an error, just a waste of space).
|
||||
.TP
|
||||
.B \-kG
|
||||
Print only unique errors. Error lines are simpified
|
||||
(hex numbers removed, for example) and when
|
||||
a given message string would otherwise appear
|
||||
again it is suppressed.
|
||||
.TP
|
||||
.B \-ki
|
||||
Causes a summary of checking results per compiler (producer)
|
||||
to be printed at the end.
|
||||
.TP
|
||||
.B \-kl
|
||||
Turns on locations list checking.
|
||||
.TP
|
||||
.B \-km
|
||||
Turns on checking of ranges.
|
||||
.TP
|
||||
.B \-kM
|
||||
Turns on checking of aranges.
|
||||
.TP
|
||||
.B \-kr
|
||||
Turns on DIE tag-attr combinations checking.
|
||||
.TP
|
||||
.B \-kR
|
||||
Turns on reading DIEs and checking for forward declarations
|
||||
rom DW_AT_specification attributes.
|
||||
(which are not an error but can be a source of inefficiency
|
||||
for debuggers).
|
||||
.TP
|
||||
.B \-ks
|
||||
Turns on extra reporting for some DIE errors checking detects.
|
||||
.TP
|
||||
.B \-kS
|
||||
Turns on checking DIE references for circular references.
|
||||
.TP
|
||||
.B \-kt
|
||||
Turns on tag-tag combinations checking.
|
||||
.TP
|
||||
.B \-ku
|
||||
Print tag-tree and tag-attribute usage (basic format).
|
||||
.TP
|
||||
.B \-kuf
|
||||
Print tag-tree and tag-attribute usage (full format).
|
||||
For standard TAGs and ATtributes this presents an overview
|
||||
of how they were used.
|
||||
.TP
|
||||
.B \-kx
|
||||
Turns on check_frames.
|
||||
.TP
|
||||
.B \-kxe
|
||||
Turns off basic check_frames and turns on extended frame checking.
|
||||
.TP
|
||||
.B \-ky
|
||||
Turns on type_offset, decl_file checking,
|
||||
|
||||
.SH OPTION MODIFIERS
|
||||
|
||||
.TP
|
||||
.B \-C
|
||||
Normally when checking for tag-tag or tag-attribute combinations
|
||||
both the standard combinations and some common extensions are allowed.
|
||||
With -C the extensions are taken out of the allowed class of combinations.
|
||||
|
||||
.TP
|
||||
.B \-d
|
||||
When printing DIEs, put all the attributes for each DIE on the same (long)
|
||||
line as the TAG. This makes searching for DIE information
|
||||
(as with grep) much simpler as the entire DIE is on one line.
|
||||
|
||||
.TP
|
||||
.B \-D
|
||||
Turns off the display of section offsets and attribute values in printed output.
|
||||
So the .debug_info output is just TAGs and Attributes.
|
||||
For pubnames (and the like) it removes offsets from the output.
|
||||
For locations lists it removes offsets from the output, but that
|
||||
is useless since the attribute values don't show so neither does
|
||||
the location data.
|
||||
|
||||
.TP
|
||||
.B \-e
|
||||
Turns on truncation of attribute and tag names. For example
|
||||
DW_TAG_foo becomes foo. Not compatible with
|
||||
checking, only useful for printing DIEs.
|
||||
|
||||
.TP
|
||||
.B \-G
|
||||
When printing, add global offsets to the offsets printed.
|
||||
|
||||
.TP
|
||||
.B \-H number
|
||||
When printing or checking .debug_info, this terminates
|
||||
the search after 'number' compilation units. When printing
|
||||
frame information this terminates the FDE reporting
|
||||
after 'number' FDEs and the CIE reporting (which occurs if one adds -v)
|
||||
after 'number' CIEs. Example '-H 1'
|
||||
|
||||
.TP
|
||||
.B \-M
|
||||
When printing, this means one want to have the FORM show for each attribute.
|
||||
If a -v is also added (or more than one) then details of any form indirection
|
||||
are also shown.
|
||||
|
||||
.TP
|
||||
.B \-n
|
||||
When printing frames, this turns off the search for function names.
|
||||
In a really large object the search can take more time than
|
||||
one wants to wait, so this avoids the search.
|
||||
.TP
|
||||
.B \-O file=<path>
|
||||
The <path> will be used as the file name for output instead
|
||||
of writing to stdout (stdout is the default).
|
||||
.TP
|
||||
.B \-Q
|
||||
Suppresses section data printing (set automatically with a checking option).
|
||||
|
||||
.TP
|
||||
.B \-R
|
||||
When printing frames for ABIs with lots of registers, this allows
|
||||
up to 1200 registers to be named (like R999) without choosing an ABI
|
||||
with, for example '-x abi=ppc'
|
||||
|
||||
.TP
|
||||
.B \-v
|
||||
Increases the detail shown when printing.
|
||||
In some sections, using more -v options
|
||||
will increase the detail (one to three are useful) or may
|
||||
change the report to show, for example, the actual
|
||||
line-data-commands instead of the resultant line-table.
|
||||
|
||||
.SH SELECTIVE ENTRY PRINTING
|
||||
|
||||
.PP
|
||||
These -S options stand alone and basic print information about the compilation
|
||||
unit and DIE where the string(s) appear.
|
||||
At most one of each of the following is effective (so for example
|
||||
one can only have one 'match', but one can
|
||||
have a 'match', an 'any', and a 'regex').
|
||||
Any -S causes the .debug_info section to be inspected.
|
||||
No checking options or printing options should be supplied with -S.
|
||||
|
||||
If v is added to the -S option, the number of occurrences is printed.
|
||||
(see below for an example).
|
||||
|
||||
.TP
|
||||
.B \-S match=string
|
||||
When printing DIEs
|
||||
for each tag value or attribute name that matches 'string' exactly
|
||||
print the compilation unit information and its section offset.
|
||||
Any CU with no match is not printed.
|
||||
The 'string' is read as a URI string.
|
||||
.TP
|
||||
.B \-S any=string
|
||||
When printing DIEs
|
||||
for each tag value or attribute name that contains 'string'
|
||||
somewhere in the tag or attribute (case insensitive)
|
||||
print the compilation unit information and its section offset.
|
||||
Any CU with no match is not printed.
|
||||
The 'string' is read as a URI string.
|
||||
.TP
|
||||
.B \-S regex=string
|
||||
When printing DIEs
|
||||
for each tag value or attribute name where the 'string' reqular
|
||||
expression matches print the compilation unit information
|
||||
and its section offset.
|
||||
Any CU with no match is not printed.
|
||||
The 'string' is read as a URI string.
|
||||
|
||||
.PP
|
||||
The string cannot have spaces or other characters which are
|
||||
meaningful to getopt(3) and the shell will strip off quotes and
|
||||
other characters.
|
||||
So the string is assumed to be in URI style and is translated.
|
||||
In other words, to match 'a b' make the -S string 'a%20b'
|
||||
Instead of escaping " quotes in the string, type %25, as in
|
||||
'a "b' should be typed 'a%20%25b'
|
||||
(the ' are for exposition here, not part of the strings).
|
||||
Any characters can be typed in URI style, not just characters
|
||||
which are problematic to the shell or getopt.
|
||||
.PP
|
||||
The -S any= and -S regex= options are only usable
|
||||
if the library functions required are found at configure time.
|
||||
.PP
|
||||
The -W option is a modifier to the -S option, and
|
||||
increases the amount of output -W prints.
|
||||
An example v modifier to the -S option is shown below.
|
||||
And we show the -W in context with a -S option.
|
||||
|
||||
.TP
|
||||
.B \-S vmatch=string1
|
||||
Prints information about the
|
||||
DIEs that -S matches and prints the count of occurrences
|
||||
|
||||
.TP
|
||||
.B \-S match=string1 -W
|
||||
Prints the parent tree and the children tree for the
|
||||
DIEs that -S matches.
|
||||
|
||||
.TP
|
||||
.B \-S match=string2 -Wp
|
||||
Prints the parent tree for the DIEs that -S matches.
|
||||
|
||||
.TP
|
||||
.B \-S match=string3 -Wc
|
||||
Prints the parent tree for the DIEs that -S matches.
|
||||
|
||||
.SH OTHER OPTIONS
|
||||
|
||||
.TP
|
||||
.B \-# number
|
||||
This option controls internal debugging output,
|
||||
higher numbers mean more debug actions. See the source code.
|
||||
|
||||
|
||||
.TP
|
||||
.B \-x name=/p/a/t/h.conf
|
||||
The file path given is the name of a file assumed to be
|
||||
a dwarfdump.conf-like file.
|
||||
The file path is read as a URI string.
|
||||
|
||||
.TP
|
||||
.B \-x abi=ppc
|
||||
Selects the abi (from a dwarfdump.conf file) to be used in
|
||||
printing frame information (here using ppc as an example).
|
||||
The abi is read as a URI string.
|
||||
|
||||
.TP
|
||||
.B \-x groupnumber=<n>
|
||||
For an object file with both DWARF5 split dwarf (.debug_info.dwo
|
||||
for example) and ordinary
|
||||
DWARF sections (.debug_info for example)
|
||||
in the single object file
|
||||
one must use
|
||||
-x groupnumber=2 to print the dwo sections.
|
||||
Adding -x tied=<path> naming the same object file ties
|
||||
in the non-dwo sections.
|
||||
|
||||
.TP
|
||||
.B \-x tied=/t/i/depath
|
||||
Used when opening a main object that is a .dwo or .dwp file.
|
||||
The tied file path names the executable which has
|
||||
the .debug_addr section that may be referred to from
|
||||
the main object. See Split Objects (aka Debug Fission).
|
||||
.TP
|
||||
.B \-x line5=s2l
|
||||
Normally used only to test libdwarf interfaces.
|
||||
There are 4 different interface function sets and to ensure
|
||||
they all work this option lets us choose which
|
||||
to use. The options are 's2l' (default, Allows standard
|
||||
and two-level line tables using the latest
|
||||
interface functions), 'std' (Allows standard
|
||||
single level line tables using the latest
|
||||
interface functions), 'orig' (allows DWARF2,3,4
|
||||
original line tables using an older
|
||||
interface function set), 'orig2l' (allows original line tables
|
||||
and some two-level line tables using an older interface set).
|
||||
|
||||
.TP
|
||||
.B \-P
|
||||
When checking this adds the list of compilation-unit names
|
||||
seen for each producer-compiler to the printed checking results.
|
||||
.TP
|
||||
.B \-q
|
||||
When a URI is found and translated while reading
|
||||
the command line, be quiet about
|
||||
the URI translation. That is, don't print the
|
||||
original and translated option strings.
|
||||
|
||||
.TP
|
||||
.B \-E
|
||||
Turns on printing object-internal header data for some
|
||||
systems (for Unix/Linux does nothing).
|
||||
|
||||
.TP
|
||||
.B \-u cuname
|
||||
Turns on selective printing of DIEs (printing like -i).
|
||||
Only the DIEs for a compilation unit that match the
|
||||
name provided are printed.
|
||||
If the compilation unit is ./a/b/c.c
|
||||
the 'cuname' you provide should be c.c as the characters
|
||||
through the final path-separating / are ignored.
|
||||
If 'cuname' begins with a / then the entire name string
|
||||
of a compilation unit must match 'cuname'.
|
||||
The 'cuname' is read as a URI string.
|
||||
|
||||
.TP
|
||||
.B \-U
|
||||
Turn off the URI interpretation of the command line
|
||||
strings entirely. Must be be on the command line before
|
||||
any URI strings encountered to be fully effective.
|
||||
|
||||
.TP
|
||||
.B \-z
|
||||
No longer supported.
|
||||
|
||||
|
||||
.SH FILES
|
||||
dwarfdump
|
||||
|
||||
./dwarfdump.conf
|
||||
|
||||
$(HOME)/.dwarfdump.conf
|
||||
|
||||
$(HOME)/dwarfdump.conf
|
||||
|
||||
<install-prefix>/lib/dwarfdump.conf
|
||||
.SH NOTES
|
||||
In some cases compilers use DW_FORM_data1 (for example)
|
||||
and in such cases the signedness of the value must be taken
|
||||
from context. Rather than attempt to determine the
|
||||
context, dwarfdump prints the value with both signednesses
|
||||
whenever there is ambiguity about the correct interpretation.
|
||||
For example,
|
||||
"DW_AT_const_value 176(as signed = -80)".
|
||||
For normal DWARF consumers that correctly and fully
|
||||
evaluate all attributes there is no ambiguity of signedness:
|
||||
the ambiguity for dwarfdump is due to dwarfdump evaluating
|
||||
DIEs in a simple order and not keeping track of much context.
|
||||
.SH BUGS
|
||||
Support for DWARF3 is being completed but may not be complete.
|
3303
dwarf-compilation.base/contrib/libdwarf/dwarfdump/dwarfdump.c
Normal file
3303
dwarf-compilation.base/contrib/libdwarf/dwarfdump/dwarfdump.c
Normal file
File diff suppressed because it is too large
Load diff
810
dwarf-compilation.base/contrib/libdwarf/dwarfdump/dwarfdump.conf
Normal file
810
dwarf-compilation.base/contrib/libdwarf/dwarfdump/dwarfdump.conf
Normal file
|
@ -0,0 +1,810 @@
|
|||
# MIPS/IRIX ISA/ABI
|
||||
# Used to configure dwarfdump printing of .debug_frame and
|
||||
# .eh_frame.
|
||||
|
||||
# Any number of abi's can be described. Only one can be selected
|
||||
# in a given dwarfdump run (see dwarfdump options)
|
||||
# Available commands are
|
||||
# beginabi: <abiname>
|
||||
# reg: <regname> <dwarf regnumber>
|
||||
# frame_interface: <integer value 2 or 3>
|
||||
# cfa_reg: <number>
|
||||
# initial_reg_value: <number: often 1034 or 1035 >
|
||||
# same_val_reg: 1035
|
||||
# undefined_val_reg: 1034
|
||||
# reg_table_size: <size of table>
|
||||
# address_size: <4 or 8, Rarely needed, see example below. >
|
||||
# includeabi: <abiname Inserts the referenced abi as if its text was
|
||||
# directly inserted at this point.>
|
||||
# endabi: <abiname>
|
||||
#
|
||||
# Symbolic names do not work here, use literal numbers
|
||||
# where applicable (in C standard decimal, octal (leading 0) or
|
||||
# hexadecimal <leading 0x>).
|
||||
#
|
||||
# Whitespace is required to separate command: from operands and
|
||||
# operands from each other on a line.
|
||||
#
|
||||
# There is no ordering required within a beginabi/endabi pair.
|
||||
# As many ABIs as required may be listed.
|
||||
# dwarfdump will choose exactly one abi to dump frame information.
|
||||
#
|
||||
|
||||
|
||||
# MIPS abi,the old IRIX form, not to be used on modern objects.
|
||||
# Begin with abi name (use here and on dwarfdump command line).
|
||||
beginabi: mips-irix
|
||||
|
||||
# Instructs dwarfdump to default to the older frame interface.
|
||||
# Use value 3 to use the newer interface.
|
||||
# The '2' interface is supported but deprecated (deprecated
|
||||
# because it cannot work with all popular ABIs: mixing
|
||||
# the cfa-rule into the table column set was not a good idea
|
||||
# but it is part of the MIPS/IRIX standard usage).
|
||||
frame_interface: 2
|
||||
|
||||
# If (and only if) using frame_interface: 2 tell dwarfdump
|
||||
# what table colum that DW_FRAME_CFA_COL is.
|
||||
# If using frame_interface: 3 cfa_reg: should be
|
||||
# DW_FRAME_CFA_COL3 (1436)
|
||||
cfa_reg: 0
|
||||
|
||||
# For MIPS, the same as DW_FRAME_SAME_VAL (1035).
|
||||
# For other ISA/ABIs 1034 (DW_FRAME_UNDEFINED_VAL) might be better.
|
||||
# Depends on the ABI convention, if set wrong way too many
|
||||
# regs will be listed in the frame output.
|
||||
# This instructs dwarfdump to set libdwarf to this value,
|
||||
# overriding the libdwarf default.
|
||||
# If initial_reg_value not set the libdwarf default is used
|
||||
# (see libdwarf.h DW_FRAME_REG_INITIAL_VALUE).
|
||||
initial_reg_value: 1035 # DW_FRAME_SAME_VAL
|
||||
same_val_reg: 1035
|
||||
undefined_val_reg: 1034
|
||||
|
||||
# Built in to frame_interface: 2 as 66.
|
||||
reg_table_size: 66
|
||||
|
||||
|
||||
# Only name registers for wich a r4 (for example) is not what you
|
||||
# want to see
|
||||
# No particular order of the reg: lines required.
|
||||
reg: cfa 0 # Used with MIPS/IRIX original DWARF2 interface
|
||||
reg: r1/at 1
|
||||
reg: r2/v0 2
|
||||
reg: r3/v1 3
|
||||
reg: r4/a0 4
|
||||
reg: r5/a1 5
|
||||
reg: r6/a2 6
|
||||
reg: r7/a3 7
|
||||
reg: r8/t0 8
|
||||
reg: r9/t1 9
|
||||
reg: r10/t2 10
|
||||
reg: r11/t3 11
|
||||
reg: r12/t4 12
|
||||
reg: r13/t5 13
|
||||
reg: r14/t6 14
|
||||
reg: r15/t7 15
|
||||
reg: r16/s0 16
|
||||
reg: r17/s1 17
|
||||
reg: r18/s2 18
|
||||
reg: r19/s3 19
|
||||
reg: r20/s4 20
|
||||
reg: r21/s5 21
|
||||
reg: r22/s6 22
|
||||
reg: r23/s7 23
|
||||
reg: r24/t8 24
|
||||
reg: r25/t9 25
|
||||
reg: r26/k0 26
|
||||
reg: r27/k1 27
|
||||
reg: r28/gp 28
|
||||
reg: r29/sp 29
|
||||
reg: r30/s8 30
|
||||
reg: r31 31
|
||||
|
||||
reg: $f0 32
|
||||
reg: $f1 33
|
||||
reg: $f2 34
|
||||
reg: $f3 35
|
||||
reg: $f4 36
|
||||
reg: $f5 37
|
||||
reg: $f6 38
|
||||
reg: $f7 39
|
||||
reg: $f8 40
|
||||
reg: $f9 41
|
||||
reg: $f10 42
|
||||
reg: $f11 43
|
||||
reg: $f12 44
|
||||
reg: $f13 45
|
||||
reg: $f14 46
|
||||
reg: $f15 47
|
||||
reg: $f16 48
|
||||
reg: $f17 49
|
||||
reg: $f18 50
|
||||
reg: $f19 51
|
||||
reg: $f20 52
|
||||
reg: $f21 53
|
||||
reg: $f22 54
|
||||
reg: $f23 55
|
||||
reg: $f24 56
|
||||
reg: $f25 57
|
||||
reg: $f26 58
|
||||
reg: $f27 59
|
||||
reg: $f28 60
|
||||
reg: $f29 61
|
||||
reg: $f30 62
|
||||
reg: $f31 63
|
||||
reg: ra 64
|
||||
reg: slk 65
|
||||
|
||||
|
||||
# End of abi definition.
|
||||
endabi: mips-irix
|
||||
|
||||
|
||||
# Make 'mips' abi be a modern MIPS, not an old IRIX version.
|
||||
beginabi: mips
|
||||
includeabi: mips-simple3
|
||||
endabi: mips
|
||||
|
||||
|
||||
# MIPS/IRIX ISA/ABI for testing libdwarf.
|
||||
beginabi: mips-irix2
|
||||
frame_interface: 2
|
||||
reg_table_size: 66
|
||||
cfa_reg: 0
|
||||
same_val_reg: 1035
|
||||
undefined_val_reg: 1034
|
||||
initial_reg_value: 1035
|
||||
|
||||
reg: cfa 0 # Used with MIPS/IRIX original DWARF2 interface
|
||||
reg: ra 64
|
||||
reg: slk 65
|
||||
|
||||
# End of abi definition.
|
||||
endabi: mips-irix2
|
||||
|
||||
# MIPS/IRIX ISA/ABI for testing the new frame interface
|
||||
# with libdwarf.
|
||||
beginabi: mips-simple3
|
||||
frame_interface: 3
|
||||
|
||||
# When using frame_interface: 3 the size of the register table
|
||||
# is not fixed. It can be as large as needed.
|
||||
reg_table_size: 66
|
||||
cfa_reg: 1436 # DW_FRAME_CFA_COL3
|
||||
initial_reg_value: 1035
|
||||
same_val_reg: 1035
|
||||
undefined_val_reg: 1034
|
||||
|
||||
# No cfa as a 'normal' register.
|
||||
# Rule 0 is just register 0, which is not used
|
||||
# in frame descriptions.
|
||||
# (so cfa does not have a number here, and dwarfdump gives
|
||||
# it the name 'cfa' automatically).
|
||||
reg: ra 64
|
||||
reg: slk 65
|
||||
# End of abi definition.
|
||||
endabi: mips-simple3
|
||||
|
||||
|
||||
beginabi: ia64
|
||||
frame_interface: 3
|
||||
initial_reg_value: 1034 # DW_FRAME_UNDEFINED_VAL
|
||||
cfa_reg: 1436 # DW_FRAME_CFA_COL3
|
||||
reg_table_size: 695
|
||||
same_val_reg: 1035
|
||||
undefined_val_reg: 1034
|
||||
|
||||
# The following register names are not necessarily correct...
|
||||
# Register indexes r32-r127 not used.
|
||||
reg: f0 128
|
||||
# ...
|
||||
reg: f127 255
|
||||
reg: b0 321
|
||||
reg: b1 322
|
||||
reg: b2 323
|
||||
reg: b3 324
|
||||
reg: b4 325
|
||||
reg: b5 326
|
||||
reg: b6 327
|
||||
reg: b7 328
|
||||
reg: vfp 329
|
||||
reg: vrap 330
|
||||
reg: pr 331
|
||||
reg: ip 332
|
||||
reg: psr 333
|
||||
reg: cfm 334
|
||||
reg: k0 335
|
||||
reg: k1 336
|
||||
reg: k2 337
|
||||
reg: k3 338
|
||||
reg: k4 339
|
||||
reg: k5 340
|
||||
reg: k6 341
|
||||
reg: k7 342
|
||||
reg: rsc 350
|
||||
reg: bsp 351
|
||||
reg: bspstore 352
|
||||
reg: rnat 353
|
||||
reg: fcr 355
|
||||
reg: eflag 358
|
||||
reg: csd 359
|
||||
reg: ssd 360
|
||||
reg: cflg 361
|
||||
reg: fsr 362
|
||||
reg: fir 363
|
||||
reg: fdr 364
|
||||
reg: pfs 398
|
||||
reg: lc 399
|
||||
reg: ec 400
|
||||
|
||||
endabi: ia64
|
||||
|
||||
|
||||
beginabi: x86
|
||||
frame_interface: 3
|
||||
initial_reg_value: 1035 # DW_FRAME_SAME_VAL
|
||||
reg_table_size: 66 # more than large enough, hopefully.
|
||||
cfa_reg: 1436 # DW_FRAME_CFA_COL3
|
||||
same_val_reg: 1035
|
||||
undefined_val_reg: 1034
|
||||
|
||||
# The following register names are not necessarily correct...
|
||||
reg: eax 0
|
||||
reg: ecx 1
|
||||
reg: edx 2
|
||||
reg: ebx 3
|
||||
reg: esp 4
|
||||
reg: ebp 5
|
||||
reg: esi 6
|
||||
reg: edi 7
|
||||
reg: eip 8
|
||||
reg: eflags 9
|
||||
|
||||
reg: trapno 10
|
||||
reg: st0 11
|
||||
reg: st1 12
|
||||
reg: st2 13
|
||||
reg: st3 14
|
||||
reg: st4 15
|
||||
reg: st5 16
|
||||
reg: st6 17
|
||||
reg: st7 18
|
||||
# 19 is ? 20 is ?
|
||||
reg: xmm0 21
|
||||
reg: xmm1 22
|
||||
reg: xmm2 23
|
||||
reg: xmm3 24
|
||||
reg: xmm4 25
|
||||
reg: xmm5 26
|
||||
reg: xmm6 27
|
||||
reg: xmm7 28
|
||||
|
||||
reg: mm0 29
|
||||
reg: mm1 30
|
||||
reg: mm2 31
|
||||
reg: mm3 32
|
||||
reg: mm4 33
|
||||
reg: mm5 34
|
||||
reg: mm6 35
|
||||
reg: mm7 36
|
||||
|
||||
reg: fcw 37
|
||||
reg: fsw 38
|
||||
reg: mxcsr 39
|
||||
|
||||
reg: es 40
|
||||
reg: cs 41
|
||||
reg: ss 42
|
||||
reg: ds 43
|
||||
reg: fs 44
|
||||
reg: gs 45
|
||||
# 46 47 are ?
|
||||
reg: tr 48
|
||||
reg: ldtr 49
|
||||
|
||||
|
||||
endabi: x86
|
||||
|
||||
|
||||
beginabi: x86_64
|
||||
frame_interface: 3
|
||||
initial_reg_value: 1035 # DW_FRAME_SAME_VAL
|
||||
reg_table_size: 66 # more than large enough, hopefully.
|
||||
cfa_reg: 1436 # DW_FRAME_CFA_COL3
|
||||
same_val_reg: 1035
|
||||
undefined_val_reg: 1034
|
||||
|
||||
# The following register names are not necessarily correct...
|
||||
reg: rax 0
|
||||
reg: rdx 1
|
||||
reg: rcx 2
|
||||
reg: rbx 3
|
||||
reg: rsi 4
|
||||
reg: rdi 5
|
||||
reg: rbp 6
|
||||
reg: rsp 7
|
||||
reg: r8 8
|
||||
reg: r9 9
|
||||
reg: r10 10
|
||||
reg: r11 11
|
||||
reg: r12 12
|
||||
reg: r13 13
|
||||
reg: r14 14
|
||||
reg: r15 15
|
||||
reg: rip 16
|
||||
reg: xmm0 17
|
||||
reg: xmm1 18
|
||||
reg: xmm2 19
|
||||
reg: xmm3 20
|
||||
reg: xmm4 21
|
||||
reg: xmm5 22
|
||||
reg: xmm6 23
|
||||
reg: xmm7 24
|
||||
reg: xmm8 25
|
||||
reg: xmm9 26
|
||||
reg: xmm10 27
|
||||
reg: xmm11 28
|
||||
reg: xmm12 29
|
||||
reg: xmm13 30
|
||||
reg: xmm14 31
|
||||
reg: xmm15 32
|
||||
|
||||
reg: st0 33
|
||||
reg: st1 34
|
||||
reg: st2 35
|
||||
reg: st3 36
|
||||
reg: st4 37
|
||||
reg: st5 38
|
||||
reg: st6 39
|
||||
reg: st7 40
|
||||
|
||||
reg: mm0 41
|
||||
reg: mm1 42
|
||||
reg: mm2 43
|
||||
reg: mm3 44
|
||||
reg: mm4 45
|
||||
reg: mm5 46
|
||||
reg: mm6 47
|
||||
reg: mm7 48
|
||||
|
||||
reg: rflags 49
|
||||
reg: es 50
|
||||
reg: cs 51
|
||||
reg: ss 52
|
||||
reg: ds 53
|
||||
reg: fs 54
|
||||
reg: gs 55
|
||||
# 56, 57 are ?
|
||||
reg: fs.base 58
|
||||
reg: gs.base 59
|
||||
# 60 61 are ?
|
||||
reg: tr 62
|
||||
reg: ldtr 63
|
||||
|
||||
endabi: x86_64
|
||||
|
||||
beginabi: m68k
|
||||
frame_interface: 3
|
||||
initial_reg_value: 1035 # DW_FRAME_SAME_VAL
|
||||
reg_table_size: 66 # more than large enough, hopefully.
|
||||
cfa_reg: 1436 # DW_FRAME_CFA_COL3
|
||||
same_val_reg: 1035
|
||||
undefined_val_reg: 1034
|
||||
|
||||
reg: d0 0
|
||||
reg: d1 1
|
||||
reg: d2 2
|
||||
reg: d3 3
|
||||
reg: d4 4
|
||||
reg: d5 5
|
||||
reg: d6 6
|
||||
reg: d7 7
|
||||
|
||||
reg: a0 8
|
||||
reg: a1 9
|
||||
reg: a2 10
|
||||
reg: a3 11
|
||||
reg: a4 12
|
||||
reg: a5 13
|
||||
reg: a6 14
|
||||
reg: sp 15
|
||||
|
||||
reg: fp0 16
|
||||
reg: fp1 17
|
||||
reg: fp2 18
|
||||
reg: fp3 19
|
||||
reg: fp4 20
|
||||
reg: fp5 21
|
||||
reg: fp6 22
|
||||
reg: pc 23
|
||||
|
||||
endabi: m68k
|
||||
|
||||
# Demonstrates use of address_size and includeabi keywords.
|
||||
# address_size is useful when an Elf64 object has DWARF2
|
||||
# 32bit (4 byte) address-size frame data (which has no address_size field)
|
||||
# and no .debug_info section to provide the 32bit address size.
|
||||
beginabi: ppc32bitaddress
|
||||
address_size: 4
|
||||
includeabi: ppc
|
||||
endabi: ppc32bitaddress
|
||||
|
||||
beginabi: ppc
|
||||
# This abi defined Oct 2008 based on:
|
||||
# http://refspecs.linuxfoundation.org/ELF/ppc64/PPC-elf64abi-1.9.html
|
||||
frame_interface: 3
|
||||
# abi dwarf table uses up thru 1155.
|
||||
# As of Oct 2008, the only ABI requiring a higher
|
||||
# DW_FRAME_SAME_VAL and DW_FRAME_CFA_COL3.
|
||||
initial_reg_value: 1235 # DW_FRAME_SAME_VAL
|
||||
cfa_reg: 1436 # DW_FRAME_CFA_COL3
|
||||
same_val_reg: 1235
|
||||
undefined_val_reg: 1234
|
||||
reg_table_size: 1200
|
||||
|
||||
reg: r0 0
|
||||
reg: f0 32
|
||||
reg: f1 33
|
||||
reg: f2 34
|
||||
reg: f3 35
|
||||
reg: f4 36
|
||||
reg: f5 37
|
||||
reg: f6 38
|
||||
reg: f7 39
|
||||
reg: f8 40
|
||||
reg: f9 41
|
||||
reg: f10 42
|
||||
reg: f11 43
|
||||
reg: f12 44
|
||||
reg: f13 45
|
||||
reg: f14 46
|
||||
reg: f16 47
|
||||
reg: f17 48
|
||||
reg: f18 49
|
||||
reg: f19 50
|
||||
reg: f20 51
|
||||
reg: f21 52
|
||||
reg: f22 53
|
||||
reg: f23 54
|
||||
reg: f24 55
|
||||
reg: f25 56
|
||||
reg: f26 57
|
||||
reg: f27 58
|
||||
reg: f28 59
|
||||
reg: f29 60
|
||||
reg: f30 62
|
||||
reg: f31 63
|
||||
reg: cr 64
|
||||
reg: fpcsr 65
|
||||
# spr0 is also called MQ
|
||||
reg: spr0 100
|
||||
# spr1 is also called XER
|
||||
reg: spr1 101
|
||||
# spr4 also called rtcu
|
||||
reg: spr4 104
|
||||
# spr5 also called rtcl
|
||||
reg: spr5 105
|
||||
#spr8 also called LR
|
||||
reg: spr8 108
|
||||
# spr9 also called ctr
|
||||
reg: spr9 109
|
||||
reg: msr 66
|
||||
reg: sr0 70
|
||||
reg: sr1 71
|
||||
reg: sr2 72
|
||||
reg: sr3 73
|
||||
reg: sr4 74
|
||||
reg: sr5 75
|
||||
reg: sr6 76
|
||||
reg: sr7 77
|
||||
reg: sr8 78
|
||||
reg: sr9 79
|
||||
|
||||
#dsisr also called spr18
|
||||
reg: spr18 118
|
||||
# dar also called spr19
|
||||
reg: spr19 119
|
||||
#dec also called spr22
|
||||
reg: spr22 122
|
||||
#sdr1 also called spr25
|
||||
reg: spr25 125
|
||||
#srr0 also called spr26
|
||||
reg: spr26 126
|
||||
#srr1 also called spr27
|
||||
reg: spr27 127
|
||||
|
||||
#vrsave also called spr256
|
||||
reg: spr256 356
|
||||
#sprg0 also called spr272
|
||||
reg: spr272 372
|
||||
#sprg1 also called spr273
|
||||
reg: spr273 373
|
||||
#sprg2 also called spr274
|
||||
reg: spr274 374
|
||||
#sprg3 also called spr275
|
||||
reg: spr275 375
|
||||
#asr also called spr280
|
||||
reg: spr280 380
|
||||
#ear also called spr282
|
||||
reg: spr282 382
|
||||
#tb also called spr284
|
||||
reg: spr284 384
|
||||
#tbu also called spr285
|
||||
reg: spr285 385
|
||||
#pvr also called spr287
|
||||
reg: spr287 387
|
||||
#ibat0u also called spr528
|
||||
reg: spr528 628
|
||||
#ibat0l also called spr529
|
||||
reg: spr529 629
|
||||
#ibat1u also called spr530
|
||||
reg: spr530 630
|
||||
#ibat1l also called spr531
|
||||
reg: spr531 631
|
||||
#ibat2u also called spr532
|
||||
reg: spr532 632
|
||||
#ibat2l also called spr533
|
||||
reg: spr533 633
|
||||
#ibat3u also called spr534
|
||||
reg: spr534 634
|
||||
#ibat3l also called spr535
|
||||
reg: spr535 635
|
||||
#dbat0u also called spr536
|
||||
reg: spr536 636
|
||||
#dbat0l also called spr537
|
||||
reg: spr537 637
|
||||
#dbat1u also called spr538
|
||||
reg: spr538 638
|
||||
#dbat1l also called spr539
|
||||
reg: spr539 639
|
||||
#dbat2u also called spr540
|
||||
reg: spr540 640
|
||||
#dbat2l also called spr541
|
||||
reg: spr541 641
|
||||
#dbat3u also called spr542
|
||||
reg: spr542 642
|
||||
#dbat3l also called spr543
|
||||
reg: spr543 643
|
||||
|
||||
#hid0 also called spr1008
|
||||
reg: spr1008 1108
|
||||
#hid1 also called spr1009
|
||||
reg: spr1009 1109
|
||||
#hid2 also called iabr or spr1010
|
||||
reg: spr1010 1110
|
||||
#hid5 also called dabr or spr1013
|
||||
reg: spr1013 1113
|
||||
#hid15 also called pir or spr1023
|
||||
reg: spr1023 1123
|
||||
|
||||
# vector registers 0-31
|
||||
reg: vr0 1124
|
||||
reg: vr1 1125
|
||||
reg: vr2 1126
|
||||
reg: vr3 1127
|
||||
reg: vr4 1128
|
||||
reg: vr5 1129
|
||||
reg: vr6 1130
|
||||
reg: vr7 1131
|
||||
reg: vr8 1132
|
||||
reg: vr9 1133
|
||||
reg: vr10 1134
|
||||
reg: vr11 1135
|
||||
reg: vr12 1136
|
||||
reg: vr13 1137
|
||||
reg: vr14 1138
|
||||
reg: vr15 1130
|
||||
reg: vr16 1140
|
||||
reg: vr17 1141
|
||||
reg: vr18 1142
|
||||
reg: vr19 1143
|
||||
reg: vr20 1144
|
||||
reg: vr21 1145
|
||||
reg: vr22 1146
|
||||
reg: vr23 1147
|
||||
reg: vr24 1148
|
||||
reg: vr25 1149
|
||||
reg: vr26 1150
|
||||
reg: vr27 1151
|
||||
reg: vr28 1152
|
||||
reg: vr29 1153
|
||||
reg: vr30 1154
|
||||
reg: vr31 1155
|
||||
endabi: ppc
|
||||
|
||||
# 'Generic 1000 register abi'.
|
||||
# This is useful as a 'general' ABI settings for
|
||||
# cpus using up to 1000 registers. The register names
|
||||
# show as a number, like 'r991'.
|
||||
beginabi: generic
|
||||
frame_interface: 3
|
||||
initial_reg_value: 1035 # DW_FRAME_SAME_VAL
|
||||
cfa_reg: 1436 # DW_FRAME_CFA_COL3
|
||||
reg_table_size: 1000
|
||||
same_val_reg: 1035
|
||||
undefined_val_reg: 1034
|
||||
reg: r0 0
|
||||
endabi: generic
|
||||
|
||||
# 'Generic 500 register abi'.
|
||||
# This is useful as a 'general' ABI settings for
|
||||
# cpus using up to 500 registers. The register names
|
||||
# show as a number, like 'r91'.
|
||||
beginabi: generic500
|
||||
frame_interface: 3
|
||||
initial_reg_value: 1035 # DW_FRAME_SAME_VAL
|
||||
cfa_reg: 1436 # DW_FRAME_CFA_COL3
|
||||
reg_table_size: 500
|
||||
same_val_reg: 1035
|
||||
undefined_val_reg: 1034
|
||||
reg: r0 0
|
||||
endabi: generic500
|
||||
|
||||
# 'Generic 100 register abi'.
|
||||
# This is useful as a 'general' ABI settings for
|
||||
# cpus using up to 100 registers. The register names
|
||||
# show as a number, like 'r91'.
|
||||
beginabi: generic100
|
||||
frame_interface: 3
|
||||
initial_reg_value: 1035 # DW_FRAME_SAME_VAL
|
||||
cfa_reg: 1436 # DW_FRAME_CFA_COL3
|
||||
reg_table_size: 100
|
||||
same_val_reg: 1035
|
||||
undefined_val_reg: 1034
|
||||
reg: r0 0
|
||||
endabi: generic100
|
||||
|
||||
|
||||
beginabi: arm
|
||||
frame_interface: 3
|
||||
# When using frame_interface: 3 the size of the register
|
||||
# table is not fixed. It can be as large as needed.
|
||||
reg_table_size: 288
|
||||
cfa_reg: 1436 # DW_FRAME_CFA_COL3
|
||||
initial_reg_value: 1034
|
||||
same_val_reg: 1035
|
||||
undefined_val_reg: 1034
|
||||
# If the vendor co-processor registers are allowed
|
||||
# or other numbers above 287 used then
|
||||
# the reg_table_size must be increased and (possibly)
|
||||
# the cfa, same_value, undefined_value reg values changed
|
||||
# here.
|
||||
# r0-r15 are 0 through 15.
|
||||
# Numbers 16 through 63 had meaning
|
||||
# in some ARM DWARF register mappings.
|
||||
reg: s0 64
|
||||
reg: s1 65
|
||||
reg: s2 66
|
||||
reg: s3 67
|
||||
reg: s4 68
|
||||
reg: s5 69
|
||||
reg: s6 70
|
||||
reg: s7 71
|
||||
reg: s8 72
|
||||
reg: s9 73
|
||||
reg: s10 74
|
||||
reg: s11 75
|
||||
reg: s12 76
|
||||
reg: s13 77
|
||||
reg: s14 78
|
||||
reg: s15 79
|
||||
reg: s16 80
|
||||
reg: s17 81
|
||||
reg: s18 82
|
||||
reg: s19 83
|
||||
reg: s20 84
|
||||
reg: s21 85
|
||||
reg: s22 86
|
||||
reg: s23 87
|
||||
reg: s24 88
|
||||
reg: s25 89
|
||||
reg: s26 90
|
||||
reg: s27 91
|
||||
reg: s28 92
|
||||
reg: s29 93
|
||||
reg: s30 94
|
||||
reg: s31 95
|
||||
reg: f0 96
|
||||
reg: f1 97
|
||||
reg: f2 98
|
||||
reg: f3 99
|
||||
reg: f4 100
|
||||
reg: f5 101
|
||||
reg: f6 102
|
||||
reg: f7 103
|
||||
reg: wcgr0 104
|
||||
reg: wcgr0 105
|
||||
reg: wcgr0 106
|
||||
reg: wcgr0 107
|
||||
reg: wcgr0 108
|
||||
reg: wcgr0 109
|
||||
reg: wcgr0 110
|
||||
reg: wcgr0 111
|
||||
reg: wr0 112
|
||||
reg: wr1 113
|
||||
reg: wr2 114
|
||||
reg: wr3 115
|
||||
reg: wr4 116
|
||||
reg: wr5 117
|
||||
reg: wr6 118
|
||||
reg: wr7 119
|
||||
reg: wr8 120
|
||||
reg: wr9 121
|
||||
reg: wr10 122
|
||||
reg: wr11 123
|
||||
reg: wr12 124
|
||||
reg: wr13 125
|
||||
reg: wr14 126
|
||||
reg: wr15 127
|
||||
reg: spsr 128
|
||||
reg: spsr_fiq 129
|
||||
reg: spsr_irq 130
|
||||
reg: spsr_abt 131
|
||||
reg: spsr_und 132
|
||||
reg: spsr_svc 133
|
||||
reg: r8_usr 144
|
||||
reg: r9_usr 145
|
||||
reg: r10_usr 146
|
||||
reg: r11_usr 147
|
||||
reg: r12_usr 148
|
||||
reg: r13_usr 149
|
||||
reg: r14_usr 150
|
||||
reg: r8_fiq 151
|
||||
reg: r9_fiq 152
|
||||
reg: r10_fiq 153
|
||||
reg: r11_fiq 154
|
||||
reg: r12_fiq 155
|
||||
reg: r13_fiq 156
|
||||
reg: r14_fiq 157
|
||||
reg: r13_riq 158
|
||||
reg: r14_riq 159
|
||||
reg: r14_abt 160
|
||||
reg: r13_abt 161
|
||||
reg: r14_und 162
|
||||
reg: r13_und 163
|
||||
reg: r14_svc 164
|
||||
reg: r13_svc 165
|
||||
reg: wc0 192
|
||||
reg: wc1 193
|
||||
reg: wc2 192
|
||||
reg: wc3 192
|
||||
reg: wc4 192
|
||||
reg: wc5 197
|
||||
reg: wc6 198
|
||||
reg: wc7 199
|
||||
reg: d0 256
|
||||
reg: d1 257
|
||||
reg: d2 258
|
||||
reg: d3 259
|
||||
reg: d4 260
|
||||
reg: d5 261
|
||||
reg: d6 262
|
||||
reg: d7 263
|
||||
reg: d8 264
|
||||
reg: d9 265
|
||||
reg: d10 266
|
||||
reg: d11 267
|
||||
reg: d12 268
|
||||
reg: d13 269
|
||||
reg: d14 270
|
||||
reg: d15 271
|
||||
reg: d16 272
|
||||
reg: d17 273
|
||||
reg: d18 274
|
||||
reg: d19 275
|
||||
reg: d20 266
|
||||
reg: d21 277
|
||||
reg: d22 278
|
||||
reg: d23 279
|
||||
reg: d24 280
|
||||
reg: d25 281
|
||||
reg: d26 282
|
||||
reg: d27 283
|
||||
reg: d28 284
|
||||
reg: d29 285
|
||||
reg: d30 286
|
||||
reg: d31 287
|
||||
# End of abi definition.
|
||||
endabi: arm
|
||||
|
1423
dwarf-compilation.base/contrib/libdwarf/dwarfdump/dwconf.c
Normal file
1423
dwarf-compilation.base/contrib/libdwarf/dwarfdump/dwconf.c
Normal file
File diff suppressed because it is too large
Load diff
97
dwarf-compilation.base/contrib/libdwarf/dwarfdump/dwconf.h
Normal file
97
dwarf-compilation.base/contrib/libdwarf/dwarfdump/dwconf.h
Normal file
|
@ -0,0 +1,97 @@
|
|||
/*
|
||||
Copyright (C) 2006 Silicon Graphics, Inc. All Rights Reserved.
|
||||
Portions Copyright 2011 David Anderson. All Rights Reserved.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of version 2 of the GNU General Public License as
|
||||
published by the Free Software Foundation.
|
||||
|
||||
This program is distributed in the hope that it would be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
Further, this software is distributed without any warranty that it is
|
||||
free of the rightful claim of any third person regarding infringement
|
||||
or the like. Any license provided herein, whether implied or
|
||||
otherwise, applies only to this software file. Patent licenses, if
|
||||
any, provided herein do not apply to combinations of this program with
|
||||
other software, or any other product whatsoever.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write the Free Software Foundation, Inc., 51
|
||||
Franklin Street - Fifth Floor, Boston MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
|
||||
/* Declarations helping configure the frame reader.
|
||||
We are not allowing negative register numbers.
|
||||
Which could be allowed if necessary with a little work. */
|
||||
struct dwconf_s {
|
||||
char *cf_config_file_path;
|
||||
char *cf_abi_name;
|
||||
|
||||
/* 2 for old, 3 for frame interface 3. 2 means use the old
|
||||
mips-abi-oriented frame interface. 3 means use the new
|
||||
DWARF3-capable and configureable-abi interface.
|
||||
|
||||
Now, anyone who revises dwarf.h and libdwarf.h to match their
|
||||
abi-of-interest will still be able to use cf_interface_number 2
|
||||
as before. But most folks don't update those header files and
|
||||
instead of making *them* configurable we make dwarfdump (and
|
||||
libdwarf) configurable sufficiently to print frame information
|
||||
sensibly. */
|
||||
int cf_interface_number;
|
||||
|
||||
/* The number of table rules , aka columns. For MIPS/IRIX is 66. */
|
||||
unsigned long cf_table_entry_count;
|
||||
|
||||
/* Array of cf_table_entry_count reg names. Names not filled in
|
||||
from dwarfdump.conf have NULL (0) pointer value.
|
||||
cf_named_regs_table_size must match size of cf_regs array.
|
||||
Set cf_regs_malloced 1 if table was malloced. Set 0
|
||||
if static.
|
||||
*/
|
||||
char **cf_regs;
|
||||
unsigned long cf_named_regs_table_size;
|
||||
unsigned cf_regs_malloced;
|
||||
|
||||
/* The 'default initial value' when intializing a table. for MIPS
|
||||
is DW_FRAME_SAME_VAL(1035). For other ISA/ABIs may be
|
||||
DW_FRAME_UNDEFINED_VAL(1034). */
|
||||
unsigned cf_initial_rule_value;
|
||||
unsigned cf_same_val;
|
||||
unsigned cf_undefined_val;
|
||||
|
||||
/* The number of the cfa 'register'. For cf_interface_number 2 of
|
||||
MIPS this is 0. For other architectures (and anytime using
|
||||
cf_interface_number 3) this should be outside the table, a
|
||||
special value such as 1436, not a table column at all). */
|
||||
unsigned cf_cfa_reg;
|
||||
|
||||
/* If non-zero it is the number of bytes in an address
|
||||
for the frame data. Normally it will be zero because
|
||||
there are usually other sources for the correct address size.
|
||||
However, with DWARF2 frame data there is no explicit address
|
||||
size in the frame data and the object file might not have
|
||||
other .debug_ sections to work with.
|
||||
If zero, no address size was supplied, and that is normal and
|
||||
the already-set (or defaulted) address size is to be used.
|
||||
Only an exceptional frame configure will specify address
|
||||
size here. This won't work at all if the object needing
|
||||
this setting has different address size in different CUs. */
|
||||
unsigned cf_address_size;
|
||||
};
|
||||
|
||||
|
||||
/* Returns DW_DLV_OK if works. DW_DLV_ERROR if cannot do what is asked. */
|
||||
int find_conf_file_and_read_config(const char *named_file,
|
||||
const char *named_abi, char **defaults,
|
||||
struct dwconf_s *conf_out);
|
||||
void init_conf_file_data(struct dwconf_s *config_file_data);
|
||||
void init_mips_conf_file_data(struct dwconf_s *config_file_data);
|
||||
|
||||
void print_reg_from_config_data(Dwarf_Unsigned reg,
|
||||
struct dwconf_s *config_data);
|
||||
|
||||
|
||||
void init_generic_config_1200_regs(struct dwconf_s *conf);
|
331
dwarf-compilation.base/contrib/libdwarf/dwarfdump/dwgetopt.c
Normal file
331
dwarf-compilation.base/contrib/libdwarf/dwarfdump/dwgetopt.c
Normal file
|
@ -0,0 +1,331 @@
|
|||
/* $NetBSD: getopt.c,v 1.1 2009/03/22 22:33:13 joerg Exp $*/
|
||||
/* Modified by David Anderson to work with GNU/Linux and freebsd.
|
||||
Added {} for clarity.
|
||||
Switched to standard dwarfdump formatting.
|
||||
Treatment of : modified so that :: gets dwoptarg NULL
|
||||
if space follows the letter
|
||||
(the dwoptarg is set to null).
|
||||
renamed to make it clear this is a private version.
|
||||
Oct 17 2017: Created dwgetopt_long(). See dwgetopt.h
|
||||
*/
|
||||
/*
|
||||
* Copyright (c) 1987, 1993, 1994
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
/* This does not presently handle the option string
|
||||
leading + or leading - features. Such are not used
|
||||
by by libdwarfdump. Nor does it understand the
|
||||
GNU Env var POSIXLY_CORRECT .
|
||||
It does know of the leading ":" in the option string.
|
||||
See BADCH below.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h> /* For exit() */
|
||||
#include <string.h> /* For strchr */
|
||||
#include "dwgetopt.h"
|
||||
|
||||
#define STRIP_OFF_CONSTNESS(a) ((void *)(size_t)(const void *)(a))
|
||||
|
||||
int dwopterr = 1, /* if error message should be printed */
|
||||
dwoptind = 1, /* index into parent argv vector */
|
||||
dwoptopt, /* character checked for validity */
|
||||
dwoptreset; /* reset getopt */
|
||||
char *dwoptarg; /* argument associated with option */
|
||||
|
||||
#define BADCH (int)'?'
|
||||
#define BADARG (int)':'
|
||||
#define EMSG ""
|
||||
|
||||
#define TRUE 1
|
||||
#define FALSE 0
|
||||
|
||||
#if 0 /* FOR DEBUGGING ONLY */
|
||||
/* Use for testing dwgetopt only.
|
||||
Not a standard function. */
|
||||
void
|
||||
dwgetoptresetfortestingonly(void)
|
||||
{
|
||||
dwopterr = 1;
|
||||
dwoptind = 1;
|
||||
dwoptopt = 0;
|
||||
dwoptreset = 0;
|
||||
dwoptarg = 0;
|
||||
}
|
||||
#endif /* FOR DEBUGGING ONLY */
|
||||
|
||||
|
||||
static const char *place = EMSG;/* option letter processing */
|
||||
|
||||
|
||||
static int dwoptnamematches(
|
||||
const struct dwoption *dwlopt,
|
||||
const char *iplace,
|
||||
const char **argloc,
|
||||
int *argerr)
|
||||
{
|
||||
|
||||
const char *eq = 0;
|
||||
unsigned namelen = 0;
|
||||
unsigned arglen = 0;
|
||||
int d = 0;
|
||||
|
||||
for(eq = iplace; *eq; ++eq) {
|
||||
if (*eq != '=') {
|
||||
continue;
|
||||
}
|
||||
/* Found =, arg should follow */
|
||||
namelen = (eq - iplace);
|
||||
if (namelen != (unsigned)strlen(dwlopt->name)) {
|
||||
return FALSE;
|
||||
}
|
||||
eq++;
|
||||
arglen = strlen(eq);
|
||||
break;
|
||||
}
|
||||
if (namelen) {
|
||||
d = strncmp(iplace,dwlopt->name,namelen);
|
||||
if (d) {
|
||||
return FALSE;
|
||||
}
|
||||
if (dwlopt->has_arg == 0) {
|
||||
*argerr = TRUE;
|
||||
return TRUE;
|
||||
}
|
||||
if (arglen) {
|
||||
/* Discarding const, avoiding warning.
|
||||
Data is in user space, so this is ok. */
|
||||
dwoptarg = (char *)eq;
|
||||
*argloc = (const char *)eq;
|
||||
} else {
|
||||
/* Has arg = but arg is empty. */
|
||||
dwoptarg = 0;
|
||||
}
|
||||
return TRUE;
|
||||
} else {
|
||||
d = strcmp(iplace,dwlopt->name);
|
||||
if (d) {
|
||||
return FALSE;
|
||||
}
|
||||
if (dwlopt->has_arg == 1) {
|
||||
*argerr = TRUE;
|
||||
return TRUE;
|
||||
}
|
||||
dwoptarg = 0;
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* dwgetopt_long
|
||||
A reimplemenation of a portion of
|
||||
the getopt(3) GNU/Linux getopt_long().
|
||||
See dwgetopt.h for more details.
|
||||
*/
|
||||
int dwgetopt_long(int nargc, char *const nargv[],
|
||||
const char *ostr,
|
||||
const struct dwoption* longopts,
|
||||
int *longindex)
|
||||
{
|
||||
char *lplace = 0;
|
||||
if (dwoptreset) {
|
||||
/* Not really supported. */
|
||||
place = EMSG;
|
||||
return (-1);
|
||||
}
|
||||
if (*place) {
|
||||
int v = dwgetopt(nargc,nargv,ostr);
|
||||
return v;
|
||||
}
|
||||
/* Use local lplace in case we need to call getopt()
|
||||
just below. */
|
||||
lplace = nargv[dwoptind];
|
||||
if (dwoptind >= nargc || *lplace++ != '-') {
|
||||
/* Argument is absent or is not an option */
|
||||
place = EMSG;
|
||||
return (-1);
|
||||
}
|
||||
if (*lplace != '-') {
|
||||
/* Notice place not disturbed. */
|
||||
int v = dwgetopt(nargc,nargv,ostr);
|
||||
return v;
|
||||
}
|
||||
/* Starts with two dashes.
|
||||
Now we set the global place */
|
||||
place = lplace+1;
|
||||
if (!*place) {
|
||||
/* "--" => end of options */
|
||||
++dwoptind;
|
||||
place = EMSG;
|
||||
return (-1);
|
||||
}
|
||||
|
||||
/* We think this is a longopt. */
|
||||
{
|
||||
int lo_num = 0;
|
||||
|
||||
for(;;lo_num++) {
|
||||
const struct dwoption *dwlopt = longopts +lo_num;
|
||||
const char * argloc = 0;
|
||||
int argerr = 0;
|
||||
if (!dwlopt->name) {
|
||||
dwoptind++;
|
||||
place = EMSG;
|
||||
return (-1);
|
||||
}
|
||||
if (dwoptnamematches(dwlopt,place,&argloc,&argerr)) {
|
||||
*longindex = lo_num;
|
||||
dwoptarg = 0;
|
||||
if (argloc) {
|
||||
/* Must drop const here. Ugh. */
|
||||
dwoptarg = (char *)argloc;
|
||||
}
|
||||
dwoptind++;
|
||||
place = EMSG;
|
||||
return dwlopt->val;
|
||||
}
|
||||
if (argerr) {
|
||||
place = EMSG;
|
||||
dwoptind++;
|
||||
return (-1);
|
||||
}
|
||||
}
|
||||
place = EMSG;
|
||||
dwoptind++;
|
||||
return (-1);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* getopt --
|
||||
* Parse argc/argv argument vector.
|
||||
* a: means
|
||||
* -afoo
|
||||
* -a foo
|
||||
* and 'foo' is returned in dwoptarg
|
||||
* b:: means
|
||||
* -b
|
||||
* and dwoptarg is null
|
||||
* -bother
|
||||
* and dwoptarg is 'other'
|
||||
*/
|
||||
int
|
||||
dwgetopt(int nargc, char * const nargv[], const char *ostr)
|
||||
{
|
||||
char *oli; /* option letter list index */
|
||||
|
||||
if (dwoptreset || *place == 0) { /* update scanning pointer */
|
||||
dwoptreset = 0;
|
||||
place = nargv[dwoptind];
|
||||
|
||||
if (dwoptind >= nargc || *place++ != '-') {
|
||||
/* Argument is absent or is not an option */
|
||||
place = EMSG;
|
||||
return (-1);
|
||||
}
|
||||
dwoptopt = *place++;
|
||||
if (dwoptopt == '-' && *place == 0) {
|
||||
/* "--" => end of options */
|
||||
++dwoptind;
|
||||
place = EMSG;
|
||||
return (-1);
|
||||
}
|
||||
if (dwoptopt == 0) {
|
||||
/* Solitary '-', treat as a '-' option
|
||||
if the program (eg su) is looking for it. */
|
||||
place = EMSG;
|
||||
if (strchr(ostr, '-') == NULL) {
|
||||
return -1;
|
||||
}
|
||||
dwoptopt = '-';
|
||||
}
|
||||
} else {
|
||||
dwoptopt = *place++;
|
||||
}
|
||||
/* See if option letter is one the caller wanted... */
|
||||
if (dwoptopt == ':' || (oli = strchr(ostr, dwoptopt)) == NULL) {
|
||||
if (*place == 0) {
|
||||
++dwoptind;
|
||||
}
|
||||
if (dwopterr && *ostr != ':') {
|
||||
(void)fprintf(stderr,
|
||||
"%s: invalid option -- '%c'\n",
|
||||
nargv[0]?nargv[0]:"",
|
||||
dwoptopt);
|
||||
}
|
||||
return (BADCH);
|
||||
}
|
||||
|
||||
/* Does this option need an argument? */
|
||||
if (oli[1] != ':') {
|
||||
/* don't need argument */
|
||||
dwoptarg = NULL;
|
||||
if (*place == 0) {
|
||||
++dwoptind;
|
||||
}
|
||||
} else {
|
||||
int reqnextarg = 1;
|
||||
if (oli[1] && (oli[2] == ':')) {
|
||||
/* Pair of :: means special treatment of dwoptarg */
|
||||
reqnextarg = 0;
|
||||
}
|
||||
/* Option-argument is either the rest of this argument or the
|
||||
entire next argument. */
|
||||
if (*place ) {
|
||||
/* Whether : or :: */
|
||||
dwoptarg = STRIP_OFF_CONSTNESS(place);
|
||||
} else if (reqnextarg) {
|
||||
/* ! *place */
|
||||
if (nargc > (++dwoptind)) {
|
||||
dwoptarg = nargv[dwoptind];
|
||||
} else {
|
||||
place=EMSG;
|
||||
/* Next arg required, but is missing */
|
||||
if (*ostr == ':') {
|
||||
/* Leading : in ostr calls for BADARG return. */
|
||||
return (BADARG);
|
||||
}
|
||||
if (dwopterr) {
|
||||
(void)fprintf(stderr,
|
||||
"%s: option requires an argument. -- '%c'\n",
|
||||
nargv[0]?nargv[0]:"",
|
||||
dwoptopt);
|
||||
}
|
||||
return (BADCH);
|
||||
}
|
||||
} else {
|
||||
/* ! *place */
|
||||
/* The key part of :: treatment. */
|
||||
dwoptarg = NULL;
|
||||
}
|
||||
place = EMSG;
|
||||
++dwoptind;
|
||||
}
|
||||
return (dwoptopt); /* return option letter */
|
||||
}
|
85
dwarf-compilation.base/contrib/libdwarf/dwarfdump/dwgetopt.h
Normal file
85
dwarf-compilation.base/contrib/libdwarf/dwarfdump/dwgetopt.h
Normal file
|
@ -0,0 +1,85 @@
|
|||
/* $NetBSD: getopt.c,v 1.1 2009/03/22 22:33:13 joerg Exp $*/
|
||||
/* Modified by David Anderson to work with GNU/Linux and freebsd.
|
||||
Added {} for clarity.
|
||||
Switched to standard dwarfdump formatting.
|
||||
Treatment of : modified so that :: gets dwoptarg NULL
|
||||
if space follows the letter
|
||||
(the dwoptarg is set to null).
|
||||
*/
|
||||
/*
|
||||
* Copyright (c) 1987, 1993, 1994
|
||||
* The Regents of the University of California. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* 3. Neither the name of the University nor the names of its contributors
|
||||
* may be used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
|
||||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
|
||||
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
||||
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
||||
* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
||||
* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
extern int dwopterr;
|
||||
extern int dwoptind;
|
||||
extern int dwoptopt;
|
||||
extern int dwoptreset;
|
||||
extern char *dwoptarg;
|
||||
|
||||
int dwgetopt(int nargc, char * const nargv[], const char *ostr);
|
||||
|
||||
/* As of October 2017 it seems adviseable to allow
|
||||
long option names. So based on a reading of
|
||||
'man 3 getopt' we reimplement a portion of GNU getopt_long().
|
||||
It's a wonderfully sensible design and all the credit
|
||||
should go to the original designers.
|
||||
We are not implementing all the features of GNU/Linux
|
||||
getopt_long(), just the features we wish to use.
|
||||
Specifically, we require val be 0 and flag
|
||||
be NULL and ignore those fields.
|
||||
We do not implement GNU digit_optind at all.
|
||||
Within these restrictions the interface behaves the same
|
||||
as GNU getopt_long() (or so it appears from the
|
||||
getopt documentation:
|
||||
release 4.04 of the Linux man-pages project,
|
||||
GETOPT(3),
|
||||
http://www.kernel.org/doc/man-pages/).
|
||||
*/
|
||||
|
||||
struct dwoption {
|
||||
const char *name;
|
||||
int has_arg;
|
||||
int *flag;
|
||||
int val;
|
||||
};
|
||||
#define dwno_argument 0
|
||||
#define dwrequired_argument 1
|
||||
#define dwoptional_argument 2
|
||||
|
||||
int dwgetopt_long(int nargc, char *const nargv[],
|
||||
const char *ostr,
|
||||
const struct dwoption* longopts,
|
||||
int *longindex);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
512
dwarf-compilation.base/contrib/libdwarf/dwarfdump/esb.c
Normal file
512
dwarf-compilation.base/contrib/libdwarf/dwarfdump/esb.c
Normal file
|
@ -0,0 +1,512 @@
|
|||
/*
|
||||
Copyright (C) 2005 Silicon Graphics, Inc. All Rights Reserved.
|
||||
Portions Copyright (C) 2013-2017 David Anderson. All Rights Reserved.
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of version 2 of the GNU General Public License as
|
||||
published by the Free Software Foundation.
|
||||
|
||||
This program is distributed in the hope that it would be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
Further, this software is distributed without any warranty that it is
|
||||
free of the rightful claim of any third person regarding infringement
|
||||
or the like. Any license provided herein, whether implied or
|
||||
otherwise, applies only to this software file. Patent licenses, if
|
||||
any, provided herein do not apply to combinations of this program with
|
||||
other software, or any other product whatsoever.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write the Free Software Foundation, Inc., 51
|
||||
Franklin Street - Fifth Floor, Boston MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
/* esb.c
|
||||
extensible string buffer.
|
||||
|
||||
A simple means (vaguely like a C++ class) that
|
||||
enables safely saving strings of arbitrary length built up
|
||||
in small pieces.
|
||||
|
||||
We really do allow only C strings here. NUL bytes
|
||||
in a string result in adding only up to the NUL (and
|
||||
in the case of certain interfaces here a warning
|
||||
to stderr).
|
||||
|
||||
Do selftest as follows:
|
||||
gcc -DSELFTEST esb.c
|
||||
./a.out
|
||||
valgrind --leak-check=full ./a.out
|
||||
|
||||
The functions assume that
|
||||
pointer arguments of all kinds are not NULL.
|
||||
*/
|
||||
|
||||
#ifndef SELFTEST
|
||||
#include "globals.h"
|
||||
#else
|
||||
#include <stdio.h> /* SELFTEST */
|
||||
#include <string.h> /* SELFTEST */
|
||||
#include <stdlib.h> /* SELFTEST */
|
||||
typedef char * string; /* SELFTEST */
|
||||
#include <stdarg.h> /* For va_start va_arg va_list */
|
||||
#endif
|
||||
#include "esb.h"
|
||||
|
||||
/* INITIAL_ALLOC value takes no account of space for a trailing NUL,
|
||||
the NUL is accounted for in init_esb_string
|
||||
and in later tests against esb_allocated_size. */
|
||||
#ifdef SELFTEST
|
||||
#define INITIAL_ALLOC 1 /* SELFTEST */
|
||||
#else
|
||||
/* There is nothing magic about this size.
|
||||
It is just big enough to avoid most resizing. */
|
||||
#define INITIAL_ALLOC 16
|
||||
#endif
|
||||
/* Allow for final NUL */
|
||||
static size_t alloc_size = INITIAL_ALLOC;
|
||||
|
||||
/* NULL device used when printing formatted strings */
|
||||
static FILE *null_device_handle = 0;
|
||||
#if _WIN32
|
||||
#define NULL_DEVICE_NAME "NUL"
|
||||
#else
|
||||
#define NULL_DEVICE_NAME "/dev/null"
|
||||
#endif /* _WIN32 */
|
||||
|
||||
/* Open the null device used during formatting printing */
|
||||
FILE *esb_open_null_device(void)
|
||||
{
|
||||
if (!null_device_handle) {
|
||||
null_device_handle = fopen(NULL_DEVICE_NAME,"w");
|
||||
}
|
||||
return null_device_handle;
|
||||
}
|
||||
|
||||
/* Close the null device used during formatting printing */
|
||||
void esb_close_null_device(void)
|
||||
{
|
||||
if (null_device_handle) {
|
||||
fclose(null_device_handle);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
init_esb_string(struct esb_s *data, size_t min_len)
|
||||
{
|
||||
char* d;
|
||||
|
||||
if (data->esb_allocated_size > 0) {
|
||||
return;
|
||||
}
|
||||
/* Only esb_constructor applied. Allow for string space. */
|
||||
if (min_len <= alloc_size) {
|
||||
min_len = alloc_size +1;/* Allow for NUL at end */
|
||||
} else {
|
||||
min_len++ ; /* Allow for NUL at end */
|
||||
}
|
||||
d = malloc(min_len);
|
||||
if (!d) {
|
||||
fprintf(stderr,
|
||||
"dwarfdump is out of memory allocating %lu bytes\n",
|
||||
(unsigned long) min_len);
|
||||
exit(5);
|
||||
}
|
||||
data->esb_string = d;
|
||||
data->esb_allocated_size = min_len;
|
||||
data->esb_string[0] = 0;
|
||||
data->esb_used_bytes = 0;
|
||||
}
|
||||
|
||||
/* Make more room. Leaving contents unchanged, effectively.
|
||||
The NUL byte at end has room and this preserves that room.
|
||||
*/
|
||||
static void
|
||||
esb_allocate_more(struct esb_s *data, size_t len)
|
||||
{
|
||||
size_t new_size = data->esb_allocated_size + len;
|
||||
char* newd = 0;
|
||||
|
||||
if (new_size < alloc_size) {
|
||||
new_size = alloc_size;
|
||||
}
|
||||
newd = realloc(data->esb_string, new_size);
|
||||
if (!newd) {
|
||||
fprintf(stderr, "dwarfdump is out of memory re-allocating "
|
||||
"%lu bytes\n", (unsigned long) new_size);
|
||||
exit(5);
|
||||
}
|
||||
/* If the area was reallocated by realloc() the earlier
|
||||
space was free()d by realloc(). */
|
||||
data->esb_string = newd;
|
||||
data->esb_allocated_size = new_size;
|
||||
}
|
||||
|
||||
/* Ensure that the total buffer length is large enough that
|
||||
at least minlen bytes are available, unused,
|
||||
in the allocation. */
|
||||
void
|
||||
esb_force_allocation(struct esb_s *data, size_t minlen)
|
||||
{
|
||||
if (data->esb_allocated_size < (data->esb_used_bytes + minlen)) {
|
||||
esb_allocate_more(data,minlen);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
esb_appendn_internal(struct esb_s *data, const char * in_string, size_t len);
|
||||
|
||||
void
|
||||
esb_appendn(struct esb_s *data, const char * in_string, size_t len)
|
||||
{
|
||||
size_t full_len = strlen(in_string);
|
||||
|
||||
if (full_len < len) {
|
||||
fprintf(stderr, "dwarfdump esb internal error, bad string length "
|
||||
" %lu < %lu \n",
|
||||
(unsigned long) full_len, (unsigned long) len);
|
||||
len = full_len;
|
||||
}
|
||||
|
||||
esb_appendn_internal(data, in_string, len);
|
||||
}
|
||||
|
||||
/* The length is gotten from the in_string itself. */
|
||||
void
|
||||
esb_append(struct esb_s *data, const char * in_string)
|
||||
{
|
||||
size_t len = 0;
|
||||
if(in_string) {
|
||||
len = strlen(in_string);
|
||||
if (len) {
|
||||
esb_appendn_internal(data, in_string, len);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* The 'len' is believed. Do not pass in strings < len bytes long. */
|
||||
static void
|
||||
esb_appendn_internal(struct esb_s *data, const char * in_string, size_t len)
|
||||
{
|
||||
size_t remaining = 0;
|
||||
size_t needed = len;
|
||||
|
||||
if (data->esb_allocated_size == 0) {
|
||||
size_t maxlen = (len >= alloc_size)? (len):alloc_size;
|
||||
|
||||
init_esb_string(data, maxlen);
|
||||
}
|
||||
/* ASSERT: data->esb_allocated_size > data->esb_used_bytes */
|
||||
remaining = data->esb_allocated_size - data->esb_used_bytes;
|
||||
if (remaining <= needed) {
|
||||
esb_allocate_more(data,len);
|
||||
}
|
||||
strncpy(&data->esb_string[data->esb_used_bytes], in_string, len);
|
||||
data->esb_used_bytes += len;
|
||||
/* Insist on explicit NUL terminator */
|
||||
data->esb_string[data->esb_used_bytes] = 0;
|
||||
}
|
||||
|
||||
/* Always returns an empty string or a non-empty string. Never 0. */
|
||||
char*
|
||||
esb_get_string(struct esb_s *data)
|
||||
{
|
||||
if (data->esb_allocated_size == 0) {
|
||||
init_esb_string(data, alloc_size);
|
||||
}
|
||||
return data->esb_string;
|
||||
}
|
||||
|
||||
|
||||
/* Sets esb_used_bytes to zero. The string is not freed and
|
||||
esb_allocated_size is unchanged. */
|
||||
void
|
||||
esb_empty_string(struct esb_s *data)
|
||||
{
|
||||
if (data->esb_allocated_size == 0) {
|
||||
init_esb_string(data, alloc_size);
|
||||
}
|
||||
data->esb_used_bytes = 0;
|
||||
data->esb_string[0] = 0;
|
||||
}
|
||||
|
||||
|
||||
/* Return esb_used_bytes. */
|
||||
size_t
|
||||
esb_string_len(struct esb_s *data)
|
||||
{
|
||||
return data->esb_used_bytes;
|
||||
}
|
||||
|
||||
/* *data is presumed to contain garbage, not values, and
|
||||
is properly initialized here. */
|
||||
void
|
||||
esb_constructor(struct esb_s *data)
|
||||
{
|
||||
memset(data, 0, sizeof(*data));
|
||||
}
|
||||
|
||||
/* The string is freed, contents of *data set to zeroes. */
|
||||
void
|
||||
esb_destructor(struct esb_s *data)
|
||||
{
|
||||
if (data->esb_string) {
|
||||
free(data->esb_string);
|
||||
data->esb_string = 0;
|
||||
}
|
||||
esb_constructor(data);
|
||||
}
|
||||
|
||||
|
||||
/* To get all paths in the code tested, this sets the
|
||||
allocation/reallocation to the given value, which can be quite small
|
||||
but must not be zero. */
|
||||
void
|
||||
esb_alloc_size(size_t size)
|
||||
{
|
||||
alloc_size = size;
|
||||
}
|
||||
|
||||
size_t
|
||||
esb_get_allocated_size(struct esb_s *data)
|
||||
{
|
||||
return data->esb_allocated_size;
|
||||
}
|
||||
|
||||
/* Make more room. Leaving contents unchanged, effectively.
|
||||
The NUL byte at end has room and this preserves that room.
|
||||
*/
|
||||
static void
|
||||
esb_allocate_more_if_needed(struct esb_s *data,
|
||||
const char *in_string,va_list ap)
|
||||
{
|
||||
#ifndef _WIN32
|
||||
static char a_buffer[512];
|
||||
#endif /* _WIN32*/
|
||||
|
||||
int netlen = 0;
|
||||
va_list ap_copy;
|
||||
|
||||
/* Preserve the original argument list, to be used a second time */
|
||||
va_copy(ap_copy,ap);
|
||||
|
||||
#ifdef _WIN32
|
||||
netlen = vfprintf(null_device_handle,in_string,ap_copy);
|
||||
#else
|
||||
netlen = vsnprintf(a_buffer,sizeof(a_buffer),in_string,ap_copy);
|
||||
#endif /* _WIN32*/
|
||||
|
||||
/* "The object ap may be passed as an argument to another
|
||||
function; if that function invokes the va_arg()
|
||||
macro with parameter ap, the value of ap in the calling
|
||||
function is unspecified and shall be passed to the va_end()
|
||||
macro prior to any further reference to ap."
|
||||
Single Unix Specification. */
|
||||
va_end(ap_copy);
|
||||
|
||||
/* Allocate enough space to hold the full text */
|
||||
esb_force_allocation(data,netlen + 1);
|
||||
}
|
||||
|
||||
/* Append a formatted string */
|
||||
void
|
||||
esb_append_printf_ap(struct esb_s *data,const char *in_string,va_list ap)
|
||||
{
|
||||
int netlen = 0;
|
||||
int expandedlen = 0;
|
||||
|
||||
/* Allocate enough space for the input string */
|
||||
esb_allocate_more_if_needed(data,in_string,ap);
|
||||
|
||||
netlen = data->esb_allocated_size - data->esb_used_bytes;
|
||||
expandedlen =
|
||||
vsnprintf(&data->esb_string[data->esb_used_bytes],
|
||||
netlen,in_string,ap);
|
||||
if (expandedlen < 0) {
|
||||
/* There was an error.
|
||||
Do nothing. */
|
||||
return;
|
||||
}
|
||||
if (netlen < expandedlen) {
|
||||
/* If data was too small, the max written was one less than
|
||||
netlen. */
|
||||
data->esb_used_bytes += netlen - 1;
|
||||
} else {
|
||||
data->esb_used_bytes += expandedlen;
|
||||
}
|
||||
}
|
||||
|
||||
/* Append a formatted string */
|
||||
void
|
||||
esb_append_printf(struct esb_s *data,const char *in_string, ...)
|
||||
{
|
||||
va_list ap;
|
||||
va_start(ap,in_string);
|
||||
esb_append_printf_ap(data,in_string,ap);
|
||||
/* "The object ap may be passed as an argument to another
|
||||
function; if that function invokes the va_arg()
|
||||
macro with parameter ap, the value of ap in the calling
|
||||
function is unspecified and shall be passed to the va_end()
|
||||
macro prior to any further reference to ap."
|
||||
Single Unix Specification. */
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
/* Get a copy of the internal data buffer.
|
||||
It is up to the code calling this
|
||||
to free() the string using the
|
||||
pointer returned here. */
|
||||
char*
|
||||
esb_get_copy(struct esb_s *data)
|
||||
{
|
||||
char* copy = NULL;
|
||||
size_t len = esb_string_len(data);
|
||||
if (len) {
|
||||
copy = (char*)malloc(len + 1);
|
||||
strcpy(copy,esb_get_string(data));
|
||||
}
|
||||
return copy;
|
||||
}
|
||||
|
||||
|
||||
#ifdef SELFTEST
|
||||
static int failcount = 0;
|
||||
void
|
||||
validate_esb(int instance,
|
||||
struct esb_s* d,
|
||||
size_t explen,
|
||||
size_t expalloc,
|
||||
const char *expout)
|
||||
{
|
||||
printf(" TEST instance %d\n",instance);
|
||||
if (esb_string_len(d) != explen) {
|
||||
++failcount;
|
||||
printf(" FAIL instance %d esb_string_len() %u explen %u\n",
|
||||
instance,(unsigned)esb_string_len(d),(unsigned)explen);
|
||||
}
|
||||
if (d->esb_allocated_size != expalloc) {
|
||||
++failcount;
|
||||
printf(" FAIL instance %d esb_allocated_size %u expalloc %u\n",
|
||||
instance,(unsigned)d->esb_allocated_size,(unsigned)expalloc);
|
||||
}
|
||||
if(strcmp(esb_get_string(d),expout)) {
|
||||
++failcount;
|
||||
printf(" FAIL instance %d esb_get_stringr %s expstr %s\n",
|
||||
instance,esb_get_string(d),expout);
|
||||
}
|
||||
}
|
||||
void
|
||||
trialprint_1(struct esb_s *d, char *format,...)
|
||||
{
|
||||
va_list ap;
|
||||
|
||||
va_start(ap,format);
|
||||
esb_append_printf_ap(d,format,ap);
|
||||
va_end(ap);
|
||||
}
|
||||
|
||||
void
|
||||
trialprint(struct esb_s *d)
|
||||
{
|
||||
const char * s = "insert me";
|
||||
trialprint_1(d,"aaaa %s bbbb",s);
|
||||
}
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
#ifdef _WIN32
|
||||
/* Open the null device used during formatting printing */
|
||||
if (!esb_open_null_device())
|
||||
{
|
||||
fprintf(stderr, "esb: Unable to open null device.\n");
|
||||
exit(1);
|
||||
}
|
||||
#endif /* _WIN32 */
|
||||
|
||||
{
|
||||
struct esb_s d;
|
||||
esb_constructor(&d);
|
||||
esb_append(&d,"a");
|
||||
validate_esb(1,&d,1,2,"a");
|
||||
esb_append(&d,"b");
|
||||
validate_esb(2,&d,2,3,"ab");
|
||||
esb_append(&d,"c");
|
||||
validate_esb(3,&d,3,4,"abc");
|
||||
esb_empty_string(&d);
|
||||
validate_esb(4,&d,0,4,"");
|
||||
esb_destructor(&d);
|
||||
}
|
||||
{
|
||||
struct esb_s d;
|
||||
esb_constructor(&d);
|
||||
esb_append(&d,"aa");
|
||||
validate_esb(6,&d,2,3,"aa");
|
||||
esb_append(&d,"bbb");
|
||||
validate_esb(7,&d,5,6,"aabbb");
|
||||
esb_append(&d,"c");
|
||||
validate_esb(8,&d,6,7,"aabbbc");
|
||||
esb_empty_string(&d);
|
||||
validate_esb(9,&d,0,7,"");
|
||||
esb_destructor(&d);
|
||||
}
|
||||
{
|
||||
struct esb_s d;
|
||||
static char oddarray[7] = {'a','b',0,'c','c','d',0};
|
||||
esb_constructor(&d);
|
||||
fprintf(stderr," esb_appendn call error(intentional). Expect msg on stderr\n");
|
||||
/* This provokes a msg on stderr. Bad input. */
|
||||
esb_appendn(&d,oddarray,6);
|
||||
validate_esb(10,&d,2,3,"ab");
|
||||
esb_appendn(&d,"cc",1);
|
||||
validate_esb(11,&d,3,4,"abc");
|
||||
esb_empty_string(&d);
|
||||
validate_esb(12,&d,0,4,"");
|
||||
esb_destructor(&d);
|
||||
}
|
||||
{
|
||||
struct esb_s d;
|
||||
esb_constructor(&d);
|
||||
|
||||
esb_force_allocation(&d,7);
|
||||
esb_append(&d,"aaaa i");
|
||||
validate_esb(13,&d,6,7,"aaaa i");
|
||||
esb_destructor(&d);
|
||||
}
|
||||
{
|
||||
struct esb_s d5;
|
||||
esb_constructor(&d5);
|
||||
|
||||
esb_force_allocation(&d5,50);
|
||||
trialprint(&d5);
|
||||
validate_esb(14,&d5,19,50,"aaaa insert me bbbb");
|
||||
esb_destructor(&d5);
|
||||
}
|
||||
{
|
||||
struct esb_s d;
|
||||
struct esb_s e;
|
||||
char* result = NULL;
|
||||
esb_constructor(&d);
|
||||
esb_constructor(&e);
|
||||
|
||||
esb_append(&d,"abcde fghij klmno pqrst");
|
||||
validate_esb(15,&d,23,24,"abcde fghij klmno pqrst");
|
||||
|
||||
result = esb_get_copy(&d);
|
||||
esb_append(&e,result);
|
||||
validate_esb(16,&e,23,24,"abcde fghij klmno pqrst");
|
||||
esb_destructor(&d);
|
||||
esb_destructor(&e);
|
||||
}
|
||||
#ifdef _WIN32
|
||||
/* Close the null device used during formatting printing */
|
||||
esb_close_null_device();
|
||||
#endif /* _WIN32 */
|
||||
if (failcount) {
|
||||
printf("FAIL esb test\n");
|
||||
exit(1);
|
||||
}
|
||||
printf("PASS esb test\n");
|
||||
exit(0);
|
||||
}
|
||||
#endif /* SELFTEST */
|
99
dwarf-compilation.base/contrib/libdwarf/dwarfdump/esb.h
Normal file
99
dwarf-compilation.base/contrib/libdwarf/dwarfdump/esb.h
Normal file
|
@ -0,0 +1,99 @@
|
|||
/*
|
||||
Copyright (C) 2005 Silicon Graphics, Inc. All Rights Reserved.
|
||||
Portions Copyright 2011 David Anderson. All Rights Reserved.
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of version 2 of the GNU General Public License as
|
||||
published by the Free Software Foundation.
|
||||
|
||||
This program is distributed in the hope that it would be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
Further, this software is distributed without any warranty that it is
|
||||
free of the rightful claim of any third person regarding infringement
|
||||
or the like. Any license provided herein, whether implied or
|
||||
otherwise, applies only to this software file. Patent licenses, if
|
||||
any, provided herein do not apply to combinations of this program with
|
||||
other software, or any other product whatsoever.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write the Free Software Foundation, Inc., 51
|
||||
Franklin Street - Fifth Floor, Boston MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
/* esb.h
|
||||
Extensible string buffer.
|
||||
A simple vaguely object oriented extensible string buffer.
|
||||
|
||||
The struct could be opaque here, but it seems ok to expose
|
||||
the contents: simplifies debugging.
|
||||
*/
|
||||
|
||||
#ifndef ESB_H
|
||||
#define ESB_H
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
struct esb_s {
|
||||
char * esb_string; /* pointer to the data itself, or NULL. */
|
||||
size_t esb_allocated_size; /* Size of allocated data or 0 */
|
||||
size_t esb_used_bytes; /* Amount of space used or 0 */
|
||||
};
|
||||
|
||||
/* Open/close the null device used during formatting printing */
|
||||
FILE *esb_open_null_device(void);
|
||||
void esb_close_null_device(void);
|
||||
|
||||
/* string length taken from string itself. */
|
||||
void esb_append(struct esb_s *data, const char * in_string);
|
||||
|
||||
/* The 'len' is believed. Do not pass in strings < len bytes long. */
|
||||
void esb_appendn(struct esb_s *data, const char * in_string, size_t len);
|
||||
|
||||
/* Always returns an empty string or a non-empty string. Never 0. */
|
||||
char * esb_get_string(struct esb_s *data);
|
||||
|
||||
|
||||
/* Sets esb_used_bytes to zero. The string is not freed and
|
||||
esb_allocated_size is unchanged. */
|
||||
void esb_empty_string(struct esb_s *data);
|
||||
|
||||
|
||||
/* Return esb_used_bytes. */
|
||||
size_t esb_string_len(struct esb_s *data);
|
||||
|
||||
/* The following are for testing esb, not use by dwarfdump. */
|
||||
|
||||
/* *data is presumed to contain garbage, not values, and
|
||||
is properly initialized. */
|
||||
void esb_constructor(struct esb_s *data);
|
||||
|
||||
void esb_force_allocation(struct esb_s *data, size_t minlen);
|
||||
|
||||
/* The string is freed, contents of *data set to zeroes. */
|
||||
void esb_destructor(struct esb_s *data);
|
||||
|
||||
|
||||
/* To get all paths in the code tested, this sets the
|
||||
allocation/reallocation to the given value, which can be quite small
|
||||
but must not be zero. */
|
||||
void esb_alloc_size(size_t size);
|
||||
size_t esb_get_allocated_size(struct esb_s *data);
|
||||
|
||||
/* Append a formatted string */
|
||||
void esb_append_printf(struct esb_s *data,const char *format, ...);
|
||||
|
||||
/* Append a formatted string. The 'ap' must be just-setup with
|
||||
va_start(ap,format) and
|
||||
when esb_append_printf_ap returns the ap is used up
|
||||
and should not be touched. */
|
||||
void esb_append_printf_ap(struct esb_s *data,const char *format,va_list ap);
|
||||
|
||||
/* Get a copy of the internal data buffer */
|
||||
char * esb_get_copy(struct esb_s *data);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif /* __cplusplus */
|
||||
#endif /* ESB_H */
|
680
dwarf-compilation.base/contrib/libdwarf/dwarfdump/getopttest.c
Normal file
680
dwarf-compilation.base/contrib/libdwarf/dwarfdump/getopttest.c
Normal file
|
@ -0,0 +1,680 @@
|
|||
/* This is for testing the local getopt. */
|
||||
|
||||
|
||||
#ifdef GETOPT_FROM_SYSTEM
|
||||
#define dwgetopt getopt
|
||||
#define dwopterr opterr
|
||||
#define dwoptind optind
|
||||
#define dwoptopt optopt
|
||||
#define dwopterr opterr
|
||||
#define dwoptarg optarg
|
||||
|
||||
#define dwno_argument no_argument
|
||||
#define dwrequired_argument required_argument
|
||||
#define dwoptional_argument optional_argument
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h> /* for strcmp */
|
||||
#include "dwgetopt.h" /* for dwgetopt */
|
||||
char *argv1[20];
|
||||
|
||||
/* Use for testing dwgetopt only.
|
||||
Not a standard function. */
|
||||
static void
|
||||
dwgetoptresetfortestingonly(void)
|
||||
{
|
||||
dwopterr = 1;
|
||||
dwoptind = 1;
|
||||
dwoptopt = 0;
|
||||
dwoptreset = 0;
|
||||
dwoptarg = 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* for rchar read the real int/char returned.
|
||||
for xchar read the expected int/char.
|
||||
|
||||
for roptarg, read dwoptarg (the real optarg val),
|
||||
for xoptarg read expected-optarg
|
||||
|
||||
for roptind read dwoptind,
|
||||
for xoptind read expected-optind
|
||||
*/
|
||||
static void
|
||||
chkval(int ct,
|
||||
int rchar,int xchar,
|
||||
char *roptarg,char *xoptarg,
|
||||
int roptind,int xoptind,
|
||||
const char *testid)
|
||||
{
|
||||
int err = 0;
|
||||
if (rchar != xchar) {
|
||||
err++;
|
||||
printf("Mismatch %d %s: got char %c 0x%x exp char %c 0x%x\n",
|
||||
ct,testid,rchar,rchar,xchar,xchar);
|
||||
}
|
||||
if (roptarg != xoptarg) {
|
||||
/* pointers non-match */
|
||||
if (roptarg && xoptarg && (!strcmp(roptarg,xoptarg))) {
|
||||
/* strings match. */
|
||||
} else {
|
||||
err++;
|
||||
printf("Mismatch %d %s: got dwoptarg %s 0x%lx exp optarg %s 0x%lx\n",
|
||||
ct,testid,
|
||||
roptarg?roptarg:"",
|
||||
(unsigned long)roptarg,
|
||||
xoptarg?xoptarg:"",
|
||||
(unsigned long)xoptarg);
|
||||
}
|
||||
}
|
||||
if (roptind != xoptind) {
|
||||
err++;
|
||||
printf("Mismatch %d %s: got dwoptind %d 0x%x exp optind %d 0x%x\n",
|
||||
ct,testid,roptind,roptind,xoptind,xoptind);
|
||||
}
|
||||
if (err > 0) {
|
||||
printf("FAIL getopttest %s\n",testid);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
test3(void)
|
||||
{
|
||||
int ct = 1;
|
||||
int c = 0;
|
||||
int argct = 8;
|
||||
argv1[0]="a.out";
|
||||
argv1[1]="-a";
|
||||
argv1[2]="-#bx";
|
||||
argv1[3]="-b";
|
||||
argv1[4]="-c";
|
||||
argv1[5]="-cfoo";
|
||||
argv1[6]="-d";
|
||||
argv1[7]="progtoread";
|
||||
argv1[8]=0;
|
||||
for ( ;(c = dwgetopt(argct, argv1, "#:abc::d")) != EOF; ct++) {
|
||||
switch(ct) {
|
||||
case 1:
|
||||
chkval(ct,c,'a',dwoptarg,0,dwoptind,2,"test31");
|
||||
break;
|
||||
case 2:
|
||||
chkval(ct,c,'#',dwoptarg,"bx",dwoptind,3,"test32");
|
||||
break;
|
||||
case 3:
|
||||
chkval(ct,c,'b',dwoptarg,0,dwoptind,4,"test33");
|
||||
break;
|
||||
case 4:
|
||||
chkval(ct,c,'c',dwoptarg,0,dwoptind,5,"test34");
|
||||
break;
|
||||
case 5:
|
||||
chkval(ct,c,'c',dwoptarg,"foo",dwoptind,6,"test35");
|
||||
break;
|
||||
case 6:
|
||||
chkval(ct,c,'d',dwoptarg,0,dwoptind,7,"test36");
|
||||
break;
|
||||
case 7:
|
||||
case 8:
|
||||
case 9:
|
||||
case 10:
|
||||
case 11:
|
||||
default:
|
||||
printf("FAIL test3 unexpected ct %d\n",ct);
|
||||
}
|
||||
}
|
||||
#if 0
|
||||
printf(" final check: ct %d dwoptind %d\n",ct,optind);
|
||||
#endif
|
||||
if (strcmp(argv1[dwoptind],"progtoread")) {
|
||||
printf("FAIL test3 on non-dash dwoptind %d arg got %s exp %s\n",
|
||||
dwoptind,argv1[dwoptind],"progtoread");
|
||||
exit(1);
|
||||
}
|
||||
printf("PASS getopt test 3\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
test2(void)
|
||||
{
|
||||
int ct = 1;
|
||||
int c = 0;
|
||||
int argct = 5;
|
||||
argv1[0]="a.out";
|
||||
argv1[1]="-a";
|
||||
argv1[2]="-#pound";
|
||||
argv1[3]="-b";
|
||||
argv1[4]="-cfilename";
|
||||
argv1[5]=0;
|
||||
for ( ;(c = dwgetopt(argct, argv1,
|
||||
"#:abc::")) != EOF; ct++) {
|
||||
switch(ct) {
|
||||
case 1:
|
||||
chkval(ct,c,'a',dwoptarg,0,dwoptind,2,"test21");
|
||||
break;
|
||||
case 2:
|
||||
chkval(ct,c,'#',dwoptarg,"pound",dwoptind,3,"test22");
|
||||
break;
|
||||
break;
|
||||
case 3:
|
||||
chkval(ct,c,'b',dwoptarg,0,dwoptind,4,"test23");
|
||||
break;
|
||||
case 4:
|
||||
chkval(ct,c,'c',dwoptarg,"filename",dwoptind,5,"test24");
|
||||
break;
|
||||
default:
|
||||
printf("FAIL test2 unexpected ct %d\n",ct);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
#if 0
|
||||
printf(" final check: ct %d dwoptind %d\n",ct,optind);
|
||||
#endif
|
||||
if (argv1[dwoptind]) {
|
||||
printf("FAIL test2 on non-dash arg dwoptind %d got 0x%lx exp NULL\n",
|
||||
dwoptind,(unsigned long)argv1[dwoptind]);
|
||||
exit(1);
|
||||
}
|
||||
printf("PASS getopt test 2\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static void chklongval(int ct,
|
||||
int rchar,int xchar,
|
||||
const char *xoptname,
|
||||
struct dwoption *ropt, struct dwoption *xopt,
|
||||
char *roptarg,char *xoptarg,
|
||||
int roptind,int xoptind,
|
||||
const char *testid)
|
||||
{
|
||||
int err = 0;
|
||||
if(xopt != ropt || strcmp(ropt->name,xopt->name)) {
|
||||
printf("FAIL name check %s: long opt %s vs %s %s\n",
|
||||
xoptname,
|
||||
ropt->name,xopt->name,
|
||||
testid);
|
||||
++err;
|
||||
}
|
||||
if (roptarg != xoptarg &&
|
||||
(!roptarg || !xoptarg || strcmp(roptarg,xoptarg))) {
|
||||
printf("FAIL argument check %s: long opt %s vs %s %s\n",
|
||||
xoptname,
|
||||
roptarg?roptarg:"",xoptarg?xoptarg:"",
|
||||
testid);
|
||||
++err;
|
||||
}
|
||||
if (roptind != xoptind) {
|
||||
printf("FAIL optind check %s: long opt %d vs %d %s\n",
|
||||
xoptname,
|
||||
roptind,xoptind,
|
||||
testid);
|
||||
++err;
|
||||
}
|
||||
|
||||
if (err > 0) {
|
||||
printf("FAIL long getopttest %s\n",testid);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
ltest1(void)
|
||||
{
|
||||
int ct = 1;
|
||||
int c = 0;
|
||||
int argct = 13;
|
||||
argv1[0]="a.out";
|
||||
argv1[1]="-ab";
|
||||
argv1[2] = "--simplelong";
|
||||
argv1[3] = "--optarglong";
|
||||
argv1[4] = "--requireoptarglong=val";
|
||||
argv1[5] = "-cd";
|
||||
argv1[6]="progtoread";
|
||||
argv1[7]=0;
|
||||
static struct dwoption longopts[] = {
|
||||
{"simplelong", dwno_argument, 0,0},
|
||||
{"optarglong", dwoptional_argument,0,0},
|
||||
{"requireoptarglong",dwrequired_argument,0,0},
|
||||
{0,0,0,0}
|
||||
};
|
||||
int longindex = 0;
|
||||
|
||||
for ( ;(c = dwgetopt_long(argct, argv1,
|
||||
"abcd",
|
||||
longopts,&longindex)) != EOF; ct++) {
|
||||
switch(ct) {
|
||||
case 1:
|
||||
chkval(ct,c,'a',dwoptarg,0,dwoptind,1,"ltest12");
|
||||
break;
|
||||
case 2:
|
||||
chkval(ct,c,'b',dwoptarg,0,dwoptind,2,"ltest2");
|
||||
break;
|
||||
|
||||
case 3: {
|
||||
struct dwoption * foundop = longopts + longindex;
|
||||
chklongval(ct,c,0,
|
||||
"simplelong",
|
||||
foundop,longopts+0,
|
||||
dwoptarg,0,
|
||||
dwoptind,3,"ltest3");
|
||||
}
|
||||
break;
|
||||
case 4: {
|
||||
struct dwoption * foundop = longopts + longindex;
|
||||
chklongval(ct,c,0,
|
||||
"optarglong",
|
||||
foundop,longopts+1,
|
||||
dwoptarg,0,
|
||||
dwoptind,4,"ltest4");
|
||||
}
|
||||
break;
|
||||
case 5: {
|
||||
struct dwoption * foundop = longopts + longindex;
|
||||
chklongval(ct,c,0,
|
||||
"requireoptarglong",
|
||||
foundop,longopts+2,
|
||||
dwoptarg,"val",
|
||||
dwoptind,5,"ltest5");
|
||||
}
|
||||
break;
|
||||
|
||||
case 6:
|
||||
chkval(ct,c,'c',dwoptarg,0,dwoptind,5,"ltest6");
|
||||
break;
|
||||
case 7:
|
||||
chkval(ct,c,'d',dwoptarg,0,dwoptind,6,"ltest7");
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
printf("FAIL ltest1 unexpected ct %d in ltest1\n",ct);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
#if 0
|
||||
printf(" final check: ct %d dwoptind %d\n",ct,optind);
|
||||
#endif
|
||||
if (strcmp(argv1[dwoptind],"progtoread")) {
|
||||
printf("FAIL ltest1 on non-dash arg dwoptind %d got %s exp %s\n",
|
||||
dwoptind,argv1[dwoptind],"progtoread");
|
||||
exit(1);
|
||||
}
|
||||
printf("PASS getopt ltest1\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
ltest2(void)
|
||||
{
|
||||
int ct = 1;
|
||||
int c = 0;
|
||||
int argct = 13;
|
||||
argv1[0]="a.out";
|
||||
argv1[1]="-ab";
|
||||
argv1[2] = "--optarglong";
|
||||
argv1[3] = "--optarglong=";
|
||||
argv1[4] = "--optarglong=val";
|
||||
argv1[5] = "-cd";
|
||||
argv1[6]="progtoread";
|
||||
argv1[7]=0;
|
||||
static struct dwoption longopts[] = {
|
||||
{"optarglong", dwoptional_argument,0,0},
|
||||
{0,0,0,0}
|
||||
};
|
||||
int longindex = 0;
|
||||
|
||||
for ( ;(c = dwgetopt_long(argct, argv1,
|
||||
"abcd",
|
||||
longopts,&longindex)) != EOF; ct++) {
|
||||
switch(ct) {
|
||||
case 1:
|
||||
chkval(ct,c,'a',dwoptarg,0,dwoptind,1,"ltest21");
|
||||
break;
|
||||
case 2:
|
||||
chkval(ct,c,'b',dwoptarg,0,dwoptind,2,"ltest22");
|
||||
break;
|
||||
|
||||
case 3: {
|
||||
struct dwoption * foundop = longopts + longindex;
|
||||
chklongval(ct,c,0,
|
||||
"optarglong",
|
||||
foundop,longopts+0,
|
||||
dwoptarg,0,
|
||||
dwoptind,3,"ltest23");
|
||||
}
|
||||
break;
|
||||
case 4: {
|
||||
struct dwoption * foundop = longopts + longindex;
|
||||
chklongval(ct,c,0,
|
||||
"optarglong",
|
||||
foundop,longopts+0,
|
||||
dwoptarg,0,
|
||||
dwoptind,4,"ltest24");
|
||||
}
|
||||
break;
|
||||
case 5: {
|
||||
struct dwoption * foundop = longopts + longindex;
|
||||
chklongval(ct,c,0,
|
||||
"optarglong",
|
||||
foundop,longopts+0,
|
||||
dwoptarg,"val",
|
||||
dwoptind,5,"ltest25");
|
||||
}
|
||||
break;
|
||||
|
||||
case 6:
|
||||
chkval(ct,c,'c',dwoptarg,0,dwoptind,5,"ltest26");
|
||||
break;
|
||||
case 7:
|
||||
chkval(ct,c,'d',dwoptarg,0,dwoptind,6,"ltest27");
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
printf("FAIL ltest1 unexpected ct %d in ltest2\n",ct);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
#if 0
|
||||
printf(" final check: ct %d dwoptind %d\n",ct,optind);
|
||||
#endif
|
||||
if (strcmp(argv1[dwoptind],"progtoread")) {
|
||||
printf("FAIL ltest2 on non-dash arg dwoptind %d got %s exp %s\n",
|
||||
dwoptind,argv1[dwoptind],"progtoread");
|
||||
exit(1);
|
||||
}
|
||||
printf("PASS getopt ltest2\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
test1(void)
|
||||
{
|
||||
int ct = 1;
|
||||
int c = 0;
|
||||
int argct = 13;
|
||||
argv1[0]="a.out";
|
||||
argv1[1]="-a";
|
||||
argv1[2]="-#";
|
||||
argv1[3]="6";
|
||||
argv1[4]="-H1";
|
||||
argv1[5]="-H";
|
||||
argv1[6]="2";
|
||||
argv1[7]="-ka";
|
||||
argv1[8]="-l";
|
||||
argv1[9]="-lv";
|
||||
argv1[10]="-x";
|
||||
argv1[11]="path=./foo";
|
||||
argv1[12]="progtoread";
|
||||
argv1[13]=0;
|
||||
for ( ;(c = dwgetopt(argct, argv1,
|
||||
"#:abc::CdDeE::fFgGhH:iIk:l::mMnNo::O:pPqQrRsS:t:u:UvVwW::x:yz"))
|
||||
!= EOF; ct++) {
|
||||
switch(ct) {
|
||||
case 1:
|
||||
chkval(ct,c,'a',dwoptarg,0,dwoptind,2,"test11");
|
||||
break;
|
||||
case 2:
|
||||
chkval(ct,c,'#',dwoptarg,"6",dwoptind,4,"test12");
|
||||
break;
|
||||
case 3:
|
||||
chkval(ct,c,'H',dwoptarg,"1",dwoptind,5,"test13");
|
||||
break;
|
||||
case 4:
|
||||
chkval(ct,c,'H',dwoptarg,"2",dwoptind,7,"test14");
|
||||
break;
|
||||
case 5:
|
||||
chkval(ct,c,'k',dwoptarg,"a",dwoptind,8,"test15");
|
||||
break;
|
||||
case 6:
|
||||
chkval(ct,c,'l',dwoptarg,0,dwoptind,9,"test16");
|
||||
break;
|
||||
case 7:
|
||||
chkval(ct,c,'l',dwoptarg,"v",dwoptind,10,"test17");
|
||||
break;
|
||||
case 8:
|
||||
chkval(ct,c,'x',dwoptarg,"path=./foo",dwoptind,12,"test18");
|
||||
break;
|
||||
default:
|
||||
printf("FAIL test1 unexpected ct %d in test1\n",ct);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
#if 0
|
||||
printf(" final check: ct %d dwoptind %d\n",ct,optind);
|
||||
#endif
|
||||
if (strcmp(argv1[dwoptind],"progtoread")) {
|
||||
printf("FAIL test1 on non-dash arg dwoptind %d got %s exp %s\n",
|
||||
dwoptind,argv1[dwoptind],"progtoread");
|
||||
exit(1);
|
||||
}
|
||||
printf("PASS getopt test1\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
test5(void)
|
||||
{
|
||||
int ct = 1;
|
||||
int c = 0;
|
||||
int argct = 8;
|
||||
argv1[0]="a.out";
|
||||
argv1[1]="-ab";
|
||||
argv1[2]="-a";
|
||||
argv1[3]="-cx";
|
||||
argv1[4]="-c";
|
||||
argv1[5]="y";
|
||||
argv1[6]="-d";
|
||||
argv1[7]="-da";
|
||||
argv1[8]=0;
|
||||
for ( ;(c = dwgetopt(argct, argv1, "abc:d::")) != EOF; ct++) {
|
||||
switch(ct) {
|
||||
case 1:
|
||||
chkval(ct,c,'a',dwoptarg,0,dwoptind,1,"test51");
|
||||
break;
|
||||
case 2:
|
||||
chkval(ct,c,'b',dwoptarg,0,dwoptind,2,"test52");
|
||||
break;
|
||||
case 3:
|
||||
chkval(ct,c,'a',dwoptarg,0,dwoptind,3,"test53");
|
||||
break;
|
||||
case 4:
|
||||
chkval(ct,c,'c',dwoptarg,"x",dwoptind,4,"test54");
|
||||
break;
|
||||
case 5:
|
||||
chkval(ct,c,'c',dwoptarg,"y",dwoptind,6,"test55");
|
||||
break;
|
||||
case 6:
|
||||
chkval(ct,c,'d',dwoptarg,0,dwoptind,7,"test56");
|
||||
break;
|
||||
case 7:
|
||||
chkval(ct,c,'d',dwoptarg,"a",dwoptind,8,"test17");
|
||||
break;
|
||||
default:
|
||||
printf("FAIL test5 unexpected ct %d in test1 char 0x%x %c\n",ct,c,c);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
#if 0
|
||||
printf(" final check: ct %d dwoptind %d\n",ct,optind);
|
||||
#endif
|
||||
if (argv1[dwoptind]) {
|
||||
printf("FAIL test5 there is a non-dash arg dwoptind %d got 0x%lx\n",
|
||||
dwoptind,(unsigned long)argv1[dwoptind]);
|
||||
exit(1);
|
||||
}
|
||||
printf("PASS getopt test5\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
test6(void)
|
||||
{
|
||||
int ct = 1;
|
||||
int c = 0;
|
||||
int argct = 2;
|
||||
argv1[0]="a.out";
|
||||
argv1[1]="-H";
|
||||
argv1[2]=0;
|
||||
for ( ;(c = dwgetopt(argct, argv1, "abH:d::")) != EOF; ct++) {
|
||||
switch(ct) {
|
||||
case 1:
|
||||
chkval(ct,c,'?',dwoptarg,0,dwoptind,2,"test61");
|
||||
break;
|
||||
default:
|
||||
printf("FAIL test5 unexpected ct %d in test1 char 0x%x %c\n",ct,c,c);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
if (argv1[dwoptind]) {
|
||||
printf("FAIL test6 there is a non-dash arg dwoptind %d got 0x%lx\n",
|
||||
dwoptind,(unsigned long)argv1[dwoptind]);
|
||||
exit(1);
|
||||
}
|
||||
printf("PASS getopt test6\n");
|
||||
return 0;
|
||||
}
|
||||
/* Leading : in opt string */
|
||||
static int
|
||||
test7(void)
|
||||
{
|
||||
int ct = 1;
|
||||
int c = 0;
|
||||
int argct = 2;
|
||||
argv1[0]="a.out";
|
||||
argv1[1]="-H";
|
||||
argv1[2]=0;
|
||||
for ( ;(c = dwgetopt(argct, argv1, ":abH:d::")) != EOF; ct++) {
|
||||
switch(ct) {
|
||||
case 1:
|
||||
chkval(ct,c,':',dwoptarg,0,dwoptind,2,"test71");
|
||||
break;
|
||||
default:
|
||||
printf("FAIL test5 unexpected ct %d in test1 char 0x%x %c\n",ct,c,c);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
if (argv1[dwoptind]) {
|
||||
printf("FAIL test7 there is a non-dash arg dwoptind %d got 0x%lx\n",
|
||||
dwoptind,(unsigned long)argv1[dwoptind]);
|
||||
exit(1);
|
||||
}
|
||||
printf("PASS getopt test7\n");
|
||||
return 0;
|
||||
}
|
||||
static int
|
||||
test8(void)
|
||||
{
|
||||
int ct = 1;
|
||||
int c = 0;
|
||||
int argct = 2;
|
||||
argv1[0]="a.out";
|
||||
argv1[1]="-x";
|
||||
argv1[2]=0;
|
||||
/* We expect a ? because the arg list is improper. */
|
||||
for ( ;(c = dwgetopt(argct, argv1, "abH:d::")) != EOF; ct++) {
|
||||
switch(ct) {
|
||||
case 1:
|
||||
chkval(ct,c,'?',dwoptarg,0,dwoptind,2,"test81");
|
||||
break;
|
||||
default:
|
||||
printf("FAIL test5 unexpected ct %d in test1 char 0x%x %c\n",ct,c,c);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
if (argv1[dwoptind]) {
|
||||
printf("FAIL test8 there is a non-dash arg dwoptind %d got 0x%lx\n",
|
||||
dwoptind,(unsigned long)argv1[dwoptind]);
|
||||
exit(1);
|
||||
}
|
||||
printf("PASS getopt test8\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
int main(int argc, const char **argv)
|
||||
{
|
||||
int ct = 0;
|
||||
int failct = 0;
|
||||
printf("argc: %d\n",argc);
|
||||
for( ct = 0; ct < argc ; ++ct) {
|
||||
printf("argv[%d] = %s\n",ct,argv[ct]);
|
||||
}
|
||||
if ( argc == 3) {
|
||||
int num = 0;
|
||||
if (strcmp(argv[1],"-c")) {
|
||||
printf("FAIL: invalid arg list\n");
|
||||
exit(1);
|
||||
}
|
||||
num = atoi(argv[2]);
|
||||
printf("Run one test, number %d\n",num);
|
||||
switch(num) {
|
||||
case 1:
|
||||
failct = test1();
|
||||
break;
|
||||
case 2:
|
||||
failct = test2();
|
||||
break;
|
||||
case 3:
|
||||
failct = test3();
|
||||
break;
|
||||
case 5:
|
||||
failct = test5();
|
||||
break;
|
||||
case 6:
|
||||
failct = test6();
|
||||
break;
|
||||
case 7:
|
||||
failct = test7();
|
||||
break;
|
||||
case 8:
|
||||
failct = test8();
|
||||
break;
|
||||
default:
|
||||
printf("FAIL: invalid test number %d\n",num);
|
||||
exit(1);
|
||||
}
|
||||
if ( failct) {
|
||||
printf("FAIL getopttest\n");
|
||||
exit(1);
|
||||
}
|
||||
printf("PASS getopttest\n");
|
||||
exit(0);
|
||||
} else if (argc != 1) {
|
||||
printf("FAIL: invalid arg list\n");
|
||||
exit(1);
|
||||
}
|
||||
failct += ltest1();
|
||||
dwgetoptresetfortestingonly();
|
||||
failct += ltest2();
|
||||
dwgetoptresetfortestingonly();
|
||||
failct += test5();
|
||||
dwgetoptresetfortestingonly();
|
||||
failct += test1();
|
||||
dwgetoptresetfortestingonly();
|
||||
failct += test2();
|
||||
dwgetoptresetfortestingonly();
|
||||
failct += test3();
|
||||
dwgetoptresetfortestingonly();
|
||||
failct += test6();
|
||||
dwgetoptresetfortestingonly();
|
||||
failct += test7();
|
||||
dwgetoptresetfortestingonly();
|
||||
failct += test8();
|
||||
if ( failct) {
|
||||
printf("FAIL getopttest\n");
|
||||
exit(1);
|
||||
}
|
||||
printf("PASS getopttest\n");
|
||||
return 0;
|
||||
}
|
154
dwarf-compilation.base/contrib/libdwarf/dwarfdump/glflags.c
Normal file
154
dwarf-compilation.base/contrib/libdwarf/dwarfdump/glflags.c
Normal file
|
@ -0,0 +1,154 @@
|
|||
/*
|
||||
Copyright (C) 2017-2017 David Anderson. All Rights Reserved.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of version 2 of the GNU General Public License as
|
||||
published by the Free Software Foundation.
|
||||
|
||||
This program is distributed in the hope that it would be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
Further, this software is distributed without any warranty that it is
|
||||
free of the rightful claim of any third person regarding infringement
|
||||
or the like. Any license provided herein, whether implied or
|
||||
otherwise, applies only to this software file. Patent licenses, if
|
||||
any, provided herein do not apply to combinations of this program with
|
||||
other software, or any other product whatsoever.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write the Free Software Foundation, Inc., 51
|
||||
Franklin Street - Fifth Floor, Boston MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
/* All the dwarfdump flags are gathered into a single
|
||||
global struct as it has been hard to know how many there
|
||||
were or what they were all for. */
|
||||
|
||||
#include "globals.h"
|
||||
|
||||
void
|
||||
init_global_flags(void)
|
||||
{
|
||||
glflags.gf_debug_names_flag = FALSE;
|
||||
glflags.gf_info_flag = FALSE;
|
||||
glflags.gf_use_old_dwarf_loclist = FALSE; /* This so both
|
||||
dwarf_loclist_n() and dwarf_get_loclist_c()
|
||||
and the dwarf_loclist_from_expr
|
||||
variations can be
|
||||
tested. Defaults to new
|
||||
dwarf_get_loclist_c(). See -g option.
|
||||
The original IRIX dwarf_loclist() no longer tested
|
||||
as of October 2015. */
|
||||
|
||||
glflags.gf_line_flag_selection = s2l;
|
||||
glflags.gf_line_flag = FALSE;
|
||||
|
||||
/* Setting this FALSE tells dwarfdump to use the old
|
||||
line-table interfaces. using:
|
||||
-x line5=no
|
||||
The new interfaces allow for both two-level line tables
|
||||
and access to line table headers in case
|
||||
we have a DWARF5 skeleton line table (a line table
|
||||
header with no lines).
|
||||
*/
|
||||
glflags.gf_line_skeleton_flag = TRUE;
|
||||
glflags.gf_line_print_pc = TRUE; /* Print <pc> addresses. */
|
||||
glflags.gf_abbrev_flag = FALSE;
|
||||
glflags.gf_frame_flag = FALSE; /* .debug_frame section. */
|
||||
glflags.gf_eh_frame_flag = FALSE; /* GNU .eh_frame section. */
|
||||
glflags.gf_pubnames_flag = FALSE;
|
||||
glflags.gf_macinfo_flag = FALSE; /* DWARF2,3,4. Old macro section*/
|
||||
glflags.gf_macro_flag = FALSE; /* DWARF5(and DWARF4 extension) new macro section */
|
||||
glflags.gf_loc_flag = FALSE;
|
||||
glflags.gf_aranges_flag = FALSE; /* .debug_aranges section. */
|
||||
glflags.gf_ranges_flag = FALSE; /* .debug_ranges section. */
|
||||
glflags.gf_string_flag = FALSE;
|
||||
glflags.gf_reloc_flag = FALSE;
|
||||
glflags.gf_static_func_flag = FALSE;
|
||||
glflags.gf_static_var_flag = FALSE;
|
||||
glflags.gf_types_flag = FALSE;
|
||||
glflags.gf_weakname_flag = FALSE;
|
||||
glflags.gf_header_flag = FALSE; /* Control printing of Elf header. */
|
||||
glflags.gf_gdbindex_flag = FALSE;
|
||||
glflags.gf_producer_children_flag = FALSE; /* List of CUs per compiler */
|
||||
glflags.gf_check_abbrev_code = FALSE;
|
||||
glflags.gf_check_pubname_attr = FALSE;
|
||||
glflags.gf_check_reloc_offset = FALSE;
|
||||
glflags.gf_check_attr_tag = FALSE;
|
||||
glflags.gf_check_tag_tree = FALSE;
|
||||
glflags.gf_check_type_offset = FALSE;
|
||||
glflags.gf_check_decl_file = FALSE;
|
||||
glflags.gf_check_macros = FALSE;
|
||||
glflags.gf_check_lines = FALSE;
|
||||
glflags.gf_check_fdes = FALSE;
|
||||
glflags.gf_check_ranges = FALSE;
|
||||
glflags.gf_check_aranges = FALSE;
|
||||
glflags.gf_check_harmless = FALSE;
|
||||
glflags.gf_check_abbreviations = FALSE;
|
||||
glflags.gf_check_dwarf_constants = FALSE;
|
||||
glflags.gf_check_di_gaps = FALSE;
|
||||
glflags.gf_check_forward_decl = FALSE;
|
||||
glflags.gf_check_self_references = FALSE;
|
||||
glflags.gf_check_attr_encoding = FALSE; /* Attributes encoding */
|
||||
glflags.gf_generic_1200_regs = FALSE;
|
||||
glflags.gf_suppress_check_extensions_tables = FALSE;
|
||||
glflags.gf_check_duplicated_attributes = FALSE;
|
||||
|
||||
/* lots of checks make no sense on a dwp debugfission object. */
|
||||
glflags.gf_suppress_checking_on_dwp = FALSE;
|
||||
|
||||
/* suppress_nested_name_search is a band-aid.
|
||||
A workaround. A real fix for N**2 behavior is needed. */
|
||||
glflags.gf_suppress_nested_name_search = FALSE;
|
||||
glflags.gf_uri_options_translation = TRUE;
|
||||
glflags.gf_do_print_uri_in_input = TRUE;
|
||||
|
||||
glflags.gf_print_unique_errors = FALSE;
|
||||
glflags.gf_found_error_message = FALSE;
|
||||
|
||||
glflags.gf_check_names = FALSE;
|
||||
|
||||
/* During '-k' mode, display errors */
|
||||
glflags.gf_check_verbose_mode = TRUE;
|
||||
|
||||
glflags.gf_check_frames = FALSE;
|
||||
|
||||
/* Extensive frames check */
|
||||
glflags.gf_check_frames_extended = FALSE;
|
||||
|
||||
glflags.gf_check_locations = FALSE;
|
||||
glflags.gf_print_usage_tag_attr = FALSE;
|
||||
glflags.gf_print_usage_tag_attr_full = FALSE;
|
||||
glflags.gf_check_all_compilers = TRUE;
|
||||
glflags.gf_check_snc_compiler = FALSE;
|
||||
glflags.gf_check_gcc_compiler = FALSE;
|
||||
glflags.gf_print_summary_all = FALSE;
|
||||
|
||||
/* The check and print flags here make it easy to
|
||||
allow check-only or print-only. We no longer support
|
||||
check-and-print in a single run. */
|
||||
glflags.gf_do_check_dwarf = FALSE;
|
||||
glflags.gf_do_print_dwarf = FALSE;
|
||||
glflags.gf_check_show_results = FALSE;
|
||||
glflags.gf_record_dwarf_error = FALSE; /* A test has failed, this
|
||||
is normally set FALSE shortly after being set TRUE, it is
|
||||
a short-range hint we should print something we might not
|
||||
otherwise print (under the circumstances). */
|
||||
|
||||
glflags.gf_check_debug_names = FALSE;
|
||||
|
||||
/* Display parent/children when in wide format? */
|
||||
glflags.gf_display_parent_tree = FALSE;
|
||||
glflags.gf_display_children_tree = FALSE;
|
||||
glflags.gf_stop_indent_level = 0;
|
||||
|
||||
/* Print search results in wide format? */
|
||||
glflags.gf_search_wide_format = FALSE;
|
||||
/* -S option: strings for 'any' and 'match' */
|
||||
glflags.gf_search_is_on = FALSE;
|
||||
glflags.gf_search_print_results = FALSE;
|
||||
glflags.gf_cu_name_flag = FALSE;
|
||||
glflags.gf_show_global_offsets = FALSE;
|
||||
glflags.gf_display_offsets = TRUE;
|
||||
}
|
152
dwarf-compilation.base/contrib/libdwarf/dwarfdump/glflags.h
Normal file
152
dwarf-compilation.base/contrib/libdwarf/dwarfdump/glflags.h
Normal file
|
@ -0,0 +1,152 @@
|
|||
/*
|
||||
Copyright (C) 2017-2017 David Anderson. All Rights Reserved.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of version 2 of the GNU General Public License as
|
||||
published by the Free Software Foundation.
|
||||
|
||||
This program is distributed in the hope that it would be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
Further, this software is distributed without any warranty that it is
|
||||
free of the rightful claim of any third person regarding infringement
|
||||
or the like. Any license provided herein, whether implied or
|
||||
otherwise, applies only to this software file. Patent licenses, if
|
||||
any, provided herein do not apply to combinations of this program with
|
||||
other software, or any other product whatsoever.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write the Free Software Foundation, Inc., 51
|
||||
Franklin Street - Fifth Floor, Boston MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
/* All the dwarfdump flags are gathered into a single
|
||||
global struct as it has been hard to know how many there
|
||||
were or what they were all for. */
|
||||
|
||||
|
||||
struct glflags_s {
|
||||
|
||||
/* This so both
|
||||
dwarf_loclist_n() and dwarf_get_loclist_c()
|
||||
and the dwarf_loclist_from_expr
|
||||
variations can be
|
||||
tested. Defaults to new
|
||||
dwarf_get_loclist_c(). See -g option.
|
||||
original IRIX dwarf_loclist() no longer tested
|
||||
as of October 2015. */
|
||||
boolean gf_use_old_dwarf_loclist;
|
||||
enum line_flag_type_e gf_line_flag_selection;
|
||||
|
||||
boolean gf_abbrev_flag;
|
||||
boolean gf_aranges_flag; /* .debug_aranges section. */
|
||||
boolean gf_debug_names_flag;
|
||||
boolean gf_eh_frame_flag; /* GNU .eh_frame section. */
|
||||
boolean gf_frame_flag; /* .debug_frame section. */
|
||||
boolean gf_gdbindex_flag; /* .gdbindex section. */
|
||||
boolean gf_info_flag; /* .debug_info */
|
||||
boolean gf_line_flag;
|
||||
boolean gf_line_print_pc;
|
||||
boolean gf_line_skeleton_flag;
|
||||
boolean gf_loc_flag;
|
||||
boolean gf_macinfo_flag; /* DWARF2,3,4. Old macro section*/
|
||||
boolean gf_macro_flag; /* DWARF5 */
|
||||
boolean gf_pubnames_flag;
|
||||
boolean gf_ranges_flag; /* .debug_ranges section. */
|
||||
boolean gf_reloc_flag; /* Elf relocations, not DWARF. */
|
||||
boolean gf_static_func_flag;/* SGI only */
|
||||
boolean gf_static_var_flag; /* SGI only */
|
||||
boolean gf_string_flag;
|
||||
boolean gf_pubtypes_flag; /* SGI only */
|
||||
boolean gf_types_flag; /* .debug_types, not all CU types */
|
||||
boolean gf_weakname_flag; /* SGI only */
|
||||
|
||||
boolean gf_header_flag; /* Control printing of Elf header. */
|
||||
boolean gf_section_groups_flag;
|
||||
|
||||
boolean gf_producer_children_flag; /* List of CUs per compiler */
|
||||
boolean gf_check_abbrev_code;
|
||||
boolean gf_check_pubname_attr;
|
||||
boolean gf_check_reloc_offset;
|
||||
boolean gf_check_attr_tag;
|
||||
boolean gf_check_tag_tree;
|
||||
boolean gf_check_type_offset;
|
||||
boolean gf_check_decl_file;
|
||||
boolean gf_check_macros;
|
||||
boolean gf_check_lines;
|
||||
boolean gf_check_fdes;
|
||||
boolean gf_check_ranges;
|
||||
boolean gf_check_aranges;
|
||||
boolean gf_check_harmless;
|
||||
boolean gf_check_abbreviations;
|
||||
boolean gf_check_dwarf_constants;
|
||||
boolean gf_check_di_gaps;
|
||||
boolean gf_check_forward_decl;
|
||||
boolean gf_check_self_references;
|
||||
boolean gf_check_attr_encoding; /* Attributes encoding */
|
||||
boolean gf_generic_1200_regs;
|
||||
boolean gf_suppress_check_extensions_tables;
|
||||
boolean gf_check_duplicated_attributes;
|
||||
/* lots of checks make no sense on a dwp debugfission object. */
|
||||
boolean gf_suppress_checking_on_dwp;
|
||||
|
||||
/* suppress_nested_name_search is a band-aid.
|
||||
A workaround. A real fix for N**2 behavior is needed. */
|
||||
boolean gf_suppress_nested_name_search;
|
||||
boolean gf_uri_options_translation;
|
||||
boolean gf_do_print_uri_in_input;
|
||||
|
||||
/* Print global (unique) error messages */
|
||||
boolean gf_print_unique_errors;
|
||||
boolean gf_found_error_message;
|
||||
|
||||
boolean gf_check_names;
|
||||
boolean gf_check_verbose_mode; /* During '-k' mode, display errors */
|
||||
boolean gf_check_frames;
|
||||
boolean gf_check_frames_extended; /* Extensive frames check */
|
||||
boolean gf_check_locations; /* Location list check */
|
||||
|
||||
boolean gf_print_usage_tag_attr; /* Print basic usage */
|
||||
boolean gf_print_usage_tag_attr_full; /* Print full usage */
|
||||
|
||||
boolean gf_check_all_compilers;
|
||||
boolean gf_check_snc_compiler; /* Check SNC compiler */
|
||||
boolean gf_check_gcc_compiler;
|
||||
boolean gf_print_summary_all;
|
||||
|
||||
/* The check and print flags here make it easy to
|
||||
allow check-only or print-only. We no longer support
|
||||
check-and-print in a single run. */
|
||||
boolean gf_do_check_dwarf;
|
||||
boolean gf_do_print_dwarf;
|
||||
boolean gf_check_show_results; /* Display checks results. */
|
||||
boolean gf_record_dwarf_error; /* A test has failed, this
|
||||
is normally set FALSE shortly after being set TRUE, it is
|
||||
a short-range hint we should print something we might not
|
||||
otherwise print (under the circumstances). */
|
||||
|
||||
boolean gf_check_debug_names;
|
||||
|
||||
/* Display parent/children when in wide format? */
|
||||
boolean gf_display_parent_tree;
|
||||
boolean gf_display_children_tree;
|
||||
int gf_stop_indent_level;
|
||||
|
||||
/* Print search results in wide format? */
|
||||
boolean gf_search_wide_format;
|
||||
|
||||
/* -S option: strings for 'any' and 'match' */
|
||||
boolean gf_search_is_on;
|
||||
|
||||
boolean gf_search_print_results;
|
||||
boolean gf_cu_name_flag;
|
||||
boolean gf_show_global_offsets;
|
||||
boolean gf_display_offsets;
|
||||
};
|
||||
|
||||
extern struct glflags_s glflags;
|
||||
|
||||
extern void init_global_flags(void);
|
||||
|
||||
|
504
dwarf-compilation.base/contrib/libdwarf/dwarfdump/globals.h
Normal file
504
dwarf-compilation.base/contrib/libdwarf/dwarfdump/globals.h
Normal file
|
@ -0,0 +1,504 @@
|
|||
/*
|
||||
Copyright (C) 2000,2004,2005 Silicon Graphics, Inc. All Rights Reserved.
|
||||
Portions Copyright (C) 2007-2016 David Anderson. All Rights Reserved.
|
||||
Portions Copyright 2012 SN Systems Ltd. All rights reserved.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of version 2 of the GNU General Public License as
|
||||
published by the Free Software Foundation.
|
||||
|
||||
This program is distributed in the hope that it would be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
Further, this software is distributed without any warranty that it is
|
||||
free of the rightful claim of any third person regarding infringement
|
||||
or the like. Any license provided herein, whether implied or
|
||||
otherwise, applies only to this software file. Patent licenses, if
|
||||
any, provided herein do not apply to combinations of this program with
|
||||
other software, or any other product whatsoever.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write the Free Software Foundation, Inc., 51
|
||||
Franklin Street - Fifth Floor, Boston MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef globals_INCLUDED
|
||||
#define globals_INCLUDED
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#include "config.h"
|
||||
#if (!defined(HAVE_RAW_LIBELF_OK) && defined(HAVE_LIBELF_OFF64_OK) )
|
||||
/* At a certain point libelf.h requires _GNU_SOURCE.
|
||||
here we assume the criteria in configure determine that
|
||||
usefully.
|
||||
*/
|
||||
#define _GNU_SOURCE 1
|
||||
#endif
|
||||
|
||||
#include "warningcontrol.h"
|
||||
|
||||
/* We want __uint32_t and __uint64_t and __int32_t __int64_t
|
||||
properly defined but not duplicated, since duplicate typedefs
|
||||
are not legal C.
|
||||
HAVE___UINT32_T
|
||||
HAVE___UINT64_T will be set by configure if
|
||||
our 4 types are predefined in compiler
|
||||
*/
|
||||
|
||||
|
||||
#if (!defined(HAVE___UINT32_T)) && defined(HAVE_SGIDEFS_H)
|
||||
#include <sgidefs.h> /* sgidefs.h defines them */
|
||||
#define HAVE___UINT32_T 1
|
||||
#define HAVE___UINT64_T 1
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
#if (!defined(HAVE___UINT32_T)) && defined(HAVE_SYS_TYPES_H) && defined(HAVE___UINT32_T_IN_SYS_TYPES_H)
|
||||
# include <sys/types.h>
|
||||
/* we assume __[u]int32_t and __[u]int64_t defined
|
||||
since __uint32_t defined in the sys/types.h in use */
|
||||
#define HAVE___UINT32_T 1
|
||||
#define HAVE___UINT64_T 1
|
||||
#endif
|
||||
|
||||
#ifndef HAVE___UINT32_T
|
||||
typedef int __int32_t;
|
||||
typedef unsigned __uint32_t;
|
||||
#define HAVE___UINT32_T 1
|
||||
#endif
|
||||
#ifndef HAVE___UINT64_T
|
||||
typedef long long __int64_t;
|
||||
typedef unsigned long long __uint64_t;
|
||||
#define HAVE___UINT64_T 1
|
||||
#endif
|
||||
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h> /* For va_start va_arg va_list */
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
/* Windows specific */
|
||||
#ifdef HAVE_STDAFX_H
|
||||
#include "stdafx.h"
|
||||
#endif /* HAVE_STDAFX_H */
|
||||
|
||||
#ifdef HAVE_ELF_H
|
||||
#include <elf.h>
|
||||
#endif
|
||||
#ifdef HAVE_LIBELF_H
|
||||
#include <libelf.h>
|
||||
#else
|
||||
#ifdef HAVE_LIBELF_LIBELF_H
|
||||
#include <libelf/libelf.h>
|
||||
#endif
|
||||
#endif
|
||||
#include <dwarf.h>
|
||||
#include <libdwarf.h>
|
||||
#ifdef HAVE_REGEX
|
||||
#include <regex.h>
|
||||
#endif
|
||||
|
||||
#include "checkutil.h"
|
||||
#ifndef BOOLEAN_TYPEDEFED
|
||||
#define BOOLEAN_TYPEDEFED
|
||||
typedef int boolean;
|
||||
#endif /* BOOLEAN_TYPEDEFED */
|
||||
#ifndef FALSE
|
||||
#define FALSE 0
|
||||
#endif
|
||||
#ifndef TRUE
|
||||
#define TRUE 1
|
||||
#endif
|
||||
#ifndef FAILED
|
||||
#define FAILED 1
|
||||
#endif
|
||||
|
||||
/* Used to try to avoid leakage when we hide errors. */
|
||||
#define DROP_ERROR_INSTANCE(d,r,e) \
|
||||
if (r == DW_DLV_ERROR) { \
|
||||
dwarf_dealloc(d,e,DW_DLA_ERROR); \
|
||||
e = 0; \
|
||||
}
|
||||
|
||||
|
||||
|
||||
/* size of attrib_buffer, defined in print_die.c */
|
||||
#define ATTRIB_BUFSIZ 999
|
||||
|
||||
typedef struct {
|
||||
int checks;
|
||||
int errors;
|
||||
} Dwarf_Check_Result;
|
||||
|
||||
/* Compilation Unit information for improved error messages.
|
||||
If the strings are too short we just truncate so fixed length
|
||||
here is fine. */
|
||||
#define COMPILE_UNIT_NAME_LEN 512
|
||||
extern char PU_name[COMPILE_UNIT_NAME_LEN]; /* PU Name */
|
||||
extern char CU_name[COMPILE_UNIT_NAME_LEN]; /* CU Name */
|
||||
extern char CU_producer[COMPILE_UNIT_NAME_LEN]; /* CU Producer Name */
|
||||
|
||||
/* Set TRUE if you want to simply assume strings to be
|
||||
printed are safe to print. Leave FALSE if you want
|
||||
dangerous or unprintable characters to be switched to the
|
||||
character '?'. */
|
||||
extern boolean no_sanitize_string_garbage;
|
||||
|
||||
extern boolean seen_PU; /* Detected a PU. */
|
||||
extern boolean seen_CU; /* Detected a CU. */
|
||||
extern boolean need_CU_name; /* Need CU name. */
|
||||
extern boolean need_CU_base_address; /* Need CU Base address. */
|
||||
extern boolean need_CU_high_address; /* Need CU High address. */
|
||||
extern boolean need_PU_valid_code; /* Need PU valid code. */
|
||||
|
||||
extern boolean seen_PU_base_address; /* Detected a Base address for PU */
|
||||
extern boolean seen_PU_high_address; /* Detected a High address for PU */
|
||||
extern Dwarf_Addr PU_base_address; /* PU Base address */
|
||||
extern Dwarf_Addr PU_high_address; /* PU High address */
|
||||
|
||||
extern Dwarf_Off DIE_offset; /* DIE offset in compile unit. */
|
||||
extern Dwarf_Off DIE_overall_offset; /* DIE offset in .debug_info. */
|
||||
|
||||
/* Current CU information for better error reporting. */
|
||||
extern Dwarf_Off DIE_CU_offset; /* CU DIE offset in compile unit */
|
||||
extern Dwarf_Off DIE_CU_overall_offset; /* CU DIE offset in .debug_info */
|
||||
extern Dwarf_Addr CU_base_address; /* CU Base address. See ranges. */
|
||||
extern Dwarf_Addr CU_low_address; /* CU lowest addr. */
|
||||
extern Dwarf_Addr CU_high_address; /* CU High address. */
|
||||
|
||||
extern int current_section_id; /* Section being process. */
|
||||
|
||||
/* Ranges and Location tables for better error checking: see
|
||||
dwarfdump.c comments for more information. */
|
||||
extern Bucket_Group *pRangesInfo;
|
||||
extern Bucket_Group *pLinkonceInfo;
|
||||
extern Bucket_Group *pVisitedInfo;
|
||||
|
||||
/* Calculate wasted space */
|
||||
extern void calculate_attributes_usage(Dwarf_Half attr,Dwarf_Half theform,
|
||||
Dwarf_Unsigned value);
|
||||
|
||||
/* Able to generate report on search */
|
||||
extern const char *search_any_text;
|
||||
extern const char *search_match_text;
|
||||
extern const char *search_regex_text;
|
||||
extern int search_occurrences;
|
||||
#ifdef HAVE_REGEX
|
||||
extern regex_t search_re;
|
||||
#endif
|
||||
extern boolean is_strstrnocase(const char *data, const char *pattern);
|
||||
|
||||
/* Options to enable debug tracing. */
|
||||
#define MAX_TRACE_LEVEL 10
|
||||
extern int nTrace[MAX_TRACE_LEVEL + 1];
|
||||
|
||||
#define DUMP_OPTIONS 0 /* Dump options. */
|
||||
#define DUMP_RANGES_INFO 1 /* Dump RangesInfo Table. */
|
||||
#define DUMP_LOCATION_SECTION_INFO 2 /* Dump Location (.debug_loc) Info. */
|
||||
#define DUMP_RANGES_SECTION_INFO 3 /* Dump Ranges (.debug_ranges) Info. */
|
||||
#define DUMP_LINKONCE_INFO 4 /* Dump Linkonce Table. */
|
||||
#define DUMP_VISITED_INFO 5 /* Dump Visited Info. */
|
||||
|
||||
#define dump_options nTrace[DUMP_OPTIONS]
|
||||
#define dump_ranges_info nTrace[DUMP_RANGES_INFO]
|
||||
#define dump_location_section_info nTrace[DUMP_LOCATION_SECTION_INFO]
|
||||
#define dump_ranges_section_info nTrace[DUMP_RANGES_SECTION_INFO]
|
||||
#define dump_linkonce_info nTrace[DUMP_LINKONCE_INFO]
|
||||
#define dump_visited_info nTrace[DUMP_VISITED_INFO]
|
||||
|
||||
/* Section IDs */
|
||||
#define DEBUG_ABBREV 1
|
||||
#define DEBUG_ARANGES 2
|
||||
#define DEBUG_FRAME 3
|
||||
#define DEBUG_INFO 4
|
||||
#define DEBUG_LINE 5
|
||||
#define DEBUG_LOC 6
|
||||
#define DEBUG_MACINFO 7
|
||||
#define DEBUG_PUBNAMES 8
|
||||
#define DEBUG_RANGES 9
|
||||
#define DEBUG_STATIC_VARS 10
|
||||
#define DEBUG_STATIC_FUNC 11
|
||||
#define DEBUG_STR 12
|
||||
#define DEBUG_WEAKNAMES 13
|
||||
#define DEBUG_TYPES 14
|
||||
#define DEBUG_GDB_INDEX 15
|
||||
#define DEBUG_FRAME_EH_GNU 16
|
||||
#define DEBUG_MACRO 17
|
||||
#define DEBUG_NAMES 18
|
||||
|
||||
extern int verbose;
|
||||
extern boolean dense;
|
||||
extern boolean ellipsis;
|
||||
extern boolean use_mips_regnames;
|
||||
extern boolean show_form_used;
|
||||
|
||||
/* Print the information only if unique errors is set and it is first time */
|
||||
#define PRINTING_UNIQUE (!glflags.gf_found_error_message)
|
||||
|
||||
extern int break_after_n_units;
|
||||
|
||||
/* Check categories corresponding to the -k option */
|
||||
typedef enum /* Dwarf_Check_Categories */ {
|
||||
abbrev_code_result,
|
||||
pubname_attr_result,
|
||||
reloc_offset_result,
|
||||
attr_tag_result,
|
||||
tag_tree_result,
|
||||
type_offset_result,
|
||||
decl_file_result,
|
||||
ranges_result,
|
||||
lines_result,
|
||||
aranges_result,
|
||||
/* Harmless errors are errors detected inside libdwarf but
|
||||
not reported via DW_DLE_ERROR returns because the errors
|
||||
won't really affect client code. The 'harmless' errors
|
||||
are reported and otherwise ignored. It is difficult to report
|
||||
the error when the error is noticed by libdwarf, the error
|
||||
is reported at a later time.
|
||||
The other errors dwarfdump reports are also generally harmless
|
||||
but are detected by dwarfdump so it's possble to report the
|
||||
error as soon as the error is discovered. */
|
||||
harmless_result,
|
||||
fde_duplication,
|
||||
frames_result,
|
||||
locations_result,
|
||||
names_result,
|
||||
abbreviations_result,
|
||||
dwarf_constants_result,
|
||||
di_gaps_result,
|
||||
forward_decl_result,
|
||||
self_references_result,
|
||||
attr_encoding_result,
|
||||
duplicated_attributes_result,
|
||||
total_check_result,
|
||||
LAST_CATEGORY /* Must be last */
|
||||
} Dwarf_Check_Categories;
|
||||
|
||||
|
||||
struct section_high_offsets_s {
|
||||
Dwarf_Unsigned debug_info_size;
|
||||
Dwarf_Unsigned debug_abbrev_size;
|
||||
Dwarf_Unsigned debug_line_size;
|
||||
Dwarf_Unsigned debug_loc_size;
|
||||
Dwarf_Unsigned debug_aranges_size;
|
||||
Dwarf_Unsigned debug_macinfo_size;
|
||||
Dwarf_Unsigned debug_pubnames_size;
|
||||
Dwarf_Unsigned debug_str_size;
|
||||
Dwarf_Unsigned debug_frame_size;
|
||||
Dwarf_Unsigned debug_ranges_size;
|
||||
Dwarf_Unsigned debug_pubtypes_size;
|
||||
Dwarf_Unsigned debug_types_size;
|
||||
Dwarf_Unsigned debug_macro_size;
|
||||
Dwarf_Unsigned debug_str_offsets_size;
|
||||
Dwarf_Unsigned debug_sup_size;
|
||||
Dwarf_Unsigned debug_cu_index_size;
|
||||
Dwarf_Unsigned debug_tu_index_size;
|
||||
};
|
||||
extern struct section_high_offsets_s section_high_offsets_global;
|
||||
|
||||
enum line_flag_type_e {
|
||||
singledw5, /* Meaning choose single table DWARF5 new interfaces. */
|
||||
s2l, /* Meaning choose two-level DWARF5 new interfaces. */
|
||||
orig, /* Meaning choose DWARF2,3,4 single level interface. */
|
||||
orig2l /* Meaning choose DWARF 2,3,4 two-level interface. */
|
||||
};
|
||||
|
||||
#include "glflags.h"
|
||||
|
||||
/* tsearch tree used in macro checking. */
|
||||
extern void * macro_check_tree; /* DWARF5 macros. */
|
||||
extern void * macinfo_check_tree; /* DWARF2,3,4 macros */
|
||||
|
||||
extern Dwarf_Off fde_offset_for_cu_low;
|
||||
extern Dwarf_Off fde_offset_for_cu_high;
|
||||
|
||||
/* Process TAGs for checking mode and reset pRangesInfo table
|
||||
if appropriate. */
|
||||
extern void tag_specific_checks_setup(Dwarf_Half val,int die_indent_level);
|
||||
|
||||
extern const char *program_name;
|
||||
|
||||
extern void print_error_and_continue (Dwarf_Debug dbg, const char * msg,int res, Dwarf_Error err);
|
||||
extern void print_error (Dwarf_Debug dbg, const char * msg,int res, Dwarf_Error err);
|
||||
|
||||
extern void print_line_numbers_this_cu (Dwarf_Debug dbg, Dwarf_Die in_die);
|
||||
|
||||
struct dwconf_s;
|
||||
extern void print_frames (Dwarf_Debug dbg, int print_debug_frame,
|
||||
int print_eh_frame,struct dwconf_s *);
|
||||
extern void print_ranges (Dwarf_Debug dbg);
|
||||
extern void print_pubnames (Dwarf_Debug dbg);
|
||||
extern void print_macinfo (Dwarf_Debug dbg);
|
||||
extern void print_infos (Dwarf_Debug dbg,Dwarf_Bool is_info);
|
||||
extern void print_locs (Dwarf_Debug dbg);
|
||||
extern void print_abbrevs (Dwarf_Debug dbg);
|
||||
extern void print_strings (Dwarf_Debug dbg);
|
||||
extern void print_aranges (Dwarf_Debug dbg);
|
||||
extern void print_relocinfo (Dwarf_Debug dbg,char *relmap);
|
||||
extern void print_static_funcs(Dwarf_Debug dbg);
|
||||
extern void print_static_vars(Dwarf_Debug dbg);
|
||||
enum type_type_e {SGI_TYPENAME, DWARF_PUBTYPES} ;
|
||||
extern void print_types(Dwarf_Debug dbg,enum type_type_e type_type);
|
||||
extern void print_weaknames(Dwarf_Debug dbg);
|
||||
extern void print_exception_tables(Dwarf_Debug dbg);
|
||||
extern void print_debug_names(Dwarf_Debug dbg);
|
||||
|
||||
/* Space used to record range information */
|
||||
extern void allocate_range_array_info(void);
|
||||
extern void release_range_array_info(void);
|
||||
extern void record_range_array_info_entry(Dwarf_Off die_off,
|
||||
Dwarf_Off range_off);
|
||||
extern void check_range_array_info(Dwarf_Debug dbg);
|
||||
|
||||
struct esb_s;
|
||||
extern void print_ranges_list_to_extra(Dwarf_Debug dbg,
|
||||
Dwarf_Unsigned off,
|
||||
Dwarf_Ranges *rangeset,
|
||||
Dwarf_Signed rangecount,
|
||||
Dwarf_Unsigned bytecount,
|
||||
struct esb_s *stringbuf);
|
||||
boolean should_skip_this_cu(Dwarf_Debug dbg, Dwarf_Die cu_die);
|
||||
|
||||
void get_address_size_and_max(Dwarf_Debug dbg,
|
||||
Dwarf_Half * size,
|
||||
Dwarf_Addr * max,
|
||||
Dwarf_Error *err);
|
||||
|
||||
/* Returns the producer of the CU */
|
||||
int get_cu_name(Dwarf_Debug dbg,Dwarf_Die cu_die,
|
||||
Dwarf_Off dieprint_cu_offset,
|
||||
char **short_name,char **long_name);
|
||||
int get_producer_name(Dwarf_Debug dbg,Dwarf_Die cu_die,
|
||||
Dwarf_Off dieprint_cu_offset,
|
||||
struct esb_s *producername);
|
||||
|
||||
/* Get number of abbreviations for a CU */
|
||||
extern void get_abbrev_array_info(Dwarf_Debug dbg,Dwarf_Unsigned offset);
|
||||
/* Validate an abbreviation */
|
||||
extern void validate_abbrev_code(Dwarf_Debug dbg,Dwarf_Unsigned abbrev_code);
|
||||
|
||||
extern void print_die_and_children(
|
||||
Dwarf_Debug dbg,
|
||||
Dwarf_Die in_die,
|
||||
Dwarf_Off dieprint_cu_offset,
|
||||
Dwarf_Bool is_info,
|
||||
char **srcfiles,
|
||||
Dwarf_Signed cnt);
|
||||
extern boolean print_one_die(
|
||||
Dwarf_Debug dbg,
|
||||
Dwarf_Die die,
|
||||
Dwarf_Off dieprint_cu_offset,
|
||||
boolean print_information,
|
||||
int die_indent_level,
|
||||
char **srcfiles,
|
||||
Dwarf_Signed cnt,
|
||||
boolean ignore_die_stack);
|
||||
|
||||
/* Check for specific compiler */
|
||||
extern boolean checking_this_compiler(void);
|
||||
extern void update_compiler_target(const char *producer_name);
|
||||
extern void add_cu_name_compiler_target(char *name);
|
||||
|
||||
/* General error reporting routines. These were
|
||||
macros for a short time and when changed into functions
|
||||
they kept (for now) their capitalization.
|
||||
The capitalization will likely change. */
|
||||
extern void PRINT_CU_INFO(void);
|
||||
extern void DWARF_CHECK_COUNT(Dwarf_Check_Categories category, int inc);
|
||||
extern void DWARF_ERROR_COUNT(Dwarf_Check_Categories category, int inc);
|
||||
extern void DWARF_CHECK_ERROR_PRINT_CU(void);
|
||||
extern void DWARF_CHECK_ERROR(Dwarf_Check_Categories category,
|
||||
const char *str);
|
||||
extern void DWARF_CHECK_ERROR2(Dwarf_Check_Categories category,
|
||||
const char *str1, const char *str2);
|
||||
extern void DWARF_CHECK_ERROR3(Dwarf_Check_Categories category,
|
||||
const char *str1, const char *str2, const char *strexpl);
|
||||
|
||||
extern void print_macinfo_by_offset(Dwarf_Debug dbg,Dwarf_Unsigned offset);
|
||||
|
||||
struct esb_s;
|
||||
|
||||
/* Eliminate control characters from the input,
|
||||
leaving the input unchanged. Return pointer to
|
||||
an ephemeral location (only callfor printf,
|
||||
and only once per printf! */
|
||||
const char * sanitized(const char *s);
|
||||
void sanitized_string_destructor(void);
|
||||
void ranges_esb_string_destructor(void);
|
||||
void destruct_abbrev_array(void);
|
||||
|
||||
extern Dwarf_Die current_cu_die_for_print_frames; /* This is
|
||||
an awful hack, making current_cu_die_for_print_frames public.
|
||||
But it enables cleaning up (doing all dealloc needed). */
|
||||
/* defined in print_sections.c, die for the current compile unit,
|
||||
used in get_fde_proc_name() */
|
||||
|
||||
extern void printreg(Dwarf_Unsigned reg,struct dwconf_s *config_data);
|
||||
|
||||
int get_proc_name(Dwarf_Debug dbg, Dwarf_Die die, Dwarf_Addr low_pc,
|
||||
char *proc_name_buf, int proc_name_buf_len, void **pcMap);
|
||||
|
||||
void get_attr_value(Dwarf_Debug dbg, Dwarf_Half tag,
|
||||
Dwarf_Die die,
|
||||
Dwarf_Off die_cu_offset,
|
||||
Dwarf_Attribute attrib,
|
||||
char **srcfiles,
|
||||
Dwarf_Signed cnt, struct esb_s *esbp,
|
||||
int show_form,int local_verbose);
|
||||
|
||||
extern void dump_block(char *prefix, char *data, Dwarf_Signed len);
|
||||
|
||||
extern void format_sig8_string(Dwarf_Sig8 *data,struct esb_s *out);
|
||||
|
||||
extern void print_gdb_index(Dwarf_Debug dbg);
|
||||
extern void print_debugfission_index(Dwarf_Debug dbg,const char *type);
|
||||
|
||||
void dwarfdump_print_one_locdesc(Dwarf_Debug dbg,
|
||||
Dwarf_Locdesc * llbuf, /* 2014 interface */
|
||||
Dwarf_Locdesc_c locs, /* 2015 interface */
|
||||
Dwarf_Unsigned llent, /* Which locdesc is this */
|
||||
Dwarf_Unsigned entrycount, /* count of DW_OP operators */
|
||||
Dwarf_Addr baseaddr,
|
||||
struct esb_s *string_out);
|
||||
void clean_up_die_esb(void);
|
||||
void clean_up_syms_malloc_data(void);
|
||||
void safe_strcpy(char *out, long outlen, const char *in, long inlen);
|
||||
|
||||
void print_macros_5style_this_cu(Dwarf_Debug dbg, Dwarf_Die cu_die,
|
||||
Dwarf_Bool in_import_list, Dwarf_Unsigned offset);
|
||||
|
||||
void reset_overall_CU_error_data(void);
|
||||
|
||||
void format_sig8_string(Dwarf_Sig8*data, struct esb_s *out);
|
||||
|
||||
/* Detailed attributes encoding space */
|
||||
void print_attributes_encoding(Dwarf_Debug dbg);
|
||||
|
||||
/* Detailed tag and attributes usage */
|
||||
void print_tag_attributes_usage(Dwarf_Debug dbg);
|
||||
|
||||
void print_section_groups_data(Dwarf_Debug dbg);
|
||||
void update_section_flags_per_groups(Dwarf_Debug dbg);
|
||||
void groups_restore_subsidiary_flags(void);
|
||||
|
||||
|
||||
void print_any_harmless_errors(Dwarf_Debug dbg);
|
||||
|
||||
#include "section_bitmaps.h"
|
||||
|
||||
#ifdef HAVE_UNUSED_ATTRIBUTE
|
||||
#define UNUSEDARG __attribute__ ((unused))
|
||||
#else
|
||||
#define UNUSEDARG
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* globals_INCLUDED */
|
193
dwarf-compilation.base/contrib/libdwarf/dwarfdump/helpertree.c
Normal file
193
dwarf-compilation.base/contrib/libdwarf/dwarfdump/helpertree.c
Normal file
|
@ -0,0 +1,193 @@
|
|||
/*
|
||||
Copyright 2015-2016 David Anderson. All rights reserved.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of version 2 of the GNU General Public License as
|
||||
published by the Free Software Foundation.
|
||||
|
||||
This program is distributed in the hope that it would be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
Further, this software is distributed without any warranty that it is
|
||||
free of the rightful claim of any third person regarding infringement
|
||||
or the like. Any license provided herein, whether implied or
|
||||
otherwise, applies only to this software file. Patent licenses, if
|
||||
any, provided herein do not apply to combinations of this program with
|
||||
other software, or any other product whatsoever.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write the Free Software Foundation, Inc., 51
|
||||
Franklin Street - Fifth Floor, Boston MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include "globals.h"
|
||||
#include "esb.h"
|
||||
#include "dwarf_tsearch.h"
|
||||
#include "helpertree.h"
|
||||
|
||||
#define TRUE 1
|
||||
#define FALSE 0
|
||||
/* WARNING: the tree walk functions will, if presented **tree
|
||||
when *tree is wanted, simply find nothing. No error,
|
||||
just bad results. So when a walk produces nothing
|
||||
suspect a code mistake here.
|
||||
The basic problem is void* is a terrible way to
|
||||
pass in a pointer. But it's how tsearch was defined
|
||||
long ago.
|
||||
*/
|
||||
/* For .debug_info (not for tied file) */
|
||||
struct Helpertree_Base_s helpertree_offsets_base_info;
|
||||
/* For .debug_types (not for tied file) */
|
||||
struct Helpertree_Base_s helpertree_offsets_base_types;
|
||||
|
||||
static struct Helpertree_Map_Entry_s *
|
||||
helpertree_map_create_entry(Dwarf_Unsigned offset,
|
||||
int val)
|
||||
{
|
||||
struct Helpertree_Map_Entry_s *mp =
|
||||
(struct Helpertree_Map_Entry_s *)
|
||||
calloc(1,sizeof(struct Helpertree_Map_Entry_s));
|
||||
if (!mp) {
|
||||
return 0;
|
||||
}
|
||||
mp->hm_key = offset;
|
||||
mp->hm_val = val;
|
||||
return mp;
|
||||
}
|
||||
static void
|
||||
helpertree_map_free_func(void *mx)
|
||||
{
|
||||
struct Helpertree_Map_Entry_s *m = mx;
|
||||
free(m);
|
||||
}
|
||||
|
||||
static int
|
||||
helpertree_map_compare_func(const void *l, const void *r)
|
||||
{
|
||||
const struct Helpertree_Map_Entry_s *ml = l;
|
||||
const struct Helpertree_Map_Entry_s *mr = r;
|
||||
if (ml->hm_key < mr->hm_key) {
|
||||
return -1;
|
||||
}
|
||||
if (ml->hm_key > mr->hm_key) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
static void
|
||||
helpertree_map_destroy(void *map)
|
||||
{
|
||||
/* tdestroy is not part of Posix. */
|
||||
dwarf_tdestroy(map,helpertree_map_free_func);
|
||||
}
|
||||
|
||||
/* Globally-visible functions follow this line. */
|
||||
|
||||
struct Helpertree_Map_Entry_s *
|
||||
helpertree_add_entry(Dwarf_Unsigned offset,
|
||||
int val,struct Helpertree_Base_s *base)
|
||||
{
|
||||
void *retval = 0;
|
||||
struct Helpertree_Map_Entry_s *re = 0;
|
||||
struct Helpertree_Map_Entry_s *e;
|
||||
void **tree1 = 0;
|
||||
|
||||
tree1 = &base->hb_base;
|
||||
e = helpertree_map_create_entry(offset,val);
|
||||
/* tsearch records e's contents unless e
|
||||
is already present . We must not free it till
|
||||
destroy time if it got added to tree1. */
|
||||
retval = dwarf_tsearch(e,tree1, helpertree_map_compare_func);
|
||||
if (retval) {
|
||||
re = *(struct Helpertree_Map_Entry_s **)retval;
|
||||
if (re != e) {
|
||||
/* We returned an existing record, e not needed.
|
||||
Set val. */
|
||||
re->hm_val = val;
|
||||
helpertree_map_free_func(e);
|
||||
} else {
|
||||
/* Record e got added to tree1, do not free record e. */
|
||||
}
|
||||
return retval;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
struct Helpertree_Map_Entry_s *
|
||||
helpertree_find(Dwarf_Unsigned offset,struct Helpertree_Base_s *base)
|
||||
{
|
||||
void *retval = 0;
|
||||
struct Helpertree_Map_Entry_s *re = 0;
|
||||
struct Helpertree_Map_Entry_s *e = 0;
|
||||
|
||||
e = helpertree_map_create_entry(offset,0);
|
||||
retval = dwarf_tfind(e,&base->hb_base, helpertree_map_compare_func);
|
||||
if (retval) {
|
||||
re = *(struct Helpertree_Map_Entry_s **)retval;
|
||||
}
|
||||
/* The one we created here must be deleted, it is dead.
|
||||
We look at the returned one instead. */
|
||||
helpertree_map_free_func(e);
|
||||
return re;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void
|
||||
helpertree_clear_statistics(struct Helpertree_Base_s *base)
|
||||
{
|
||||
if(!base) {
|
||||
return;
|
||||
}
|
||||
if (!base->hb_base) {
|
||||
return;
|
||||
}
|
||||
helpertree_map_destroy(base->hb_base);
|
||||
base->hb_base = 0;
|
||||
}
|
||||
|
||||
|
||||
#ifdef SELFTEST
|
||||
|
||||
struct Helpertree_Base_s testbase;
|
||||
int main()
|
||||
{
|
||||
struct Helpertree_Map_Entry_s *re = 0;
|
||||
int failcount = 0;
|
||||
|
||||
/* Test 1 */
|
||||
re = helpertree_add_entry(0x1000,0,&testbase);
|
||||
if (!re) {
|
||||
printf("FAIL test1\n");
|
||||
failcount++;
|
||||
}
|
||||
re = helpertree_add_entry(0x2000,0,&testbase);
|
||||
if (!re) {
|
||||
printf("FAIL test2\n");
|
||||
failcount++;
|
||||
}
|
||||
|
||||
re = helpertree_find(0x1000,&testbase);
|
||||
if (!re) {
|
||||
printf("FAIL test3\n");
|
||||
failcount++;
|
||||
}
|
||||
re = helpertree_find(0x2000,&testbase);
|
||||
if (!re) {
|
||||
printf("FAIL test4\n");
|
||||
failcount++;
|
||||
}
|
||||
re = helpertree_find(0x2004,&testbase);
|
||||
if (re) {
|
||||
printf("FAIL test5\n");
|
||||
failcount++;
|
||||
}
|
||||
helpertree_clear_statistics(&testbase);
|
||||
if (failcount) {
|
||||
return 1;
|
||||
}
|
||||
printf("PASS helpertree\n");
|
||||
return 0;
|
||||
}
|
||||
#endif /* SELFTEST */
|
|
@ -0,0 +1,66 @@
|
|||
/*
|
||||
Copyright 2015-2016 David Anderson. All rights reserved.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of version 2 of the GNU General Public License as
|
||||
published by the Free Software Foundation.
|
||||
|
||||
This program is distributed in the hope that it would be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
Further, this software is distributed without any warranty that it is
|
||||
free of the rightful claim of any third person regarding infringement
|
||||
or the like. Any license provided herein, whether implied or
|
||||
otherwise, applies only to this software file. Patent licenses, if
|
||||
any, provided herein do not apply to combinations of this program with
|
||||
other software, or any other product whatsoever.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write the Free Software Foundation, Inc., 51
|
||||
Franklin Street - Fifth Floor, Boston MA 02110-1301, USA.
|
||||
*/
|
||||
#ifndef HELPERTREE_H
|
||||
#define HELPERTREE_H
|
||||
|
||||
/* This is a tsearch tree interface we may use in various ways
|
||||
where each different sort of use is a different Helpertree_Base_s
|
||||
instance. */
|
||||
|
||||
/* We create Helpertree_Base_s so we can use type-checked calls, not
|
||||
showing the tsearch void* outside of helpertree.c. */
|
||||
struct Helpertree_Base_s {
|
||||
void * hb_base;
|
||||
};
|
||||
|
||||
/* For .debug_info */
|
||||
extern struct Helpertree_Base_s helpertree_offsets_base_info;
|
||||
/* For .debug_types. */
|
||||
extern struct Helpertree_Base_s helpertree_offsets_base_types;
|
||||
|
||||
|
||||
struct Helpertree_Map_Entry_s {
|
||||
/* Key is offset. It will be a section-global offset so
|
||||
applicable across an entire executable/object section. */
|
||||
Dwarf_Unsigned hm_key;
|
||||
|
||||
/* val is something defined differently in different uses.
|
||||
for integer type it is
|
||||
0 means unknown
|
||||
-1 known signed
|
||||
1 known unsigned. */
|
||||
int hm_val;
|
||||
/* Add fields here as needed. */
|
||||
};
|
||||
|
||||
/* Add entry or set to known-signed or known-unsigned. */
|
||||
struct Helpertree_Map_Entry_s *
|
||||
helpertree_add_entry( Dwarf_Unsigned offset, int val,
|
||||
struct Helpertree_Base_s *helper);
|
||||
|
||||
/* Look for entry. Use hm_val (if non-null return) to determine signedness. */
|
||||
struct Helpertree_Map_Entry_s *
|
||||
helpertree_find(Dwarf_Unsigned offset,struct Helpertree_Base_s *helper);
|
||||
|
||||
void helpertree_clear_statistics(struct Helpertree_Base_s *helper);
|
||||
#endif /* HELPERTREE_H */
|
119
dwarf-compilation.base/contrib/libdwarf/dwarfdump/install.sh
Executable file
119
dwarf-compilation.base/contrib/libdwarf/dwarfdump/install.sh
Executable file
|
@ -0,0 +1,119 @@
|
|||
#!/bin/sh
|
||||
|
||||
#
|
||||
# install - install a program, script, or datafile
|
||||
# This comes from X11R5; it is not part of GNU.
|
||||
#
|
||||
# $XConsortium: install.sh,v 1.2 89/12/18 14:47:22 jim Exp $
|
||||
#
|
||||
# This script is compatible with the BSD install script, but was written
|
||||
# from scratch.
|
||||
#
|
||||
|
||||
|
||||
# set DOITPROG to echo to test this script
|
||||
|
||||
# Don't use :- since 4.3BSD and earlier shells don't like it.
|
||||
doit="${DOITPROG-}"
|
||||
|
||||
|
||||
# put in absolute paths if you don't have them in your path; or use env. vars.
|
||||
|
||||
mvprog="${MVPROG-mv}"
|
||||
cpprog="${CPPROG-cp}"
|
||||
chmodprog="${CHMODPROG-chmod}"
|
||||
chownprog="${CHOWNPROG-chown}"
|
||||
chgrpprog="${CHGRPPROG-chgrp}"
|
||||
stripprog="${STRIPPROG-strip}"
|
||||
rmprog="${RMPROG-rm}"
|
||||
|
||||
instcmd="$mvprog"
|
||||
chmodcmd=""
|
||||
chowncmd=""
|
||||
chgrpcmd=""
|
||||
stripcmd=""
|
||||
rmcmd="$rmprog -f"
|
||||
mvcmd="$mvprog"
|
||||
src=""
|
||||
dst=""
|
||||
|
||||
while [ x"$1" != x ]; do
|
||||
case $1 in
|
||||
-c) instcmd="$cpprog"
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-m) chmodcmd="$chmodprog $2"
|
||||
shift
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-o) chowncmd="$chownprog $2"
|
||||
shift
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-g) chgrpcmd="$chgrpprog $2"
|
||||
shift
|
||||
shift
|
||||
continue;;
|
||||
|
||||
-s) stripcmd="$stripprog"
|
||||
shift
|
||||
continue;;
|
||||
|
||||
*) if [ x"$src" = x ]
|
||||
then
|
||||
src=$1
|
||||
else
|
||||
dst=$1
|
||||
fi
|
||||
shift
|
||||
continue;;
|
||||
esac
|
||||
done
|
||||
|
||||
if [ x"$src" = x ]
|
||||
then
|
||||
echo "install: no input file specified"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ x"$dst" = x ]
|
||||
then
|
||||
echo "install: no destination specified"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
# If destination is a directory, append the input filename; if your system
|
||||
# does not like double slashes in filenames, you may need to add some logic
|
||||
|
||||
if [ -d $dst ]
|
||||
then
|
||||
dst="$dst"/`basename $src`
|
||||
fi
|
||||
|
||||
# Make a temp file name in the proper directory.
|
||||
|
||||
dstdir=`dirname $dst`
|
||||
dsttmp=$dstdir/#inst.$$#
|
||||
|
||||
# Move or copy the file name to the temp name
|
||||
|
||||
$doit $instcmd $src $dsttmp
|
||||
|
||||
# and set any options; do chmod last to preserve setuid bits
|
||||
|
||||
if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; fi
|
||||
if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; fi
|
||||
if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; fi
|
||||
if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; fi
|
||||
|
||||
# Now rename the file to the real destination.
|
||||
|
||||
$doit $rmcmd $dst
|
||||
$doit $mvcmd $dsttmp $dst
|
||||
|
||||
|
||||
exit 0
|
553
dwarf-compilation.base/contrib/libdwarf/dwarfdump/macrocheck.c
Normal file
553
dwarf-compilation.base/contrib/libdwarf/dwarfdump/macrocheck.c
Normal file
|
@ -0,0 +1,553 @@
|
|||
/*
|
||||
Copyright 2015-2016 David Anderson. All rights reserved.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of version 2 of the GNU General Public License as
|
||||
published by the Free Software Foundation.
|
||||
|
||||
This program is distributed in the hope that it would be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
Further, this software is distributed without any warranty that it is
|
||||
free of the rightful claim of any third person regarding infringement
|
||||
or the like. Any license provided herein, whether implied or
|
||||
otherwise, applies only to this software file. Patent licenses, if
|
||||
any, provided herein do not apply to combinations of this program with
|
||||
other software, or any other product whatsoever.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write the Free Software Foundation, Inc., 51
|
||||
Franklin Street - Fifth Floor, Boston MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include "globals.h"
|
||||
#include "esb.h"
|
||||
#include "dwarf_tsearch.h"
|
||||
#include "macrocheck.h"
|
||||
|
||||
#define TRUE 1
|
||||
#define FALSE 0
|
||||
/* WARNING: the tree walk functions will, if presented **tree
|
||||
when *tree is wanted, simply find nothing. No error,
|
||||
just bad results. So when a walk produces nothing
|
||||
suspect a code mistake here.
|
||||
The basic problem is void* is a terrible way to
|
||||
pass in a pointer. But it's how tsearch was defined
|
||||
long ago.
|
||||
*/
|
||||
|
||||
void * macro_check_tree; /* DWARF5 macros */
|
||||
void * macinfo_check_tree; /* DWARF 2,3,4 macros */
|
||||
|
||||
static struct Macrocheck_Map_Entry_s * macrocheck_map_insert(
|
||||
Dwarf_Unsigned off,
|
||||
unsigned prim,unsigned sec, void **map);
|
||||
static struct Macrocheck_Map_Entry_s * macrocheck_map_find(
|
||||
Dwarf_Unsigned offset,
|
||||
void **map);
|
||||
static void macrocheck_map_destroy(void *map);
|
||||
static Dwarf_Unsigned macro_count_recs(void **base);
|
||||
|
||||
#ifdef SELFTEST
|
||||
int failcount = 0;
|
||||
#endif /* SELFTEST */
|
||||
|
||||
|
||||
static struct Macrocheck_Map_Entry_s *
|
||||
macrocheck_map_create_entry(Dwarf_Unsigned offset,
|
||||
unsigned add_primary, unsigned add_secondary)
|
||||
{
|
||||
struct Macrocheck_Map_Entry_s *mp =
|
||||
(struct Macrocheck_Map_Entry_s *)
|
||||
calloc(1,sizeof(struct Macrocheck_Map_Entry_s));
|
||||
if (!mp) {
|
||||
return 0;
|
||||
}
|
||||
mp->mp_key = offset;
|
||||
mp->mp_len = 0;
|
||||
mp->mp_printed = 0;
|
||||
mp->mp_refcount_primary = add_primary;
|
||||
mp->mp_refcount_secondary = add_secondary;
|
||||
return mp;
|
||||
}
|
||||
static void
|
||||
macrocheck_map_free_func(void *mx)
|
||||
{
|
||||
struct Macrocheck_Map_Entry_s *m = mx;
|
||||
free(m);
|
||||
}
|
||||
|
||||
static int
|
||||
macrocheck_map_compare_func(const void *l, const void *r)
|
||||
{
|
||||
const struct Macrocheck_Map_Entry_s *ml = l;
|
||||
const struct Macrocheck_Map_Entry_s *mr = r;
|
||||
if (ml->mp_key < mr->mp_key) {
|
||||
return -1;
|
||||
}
|
||||
if (ml->mp_key > mr->mp_key) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct Macrocheck_Map_Entry_s *
|
||||
macrocheck_map_insert(Dwarf_Unsigned offset,
|
||||
unsigned add_prim,unsigned add_sec,void **tree1)
|
||||
{
|
||||
void *retval = 0;
|
||||
struct Macrocheck_Map_Entry_s *re = 0;
|
||||
struct Macrocheck_Map_Entry_s *e;
|
||||
e = macrocheck_map_create_entry(offset,add_prim,add_sec);
|
||||
/* tsearch records e's contents unless e
|
||||
is already present . We must not free it till
|
||||
destroy time if it got added to tree1. */
|
||||
retval = dwarf_tsearch(e,tree1, macrocheck_map_compare_func);
|
||||
if (retval) {
|
||||
re = *(struct Macrocheck_Map_Entry_s **)retval;
|
||||
if (re != e) {
|
||||
/* We returned an existing record, e not needed.
|
||||
Increment refcounts. */
|
||||
re->mp_refcount_primary += add_prim;
|
||||
re->mp_refcount_secondary += add_sec;
|
||||
macrocheck_map_free_func(e);
|
||||
} else {
|
||||
/* Record e got added to tree1, do not free record e. */
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static struct Macrocheck_Map_Entry_s *
|
||||
macrocheck_map_find(Dwarf_Unsigned offset,void **tree1)
|
||||
{
|
||||
void *retval = 0;
|
||||
struct Macrocheck_Map_Entry_s *re = 0;
|
||||
struct Macrocheck_Map_Entry_s *e = 0;
|
||||
|
||||
e = macrocheck_map_create_entry(offset,0,0);
|
||||
retval = dwarf_tfind(e,tree1, macrocheck_map_compare_func);
|
||||
if (retval) {
|
||||
re = *(struct Macrocheck_Map_Entry_s **)retval;
|
||||
}
|
||||
/* The one we created here must be deleted, it is dead.
|
||||
We look at the returned one instead. */
|
||||
macrocheck_map_free_func(e);
|
||||
return re;
|
||||
}
|
||||
|
||||
static void
|
||||
macrocheck_map_destroy(void *map)
|
||||
{
|
||||
/* tdestroy is not part of Posix. */
|
||||
dwarf_tdestroy(map,macrocheck_map_free_func);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
add_macro_import(void **base,Dwarf_Bool is_primary,Dwarf_Unsigned offset)
|
||||
{
|
||||
Dwarf_Unsigned prim_count = 0;
|
||||
Dwarf_Unsigned sec_count = 0;
|
||||
|
||||
if(is_primary) {
|
||||
prim_count = 1;
|
||||
} else {
|
||||
sec_count = 1;
|
||||
}
|
||||
macrocheck_map_insert(offset,prim_count,sec_count,base);
|
||||
}
|
||||
void
|
||||
add_macro_import_sup(UNUSEDARG void **base,
|
||||
UNUSEDARG Dwarf_Unsigned offset)
|
||||
{
|
||||
/* FIXME */
|
||||
return;
|
||||
}
|
||||
void
|
||||
add_macro_area_len(void **base, Dwarf_Unsigned offset,
|
||||
Dwarf_Unsigned len)
|
||||
{
|
||||
struct Macrocheck_Map_Entry_s *re = 0;
|
||||
|
||||
re = macrocheck_map_find(offset,base);
|
||||
if (re) {
|
||||
re->mp_len = len;
|
||||
}
|
||||
}
|
||||
|
||||
static Dwarf_Unsigned reccount = 0;
|
||||
|
||||
static void
|
||||
macro_walk_count_recs(UNUSEDARG const void *nodep,
|
||||
const DW_VISIT which,
|
||||
UNUSEDARG const int depth)
|
||||
{
|
||||
if (which == dwarf_postorder || which == dwarf_endorder) {
|
||||
return;
|
||||
}
|
||||
reccount += 1;
|
||||
}
|
||||
static Dwarf_Unsigned
|
||||
macro_count_recs(void **base)
|
||||
{
|
||||
reccount = 0;
|
||||
dwarf_twalk(*base,macro_walk_count_recs);
|
||||
return reccount;
|
||||
}
|
||||
|
||||
static Dwarf_Unsigned lowestoff = 0;
|
||||
static Dwarf_Bool lowestfound = FALSE;
|
||||
static void
|
||||
macro_walk_find_lowest(const void *nodep,const DW_VISIT which,
|
||||
UNUSEDARG const int depth)
|
||||
{
|
||||
struct Macrocheck_Map_Entry_s * re =
|
||||
*(struct Macrocheck_Map_Entry_s**)nodep;
|
||||
|
||||
if (which == dwarf_postorder || which == dwarf_endorder) {
|
||||
return;
|
||||
}
|
||||
if (!re->mp_printed) {
|
||||
if (lowestfound) {
|
||||
if (lowestoff > re->mp_key) {
|
||||
lowestoff = re->mp_key;
|
||||
}
|
||||
} else {
|
||||
lowestfound = TRUE;
|
||||
lowestoff = re->mp_key;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int
|
||||
get_next_unprinted_macro_offset(void **tree, Dwarf_Unsigned * off)
|
||||
{
|
||||
lowestfound = FALSE;
|
||||
lowestoff = 0;
|
||||
|
||||
/* This walks the tree to find one entry.
|
||||
Which could get slow if the tree has lots of entries. */
|
||||
dwarf_twalk(*tree,macro_walk_find_lowest);
|
||||
if (!lowestfound) {
|
||||
return DW_DLV_NO_ENTRY;
|
||||
}
|
||||
*off = lowestoff;
|
||||
return DW_DLV_OK;
|
||||
}
|
||||
|
||||
void
|
||||
mark_macro_offset_printed(void **base, Dwarf_Unsigned offset)
|
||||
{
|
||||
struct Macrocheck_Map_Entry_s *re = 0;
|
||||
|
||||
re = macrocheck_map_find(offset,base);
|
||||
if (re) {
|
||||
re->mp_printed = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static struct Macrocheck_Map_Entry_s **mac_as_array = 0;
|
||||
static unsigned mac_as_array_next = 0;
|
||||
static void
|
||||
macro_walk_to_array(const void *nodep,const DW_VISIT which,
|
||||
UNUSEDARG const int depth)
|
||||
{
|
||||
struct Macrocheck_Map_Entry_s * re =
|
||||
*(struct Macrocheck_Map_Entry_s**)nodep;
|
||||
|
||||
if (which == dwarf_postorder || which == dwarf_endorder) {
|
||||
return;
|
||||
}
|
||||
mac_as_array[mac_as_array_next] = re;
|
||||
mac_as_array_next++;
|
||||
}
|
||||
|
||||
static int
|
||||
qsort_compare(const void *lin, const void *rin)
|
||||
{
|
||||
const struct Macrocheck_Map_Entry_s *l =
|
||||
*(const struct Macrocheck_Map_Entry_s **)lin;
|
||||
const struct Macrocheck_Map_Entry_s *r =
|
||||
*(const struct Macrocheck_Map_Entry_s **)rin;
|
||||
if (l->mp_key < r->mp_key) {
|
||||
return -1;
|
||||
}
|
||||
if (l->mp_key > r->mp_key) {
|
||||
return 1;
|
||||
}
|
||||
if (l->mp_len < r->mp_len) {
|
||||
return -1;
|
||||
}
|
||||
if (l->mp_len > r->mp_len) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
print_macro_statistics(const char *name,void **tsbase,
|
||||
Dwarf_Unsigned section_size)
|
||||
{
|
||||
Dwarf_Unsigned count = 0;
|
||||
Dwarf_Unsigned lowest = -1ll;
|
||||
Dwarf_Unsigned highest = 0;
|
||||
Dwarf_Unsigned lastend = 0;
|
||||
Dwarf_Unsigned laststart = 0;
|
||||
Dwarf_Unsigned internalgap = 0;
|
||||
Dwarf_Unsigned wholegap = 0;
|
||||
Dwarf_Unsigned i = 0;
|
||||
|
||||
if(! *tsbase) {
|
||||
return;
|
||||
}
|
||||
count = macro_count_recs(tsbase);
|
||||
if (count < 1) {
|
||||
return;
|
||||
}
|
||||
free(mac_as_array);
|
||||
mac_as_array = 0;
|
||||
mac_as_array_next = 0;
|
||||
mac_as_array = (struct Macrocheck_Map_Entry_s **)calloc(count,
|
||||
sizeof(struct Macrocheck_Map_Entry_s *));
|
||||
if(!mac_as_array) {
|
||||
#ifdef SELFTEST
|
||||
++failcount;
|
||||
#endif
|
||||
printf(" Macro checking ERROR %s: "
|
||||
"unable to allocate %" DW_PR_DUu "pointers\n",
|
||||
name,
|
||||
count);
|
||||
return;
|
||||
}
|
||||
dwarf_twalk(*tsbase,macro_walk_to_array);
|
||||
printf(" Macro unit count %s: %" DW_PR_DUu "\n",name,count);
|
||||
qsort(mac_as_array,
|
||||
count,sizeof(struct Macrocheck_Map_Entry_s *),
|
||||
qsort_compare);
|
||||
for (i = 0; i < count ; ++i) {
|
||||
Dwarf_Unsigned end = 0;
|
||||
struct Macrocheck_Map_Entry_s *r = mac_as_array[i];
|
||||
#if 0
|
||||
printf("debugging: i %u off 0x%x len 0x%x printed? %u "
|
||||
" ref prim: %u sec: %u\n",
|
||||
(unsigned)i,
|
||||
(unsigned)r->mp_key,
|
||||
(unsigned)r->mp_len,
|
||||
(unsigned)r->mp_printed,
|
||||
(unsigned)r->mp_refcount_primary,
|
||||
(unsigned)r->mp_refcount_secondary);
|
||||
#endif
|
||||
if (r->mp_key < lowest) {
|
||||
lowest = r->mp_key;
|
||||
}
|
||||
end = r->mp_key + r->mp_len;
|
||||
if (end > highest) {
|
||||
highest = end;
|
||||
}
|
||||
if (r->mp_refcount_primary > 1) {
|
||||
#ifdef SELFTEST
|
||||
++failcount;
|
||||
#endif
|
||||
printf(" ERROR: For offset 0x%" DW_PR_XZEROS DW_PR_DUx
|
||||
" %" DW_PR_DUu
|
||||
" there is a primary count of "
|
||||
"0x%" DW_PR_XZEROS DW_PR_DUx
|
||||
" %" DW_PR_DUu "\n",
|
||||
r->mp_key,
|
||||
r->mp_key,
|
||||
r->mp_refcount_primary,
|
||||
r->mp_refcount_primary);
|
||||
}
|
||||
if (r->mp_refcount_primary && r->mp_refcount_secondary) {
|
||||
#ifdef SELFTEST
|
||||
++failcount;
|
||||
#endif
|
||||
printf(" ERROR: For offset 0x%" DW_PR_XZEROS DW_PR_DUx
|
||||
" %" DW_PR_DUu
|
||||
" there is a nonzero primary count of "
|
||||
"0x%" DW_PR_XZEROS DW_PR_DUx
|
||||
" %" DW_PR_DUu
|
||||
" with a secondary count of "
|
||||
"0x%" DW_PR_XZEROS DW_PR_DUx
|
||||
" %" DW_PR_DUu
|
||||
"\n",
|
||||
r->mp_key,
|
||||
r->mp_key,
|
||||
r->mp_refcount_primary,
|
||||
r->mp_refcount_primary,
|
||||
r->mp_refcount_secondary,
|
||||
r->mp_refcount_secondary);
|
||||
}
|
||||
}
|
||||
lastend =
|
||||
mac_as_array[0]->mp_key +
|
||||
mac_as_array[0]->mp_len;
|
||||
laststart = mac_as_array[0]->mp_key;
|
||||
printf(" Macro Offsets start at 0x%" DW_PR_XZEROS DW_PR_DUx
|
||||
" and end at 0x%" DW_PR_XZEROS DW_PR_DUx "\n",
|
||||
lowest, highest);
|
||||
for (i = 1; i < count ; ++i) {
|
||||
struct Macrocheck_Map_Entry_s *r = mac_as_array[i];
|
||||
#if 0
|
||||
printf("debugging i %u off 0x%x len 0x%x\n",
|
||||
(unsigned)i,
|
||||
(unsigned)r->mp_key,
|
||||
(unsigned)r->mp_len);
|
||||
#endif
|
||||
if (r->mp_key > lastend) {
|
||||
internalgap += (r->mp_key - lastend);
|
||||
} else if (r->mp_key < lastend) {
|
||||
/* crazy overlap */
|
||||
#ifdef SELFTEST
|
||||
++failcount;
|
||||
#endif
|
||||
printf(" ERROR: For offset 0x%" DW_PR_XZEROS DW_PR_DUx
|
||||
" %" DW_PR_DUu
|
||||
" there is a crazy overlap with the previous end offset of "
|
||||
"0x%" DW_PR_XZEROS DW_PR_DUx
|
||||
" %" DW_PR_DUu
|
||||
" (previous start offset of 0x%" DW_PR_XZEROS DW_PR_DUx ")"
|
||||
" %" DW_PR_DUu
|
||||
"\n",
|
||||
r->mp_key,
|
||||
r->mp_key,
|
||||
lastend,
|
||||
lastend,
|
||||
laststart,
|
||||
laststart);
|
||||
}
|
||||
laststart = r->mp_key;
|
||||
lastend = laststart + r->mp_len;
|
||||
}
|
||||
/* wholegap is a) starting offset > 0 and b)
|
||||
space after used area before end of section. */
|
||||
wholegap = mac_as_array[0]->mp_key + internalgap;
|
||||
if (lastend > section_size) {
|
||||
/* Something seriously wrong */
|
||||
#ifdef SELFTEST
|
||||
++failcount;
|
||||
#endif
|
||||
printf(" ERROR: For offset 0x%" DW_PR_XZEROS DW_PR_DUx
|
||||
" %" DW_PR_DUu
|
||||
" there is an overlap with the end of section "
|
||||
"0x%" DW_PR_XZEROS DW_PR_DUx
|
||||
" %" DW_PR_DUu
|
||||
"\n",laststart,laststart,
|
||||
lastend, lastend);
|
||||
} else {
|
||||
wholegap += (section_size - lastend);
|
||||
}
|
||||
if(wholegap) {
|
||||
printf(" Macro Offsets internal unused space: "
|
||||
"0x%" DW_PR_XZEROS DW_PR_DUx
|
||||
"\n",
|
||||
internalgap);
|
||||
printf(" Macro Offsets total unused space: "
|
||||
"0x%" DW_PR_XZEROS DW_PR_DUx
|
||||
"\n",
|
||||
wholegap);
|
||||
}
|
||||
free (mac_as_array);
|
||||
mac_as_array = 0;
|
||||
mac_as_array_next = 0;
|
||||
}
|
||||
|
||||
void
|
||||
clear_macro_statistics(void **tsbase)
|
||||
{
|
||||
if(! *tsbase) {
|
||||
return;
|
||||
}
|
||||
macrocheck_map_destroy(*tsbase);
|
||||
*tsbase = 0;
|
||||
}
|
||||
|
||||
|
||||
#ifdef SELFTEST
|
||||
int
|
||||
main()
|
||||
{
|
||||
void * base = 0;
|
||||
Dwarf_Unsigned count = 0;
|
||||
int basefailcount = 0;
|
||||
|
||||
/* Test 1 */
|
||||
add_macro_import(&base,TRUE,200);
|
||||
count = macro_count_recs(&base);
|
||||
if (count != 1) {
|
||||
printf("FAIL: expect count 1, got %" DW_PR_DUu "\n",count);
|
||||
++failcount;
|
||||
}
|
||||
print_macro_statistics("test1",&base,2000);
|
||||
|
||||
/* Test two */
|
||||
add_macro_area_len(&base,200,100);
|
||||
add_macro_import(&base,FALSE,350);
|
||||
add_macro_area_len(&base,350,100);
|
||||
count = macro_count_recs(&base);
|
||||
if (count != 2) {
|
||||
printf("FAIL: expect count 2, got %" DW_PR_DUu "\n",count);
|
||||
++failcount;
|
||||
}
|
||||
print_macro_statistics("test 2",&base,2000);
|
||||
clear_macro_statistics(&base);
|
||||
|
||||
/* Test three */
|
||||
basefailcount = failcount;
|
||||
add_macro_import(&base,TRUE,0);
|
||||
add_macro_area_len(&base,0,1000);
|
||||
add_macro_import(&base,FALSE,2000);
|
||||
add_macro_area_len(&base,2000,100);
|
||||
mark_macro_offset_printed(&base,2000);
|
||||
add_macro_import(&base,FALSE,1000);
|
||||
add_macro_area_len(&base,1000,900);
|
||||
add_macro_import(&base,FALSE,1000);
|
||||
add_macro_area_len(&base,1000,900);
|
||||
count = macro_count_recs(&base);
|
||||
if (count != 3) {
|
||||
printf("FAIL: expect count 3, got %" DW_PR_DUu "\n",count);
|
||||
++failcount;
|
||||
}
|
||||
printf("\n Expect an ERROR about overlap with "
|
||||
"the end of section\n");
|
||||
print_macro_statistics("test 3",&base,2000);
|
||||
clear_macro_statistics(&base);
|
||||
if ((basefailcount+1) != failcount) {
|
||||
printf("FAIL: Found no error in test 3 checking!\n");
|
||||
++failcount;
|
||||
} else {
|
||||
failcount = basefailcount;
|
||||
}
|
||||
|
||||
/* Test Four */
|
||||
basefailcount = failcount;
|
||||
add_macro_import(&base,TRUE,50);
|
||||
add_macro_import(&base,TRUE,50);
|
||||
add_macro_area_len(&base,50,50);
|
||||
add_macro_import(&base,FALSE,200);
|
||||
add_macro_import(&base,FALSE,50);
|
||||
add_macro_import(&base,FALSE,60);
|
||||
add_macro_area_len(&base,60,10);
|
||||
printf( "\n Expect an ERROR about offset 50 having 2 primaries\n");
|
||||
printf( " and Expect an ERROR about offset 50 having 2\n"
|
||||
" primaries"
|
||||
" and a secondary\n");
|
||||
printf( " and Expect an ERROR about crazy overlap 60\n\n");
|
||||
print_macro_statistics("test 4",&base,2000);
|
||||
clear_macro_statistics(&base);
|
||||
if ((basefailcount + 3) != failcount) {
|
||||
printf("FAIL: Found wrong errors in test 4 checking!\n");
|
||||
} else {
|
||||
failcount = basefailcount;
|
||||
}
|
||||
if (failcount > 0) {
|
||||
printf("FAIL macrocheck selftest\n");
|
||||
exit(1);
|
||||
}
|
||||
printf("PASS macrocheck selftest\n");
|
||||
return 0;
|
||||
}
|
||||
#endif /* SELFTEST */
|
|
@ -0,0 +1,51 @@
|
|||
/*
|
||||
Copyright 2015-2016 David Anderson. All rights reserved.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of version 2 of the GNU General Public License as
|
||||
published by the Free Software Foundation.
|
||||
|
||||
This program is distributed in the hope that it would be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
Further, this software is distributed without any warranty that it is
|
||||
free of the rightful claim of any third person regarding infringement
|
||||
or the like. Any license provided herein, whether implied or
|
||||
otherwise, applies only to this software file. Patent licenses, if
|
||||
any, provided herein do not apply to combinations of this program with
|
||||
other software, or any other product whatsoever.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write the Free Software Foundation, Inc., 51
|
||||
Franklin Street - Fifth Floor, Boston MA 02110-1301, USA.
|
||||
*/
|
||||
#ifndef MACROCHECK_H
|
||||
#define MACROCHECK_H
|
||||
|
||||
struct Macrocheck_Map_Entry_s {
|
||||
Dwarf_Unsigned mp_key; /* Key is offset */
|
||||
Dwarf_Unsigned mp_len; /* len in bytes off this macro set */
|
||||
|
||||
/* We count number of uses. More than 1 primary is an error.
|
||||
Both primary and secondary is ok or error? */
|
||||
Dwarf_Unsigned mp_refcount_primary;
|
||||
Dwarf_Unsigned mp_refcount_secondary;
|
||||
|
||||
/* So we go through each one just once. */
|
||||
Dwarf_Bool mp_printed;
|
||||
};
|
||||
|
||||
void add_macro_import(void **base,Dwarf_Bool is_primary,
|
||||
Dwarf_Unsigned offset);
|
||||
void add_macro_import_sup(void **base,Dwarf_Unsigned offset);
|
||||
void add_macro_area_len(void **base, Dwarf_Unsigned offset,
|
||||
Dwarf_Unsigned len);
|
||||
|
||||
int get_next_unprinted_macro_offset(void **base, Dwarf_Unsigned * off);
|
||||
void mark_macro_offset_printed(void **base, Dwarf_Unsigned offset);
|
||||
|
||||
void print_macro_statistics(const char *name,void **basep,
|
||||
Dwarf_Unsigned section_size);
|
||||
void clear_macro_statistics(void **basep);
|
||||
#endif /* MACROCHECK_H */
|
168
dwarf-compilation.base/contrib/libdwarf/dwarfdump/makename.c
Normal file
168
dwarf-compilation.base/contrib/libdwarf/dwarfdump/makename.c
Normal file
|
@ -0,0 +1,168 @@
|
|||
/*
|
||||
Copyright (C) 2000,2004 Silicon Graphics, Inc. All Rights Reserved.
|
||||
Portions Copyright(C) David Anderson 2016. All Rights reserved.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of version 2 of the GNU General Public License as
|
||||
published by the Free Software Foundation.
|
||||
|
||||
This program is distributed in the hope that it would be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
Further, this software is distributed without any warranty that it is
|
||||
free of the rightful claim of any third person regarding infringement
|
||||
or the like. Any license provided herein, whether implied or
|
||||
otherwise, applies only to this software file. Patent licenses, if
|
||||
any, provided herein do not apply to combinations of this program with
|
||||
other software, or any other product whatsoever.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write the Free Software Foundation, Inc., 51
|
||||
Franklin Street - Fifth Floor, Boston MA 02110-1301, USA.
|
||||
|
||||
makename.c
|
||||
$Revision: 1.4 $
|
||||
$Date: 2005/11/08 21:48:42 $
|
||||
|
||||
This used to be elaborate stuff.
|
||||
Now it is trivial, as duplicating names is
|
||||
unimportant in dwarfdump (in general).
|
||||
|
||||
And in fact, this is only called for attributes and
|
||||
tags etc whose true name is unknown. Not for
|
||||
any normal case.
|
||||
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include "dwarf_tsearch.h"
|
||||
#include "makename.h"
|
||||
#include "globals.h"
|
||||
|
||||
#ifdef _WIN32
|
||||
#pragma warning(disable:4996) /* Warning when migrated to VS2010 */
|
||||
#endif /* _WIN32 */
|
||||
|
||||
#define TRUE 1
|
||||
#define FALSE 0
|
||||
|
||||
static void * makename_data;
|
||||
#define VALTYPE char *
|
||||
#define DW_TSHASHTYPE char *
|
||||
|
||||
static int
|
||||
value_compare_func(const void *l, const void *r)
|
||||
{
|
||||
VALTYPE ml = (VALTYPE)l;
|
||||
VALTYPE mr = (VALTYPE)r;
|
||||
return strcmp(ml,mr);
|
||||
}
|
||||
/* Nothing to free for the 'value' example. */
|
||||
static void
|
||||
value_node_free(void *valp)
|
||||
{
|
||||
VALTYPE v = (VALTYPE)valp;
|
||||
free(v);
|
||||
}
|
||||
|
||||
void
|
||||
makename_destructor(void)
|
||||
{
|
||||
dwarf_tdestroy(makename_data,value_node_free);
|
||||
makename_data = 0;
|
||||
}
|
||||
|
||||
/* WARNING: the tree walk functions will, if presented **tree
|
||||
when *tree is wanted, simply find nothing. No error,
|
||||
just bad results. So when a walk produces nothing
|
||||
suspect a code mistake here.
|
||||
The basic problem is void* is a terrible way to
|
||||
pass in a pointer. But it's how tsearch was defined
|
||||
long ago.
|
||||
*/
|
||||
|
||||
char *
|
||||
makename(const char *s)
|
||||
{
|
||||
char *newstr = 0;
|
||||
VALTYPE re = 0;
|
||||
void *retval = 0;
|
||||
|
||||
if (!s) {
|
||||
return "";
|
||||
}
|
||||
#ifdef SELFTEST
|
||||
printf("Selftest with name %s\n",s);
|
||||
#endif
|
||||
|
||||
newstr = (char *)strdup(s);
|
||||
retval = dwarf_tfind(newstr,&makename_data, value_compare_func);
|
||||
if (retval) {
|
||||
/* We found our string, it existed already. */
|
||||
re = *(VALTYPE *)retval;
|
||||
free(newstr);
|
||||
return re;
|
||||
}
|
||||
retval = dwarf_tsearch(newstr,&makename_data, value_compare_func);
|
||||
if (!retval) {
|
||||
/* Out of memory, lets just use the string we dup'd and
|
||||
let it leak. Things will surely fail anyway. */
|
||||
return newstr;
|
||||
}
|
||||
re = *(VALTYPE *)retval;
|
||||
return re;
|
||||
}
|
||||
|
||||
/* We will make a search tree using a simple value
|
||||
(the pointer from an strdup) */
|
||||
|
||||
|
||||
|
||||
|
||||
#ifdef SELFTEST
|
||||
|
||||
char *samples[] = {
|
||||
"abcd",
|
||||
"efgh",
|
||||
"a",
|
||||
"abcd",
|
||||
0
|
||||
};
|
||||
|
||||
int main()
|
||||
{
|
||||
char *e1 = 0;
|
||||
char *e2= 0;
|
||||
char *e3= 0;
|
||||
char *e4= 0;
|
||||
int j = 0;
|
||||
int errct = 0;
|
||||
|
||||
|
||||
e1 = makename(samples[0]);
|
||||
e2 = makename(samples[1]);
|
||||
e3 = makename(samples[2]);
|
||||
e4 = makename(samples[3]);
|
||||
|
||||
if (e1 != e4) {
|
||||
printf(" FAIL. mismatch pointers\n");
|
||||
++errct;
|
||||
}
|
||||
if (e1 == e2 ) {
|
||||
printf(" FAIL. match pointers\n");
|
||||
++errct;
|
||||
}
|
||||
if ( e1 == e3) {
|
||||
printf(" FAIL. match pointers\n");
|
||||
++errct;
|
||||
}
|
||||
if (errct) {
|
||||
exit(1);
|
||||
}
|
||||
printf("PASS makename test\n");
|
||||
return 0;
|
||||
}
|
||||
#endif /* SELFTEST */
|
48
dwarf-compilation.base/contrib/libdwarf/dwarfdump/makename.h
Normal file
48
dwarf-compilation.base/contrib/libdwarf/dwarfdump/makename.h
Normal file
|
@ -0,0 +1,48 @@
|
|||
#ifndef names_h
|
||||
#define names_h
|
||||
/*
|
||||
Copyright (C) 2000,2004 Silicon Graphics, Inc. All Rights Reserved.
|
||||
Portions Copyright 2011-2016 David Anderson. All Rights Reserved.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of version 2 of the GNU General Public License as
|
||||
published by the Free Software Foundation.
|
||||
|
||||
This program is distributed in the hope that it would be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
Further, this software is distributed without any warranty that it is
|
||||
free of the rightful claim of any third person regarding infringement
|
||||
or the like. Any license provided herein, whether implied or
|
||||
otherwise, applies only to this software file. Patent licenses, if
|
||||
any, provided herein do not apply to combinations of this program with
|
||||
other software, or any other product whatsoever.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write the Free Software Foundation, Inc., 51
|
||||
Franklin Street - Fifth Floor, Boston MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
/* makename.h
|
||||
$Revision: 1.3 $
|
||||
$Date: 2004/10/28 22:26:58 $
|
||||
|
||||
This is for putting strings into stable storage.
|
||||
|
||||
Effectively an strdup() wrapper.
|
||||
|
||||
Rarely called.
|
||||
|
||||
It leaks memory, (the memory
|
||||
is never freed) but that seems unimportant since
|
||||
use of this is very rare.
|
||||
*/
|
||||
|
||||
char * makename(const char *); /* Makes a copy of the string in
|
||||
a malloc area. Can never return 0. */
|
||||
|
||||
/* Destroy all makename data. Do just before exit. */
|
||||
void makename_destructor(void);
|
||||
|
||||
#endif
|
260
dwarf-compilation.base/contrib/libdwarf/dwarfdump/naming.c
Normal file
260
dwarf-compilation.base/contrib/libdwarf/dwarfdump/naming.c
Normal file
|
@ -0,0 +1,260 @@
|
|||
/*
|
||||
Copyright (C) 2000-2005 Silicon Graphics, Inc. All Rights Reserved.
|
||||
Portions Copyright (C) 2007-2012 David Anderson. All Rights Reserved.
|
||||
Portions Copyright (C) 2010-2012 SN Systems Ltd. All Rights Reserved.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of version 2 of the GNU General Public License as
|
||||
published by the Free Software Foundation.
|
||||
|
||||
This program is distributed in the hope that it would be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
Further, this software is distributed without any warranty that it is
|
||||
free of the rightful claim of any third person regarding infringement
|
||||
or the like. Any license provided herein, whether implied or
|
||||
otherwise, applies only to this software file. Patent licenses, if
|
||||
any, provided herein do not apply to combinations of this program with
|
||||
other software, or any other product whatsoever.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write the Free Software Foundation, Inc., 51
|
||||
Franklin Street - Fifth Floor, Boston MA 02110-1301, USA.
|
||||
|
||||
*/
|
||||
|
||||
/* The address of the Free Software Foundation is
|
||||
Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
SGI has moved from the Crittenden Lane address.
|
||||
*/
|
||||
|
||||
|
||||
|
||||
/* naming.c */
|
||||
#include "globals.h"
|
||||
#include "dwarf.h"
|
||||
#include "libdwarf.h"
|
||||
#include "makename.h"
|
||||
#include "naming.h"
|
||||
|
||||
static const char *
|
||||
skipunder(const char *v)
|
||||
{
|
||||
const char *cp = v;
|
||||
int undercount = 0;
|
||||
for (; *cp ; ++cp) {
|
||||
if (*cp == '_') {
|
||||
++undercount;
|
||||
if (undercount == 2) {
|
||||
return cp+1;
|
||||
}
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
static const char *
|
||||
ellipname(int res, int val_in, const char *v,const char *ty,int printonerr)
|
||||
{
|
||||
#ifndef TRIVIAL_NAMING
|
||||
if (glflags.gf_check_dwarf_constants && checking_this_compiler()) {
|
||||
DWARF_CHECK_COUNT(dwarf_constants_result,1);
|
||||
}
|
||||
#endif
|
||||
if (res != DW_DLV_OK) {
|
||||
char buf[100];
|
||||
char *n;
|
||||
snprintf(buf,sizeof(buf),"<Unknown %s value 0x%x>",ty,val_in);
|
||||
/* Capture any name error in DWARF constants */
|
||||
#ifndef TRIVIAL_NAMING
|
||||
if (printonerr && glflags.gf_check_dwarf_constants &&
|
||||
checking_this_compiler()) {
|
||||
if (glflags.gf_check_verbose_mode) {
|
||||
fprintf(stderr,"%s of %d (0x%x) is unknown to dwarfdump. "
|
||||
"Continuing. \n",ty,val_in,val_in );
|
||||
}
|
||||
DWARF_ERROR_COUNT(dwarf_constants_result,1);
|
||||
DWARF_CHECK_ERROR_PRINT_CU();
|
||||
}
|
||||
#else
|
||||
/* This is for the tree-generation, not dwarfdump itself. */
|
||||
if (printonerr) {
|
||||
fprintf(stderr,"%s of %d (0x%x) is unknown to dwarfdump. "
|
||||
"Continuing. \n",ty,val_in,val_in );
|
||||
}
|
||||
#endif
|
||||
n = makename(buf);
|
||||
return n;
|
||||
}
|
||||
if (ellipsis) {
|
||||
return skipunder(v);
|
||||
}
|
||||
return v;
|
||||
}
|
||||
|
||||
const char * get_TAG_name(unsigned int val_in,int printonerr)
|
||||
{
|
||||
const char *v = 0;
|
||||
int res = dwarf_get_TAG_name(val_in,&v);
|
||||
return ellipname(res,val_in,v,"TAG",printonerr);
|
||||
}
|
||||
const char * get_children_name(unsigned int val_in,int printonerr)
|
||||
{
|
||||
const char *v = 0;
|
||||
int res = dwarf_get_children_name(val_in,&v);
|
||||
return ellipname(res,val_in,v,"children",printonerr);
|
||||
}
|
||||
const char * get_FORM_name(unsigned int val_in,int printonerr)
|
||||
{
|
||||
const char *v = 0;
|
||||
int res = dwarf_get_FORM_name(val_in,&v);
|
||||
return ellipname(res,val_in,v,"FORM",printonerr);
|
||||
}
|
||||
const char * get_AT_name(unsigned int val_in,int printonerr)
|
||||
{
|
||||
const char *v = 0;
|
||||
int res = dwarf_get_AT_name(val_in,&v);
|
||||
return ellipname(res,val_in,v,"AT",printonerr);
|
||||
}
|
||||
const char * get_OP_name(unsigned int val_in,int printonerr)
|
||||
{
|
||||
const char *v = 0;
|
||||
int res = dwarf_get_OP_name(val_in,&v);
|
||||
return ellipname(res,val_in,v,"OP",printonerr);
|
||||
}
|
||||
const char * get_ATE_name(unsigned int val_in,int printonerr)
|
||||
{
|
||||
const char *v = 0;
|
||||
int res = dwarf_get_ATE_name(val_in,&v);
|
||||
return ellipname(res,val_in,v,"ATE",printonerr);
|
||||
}
|
||||
const char * get_DS_name(unsigned int val_in,int printonerr)
|
||||
{
|
||||
const char *v = 0;
|
||||
int res = dwarf_get_DS_name(val_in,&v);
|
||||
return ellipname(res,val_in,v,"DS",printonerr);
|
||||
}
|
||||
const char * get_END_name(unsigned int val_in,int printonerr)
|
||||
{
|
||||
const char *v = 0;
|
||||
int res = dwarf_get_END_name(val_in,&v);
|
||||
return ellipname(res,val_in,v,"END",printonerr);
|
||||
}
|
||||
const char * get_ATCF_name(unsigned int val_in,int printonerr)
|
||||
{
|
||||
const char *v = 0;
|
||||
int res = dwarf_get_ATCF_name(val_in,&v);
|
||||
return ellipname(res,val_in,v,"ATCF",printonerr);
|
||||
}
|
||||
const char * get_ACCESS_name(unsigned int val_in,int printonerr)
|
||||
{
|
||||
const char *v = 0;
|
||||
int res = dwarf_get_ACCESS_name(val_in,&v);
|
||||
return ellipname(res,val_in,v,"ACCESS",printonerr);
|
||||
}
|
||||
const char * get_VIS_name(unsigned int val_in,int printonerr)
|
||||
{
|
||||
const char *v = 0;
|
||||
int res = dwarf_get_VIS_name(val_in,&v);
|
||||
return ellipname(res,val_in,v,"VIS",printonerr);
|
||||
}
|
||||
const char * get_VIRTUALITY_name(unsigned int val_in,int printonerr)
|
||||
{
|
||||
const char *v = 0;
|
||||
int res = dwarf_get_VIRTUALITY_name(val_in,&v);
|
||||
return ellipname(res,val_in,v,"VIRTUALITY",printonerr);
|
||||
}
|
||||
const char * get_LANG_name(unsigned int val_in,int printonerr)
|
||||
{
|
||||
const char *v = 0;
|
||||
int res = dwarf_get_LANG_name(val_in,&v);
|
||||
return ellipname(res,val_in,v,"LANG",printonerr);
|
||||
}
|
||||
const char * get_ID_name(unsigned int val_in,int printonerr)
|
||||
{
|
||||
const char *v = 0;
|
||||
int res = dwarf_get_ID_name(val_in,&v);
|
||||
return ellipname(res,val_in,v,"ID",printonerr);
|
||||
}
|
||||
const char * get_CC_name(unsigned int val_in,int printonerr)
|
||||
{
|
||||
const char *v = 0;
|
||||
int res = dwarf_get_CC_name(val_in,&v);
|
||||
return ellipname(res,val_in,v,"CC",printonerr);
|
||||
}
|
||||
const char * get_INL_name(unsigned int val_in,int printonerr)
|
||||
{
|
||||
const char *v = 0;
|
||||
int res = dwarf_get_INL_name(val_in,&v);
|
||||
return ellipname(res,val_in,v,"INL",printonerr);
|
||||
}
|
||||
const char * get_ORD_name(unsigned int val_in,int printonerr)
|
||||
{
|
||||
const char *v = 0;
|
||||
int res = dwarf_get_ORD_name(val_in,&v);
|
||||
return ellipname(res,val_in,v,"ORD",printonerr);
|
||||
}
|
||||
const char * get_DSC_name(unsigned int val_in,int printonerr)
|
||||
{
|
||||
const char *v = 0;
|
||||
int res = dwarf_get_DSC_name(val_in,&v);
|
||||
return ellipname(res,val_in,v,"DSC",printonerr);
|
||||
}
|
||||
const char * get_LNS_name(unsigned int val_in,int printonerr)
|
||||
{
|
||||
const char *v = 0;
|
||||
int res = dwarf_get_LNS_name(val_in,&v);
|
||||
return ellipname(res,val_in,v,"LNS",printonerr);
|
||||
}
|
||||
const char * get_LNE_name(unsigned int val_in,int printonerr)
|
||||
{
|
||||
const char *v = 0;
|
||||
int res = dwarf_get_LNE_name(val_in,&v);
|
||||
return ellipname(res,val_in,v,"LNE",printonerr);
|
||||
}
|
||||
const char * get_MACINFO_name(unsigned int val_in,int printonerr)
|
||||
{
|
||||
const char *v = 0;
|
||||
int res = dwarf_get_MACINFO_name(val_in,&v);
|
||||
return ellipname(res,val_in,v,"MACINFO",printonerr);
|
||||
}
|
||||
const char * get_MACRO_name(unsigned int val_in,int printonerr)
|
||||
{
|
||||
const char *v = 0;
|
||||
int res = dwarf_get_MACRO_name(val_in,&v);
|
||||
return ellipname(res,val_in,v,"MACRO",printonerr);
|
||||
}
|
||||
const char * get_CFA_name(unsigned int val_in,int printonerr)
|
||||
{
|
||||
const char *v = 0;
|
||||
int res = dwarf_get_CFA_name(val_in,&v);
|
||||
return ellipname(res,val_in,v,"CFA",printonerr);
|
||||
}
|
||||
const char * get_EH_name(unsigned int val_in,int printonerr)
|
||||
{
|
||||
const char *v = 0;
|
||||
int res = dwarf_get_EH_name(val_in,&v);
|
||||
return ellipname(res,val_in,v,"EH",printonerr);
|
||||
}
|
||||
const char * get_FRAME_name(unsigned int val_in,int printonerr)
|
||||
{
|
||||
const char *v = 0;
|
||||
int res = dwarf_get_FRAME_name(val_in,&v);
|
||||
return ellipname(res,val_in,v,"FRAME",printonerr);
|
||||
}
|
||||
const char * get_CHILDREN_name(unsigned int val_in,int printonerr)
|
||||
{
|
||||
const char *v = 0;
|
||||
int res = dwarf_get_CHILDREN_name(val_in,&v);
|
||||
return ellipname(res,val_in,v,"CHILDREN",printonerr);
|
||||
}
|
||||
const char * get_ADDR_name(unsigned int val_in,int printonerr)
|
||||
{
|
||||
const char *v = 0;
|
||||
int res = dwarf_get_ADDR_name(val_in,&v);
|
||||
return ellipname(res,val_in,v,"ADDR",printonerr);
|
||||
}
|
||||
|
||||
|
69
dwarf-compilation.base/contrib/libdwarf/dwarfdump/naming.h
Normal file
69
dwarf-compilation.base/contrib/libdwarf/dwarfdump/naming.h
Normal file
|
@ -0,0 +1,69 @@
|
|||
|
||||
/*
|
||||
Copyright (C) 2000-2005 Silicon Graphics, Inc. All Rights Reserved.
|
||||
Portions Copyright (C) 2007-2011 David Anderson. All Rights Reserved.
|
||||
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of version 2 of the GNU General Public License as
|
||||
published by the Free Software Foundation.
|
||||
|
||||
This program is distributed in the hope that it would be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
Further, this software is distributed without any warranty that it is
|
||||
free of the rightful claim of any third person regarding infringement
|
||||
or the like. Any license provided herein, whether implied or
|
||||
otherwise, applies only to this software file. Patent licenses, if
|
||||
any, provided herein do not apply to combinations of this program with
|
||||
other software, or any other product whatsoever.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write the Free Software Foundation, Inc., 51
|
||||
Franklin Street - Fifth Floor, Boston MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
|
||||
/* naming.h */
|
||||
#ifndef NAMING_H_INCLUDED
|
||||
#define NAMING_H_INCLUDED
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
extern const char * get_TAG_name(unsigned int val_in,int printonerr);
|
||||
extern const char * get_children_name(unsigned int val_in,int printonerr);
|
||||
extern const char * get_FORM_name(unsigned int val_in,int printonerr);
|
||||
extern const char * get_AT_name(unsigned int val_in,int printonerr);
|
||||
extern const char * get_OP_name(unsigned int val_in,int printonerr);
|
||||
extern const char * get_ATE_name(unsigned int val_in,int printonerr);
|
||||
extern const char * get_DS_name(unsigned int val_in,int printonerr);
|
||||
extern const char * get_END_name(unsigned int val_in,int printonerr);
|
||||
extern const char * get_ATCF_name(unsigned int val_in,int printonerr);
|
||||
extern const char * get_ACCESS_name(unsigned int val_in,int printonerr);
|
||||
extern const char * get_VIS_name(unsigned int val_in,int printonerr);
|
||||
extern const char * get_VIRTUALITY_name(unsigned int val_in,int printonerr);
|
||||
extern const char * get_LANG_name(unsigned int val_in,int printonerr);
|
||||
extern const char * get_ID_name(unsigned int val_in,int printonerr);
|
||||
extern const char * get_CC_name(unsigned int val_in,int printonerr);
|
||||
extern const char * get_INL_name(unsigned int val_in,int printonerr);
|
||||
extern const char * get_ORD_name(unsigned int val_in,int printonerr);
|
||||
extern const char * get_DSC_name(unsigned int val_in,int printonerr);
|
||||
extern const char * get_LNS_name(unsigned int val_in,int printonerr);
|
||||
extern const char * get_LNE_name(unsigned int val_in,int printonerr);
|
||||
extern const char * get_MACINFO_name(unsigned int val_in,int printonerr);
|
||||
extern const char * get_MACRO_name(unsigned int val_in,int printonerr);
|
||||
extern const char * get_CFA_name(unsigned int val_in,int printonerr);
|
||||
extern const char * get_EH_name(unsigned int val_in,int printonerr);
|
||||
extern const char * get_FRAME_name(unsigned int val_in,int printonerr);
|
||||
extern const char * get_CHILDREN_name(unsigned int val_in,int printonerr);
|
||||
extern const char * get_ADDR_name(unsigned int val_in,int printonerr);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif /* NAMING_H_INCLUDED */
|
||||
|
|
@ -0,0 +1,457 @@
|
|||
/*
|
||||
Copyright (C) 2000-2006 Silicon Graphics, Inc. All Rights Reserved.
|
||||
Portions Copyright 2007-2010 Sun Microsystems, Inc. All rights reserved.
|
||||
Portions Copyright 2009-2011 SN Systems Ltd. All rights reserved.
|
||||
Portions Copyright 2008-2016 David Anderson. All rights reserved.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of version 2 of the GNU General Public License as
|
||||
published by the Free Software Foundation.
|
||||
|
||||
This program is distributed in the hope that it would be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
Further, this software is distributed without any warranty that it is
|
||||
free of the rightful claim of any third person regarding infringement
|
||||
or the like. Any license provided herein, whether implied or
|
||||
otherwise, applies only to this software file. Patent licenses, if
|
||||
any, provided herein do not apply to combinations of this program with
|
||||
other software, or any other product whatsoever.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write the Free Software Foundation, Inc., 51
|
||||
Franklin Street - Fifth Floor, Boston MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
/* The address of the Free Software Foundation is
|
||||
Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
SGI has moved from the Crittenden Lane address.
|
||||
*/
|
||||
|
||||
#include "globals.h"
|
||||
#include "naming.h"
|
||||
#include "dwconf.h"
|
||||
#include "esb.h"
|
||||
|
||||
#include "print_sections.h"
|
||||
|
||||
|
||||
/* The following relevent for one specific Linker. */
|
||||
#define SNLINKER_MAX_ATTRIB_COUNT 16
|
||||
/* a warning limit which is arbitrary but leaves a bit more flexibility. */
|
||||
#define GENERAL_MAX_ATTRIB_COUNT 32
|
||||
|
||||
/* Print data in .debug_abbrev
|
||||
This is inherently unsafe as it assumes there
|
||||
are no byte sequences in .debug_abbrev other than
|
||||
legal abbrev sequences. But the Dwarf spec
|
||||
does not promise that. The spec only promises
|
||||
that any bytes at an offset referred to from
|
||||
.debug_info are legal sequences.
|
||||
*/
|
||||
extern void
|
||||
print_abbrevs(Dwarf_Debug dbg)
|
||||
{
|
||||
Dwarf_Abbrev ab;
|
||||
Dwarf_Unsigned offset = 0;
|
||||
Dwarf_Unsigned length = 0;
|
||||
Dwarf_Unsigned abbrev_entry_count = 0;
|
||||
/* Maximum defined tag is 0xffff, DW_TAG_hi_user. */
|
||||
Dwarf_Half tag = 0;
|
||||
Dwarf_Half attr = 0;
|
||||
Dwarf_Signed form = 0;
|
||||
Dwarf_Off off = 0;
|
||||
Dwarf_Unsigned i = 0;
|
||||
Dwarf_Unsigned abbrev_num = 1;
|
||||
Dwarf_Signed child_flag = 0;
|
||||
int abres = 0;
|
||||
int tres = 0;
|
||||
int acres = 0;
|
||||
Dwarf_Unsigned abbrev_code = 0;
|
||||
Dwarf_Error paerr = 0;
|
||||
|
||||
current_section_id = DEBUG_ABBREV;
|
||||
|
||||
if (glflags.gf_do_print_dwarf) {
|
||||
printf("\n.debug_abbrev\n");
|
||||
}
|
||||
while ((abres = dwarf_get_abbrev(dbg, offset, &ab,
|
||||
&length, &abbrev_entry_count, &paerr)) == DW_DLV_OK) {
|
||||
const char *tagname = "";
|
||||
|
||||
/* Here offset is the global offset in .debug_abbrev.
|
||||
The abbrev_num is a relatively worthless counter
|
||||
of all abbreviations. */
|
||||
tres = dwarf_get_abbrev_tag(ab, &tag, &paerr);
|
||||
if (tres != DW_DLV_OK) {
|
||||
dwarf_dealloc(dbg, ab, DW_DLA_ABBREV);
|
||||
print_error(dbg, "dwarf_get_abbrev_tag", tres, paerr);
|
||||
}
|
||||
tres = dwarf_get_abbrev_code(ab, &abbrev_code, &paerr);
|
||||
if (tres != DW_DLV_OK) {
|
||||
dwarf_dealloc(dbg, ab, DW_DLA_ABBREV);
|
||||
print_error(dbg, "dwarf_get_abbrev_code", tres, paerr);
|
||||
}
|
||||
tagname = get_TAG_name(tag,dwarf_names_print_on_error);
|
||||
if (!tag) {
|
||||
tagname = "Abbrev 0: null abbrev entry";
|
||||
}
|
||||
if (dense) {
|
||||
printf("<%" DW_PR_DUu "><0x%" DW_PR_XZEROS DW_PR_DUx
|
||||
"><code: %" DW_PR_DUu ">",
|
||||
abbrev_num, offset,abbrev_code);
|
||||
if (verbose) {
|
||||
printf("<length: 0x%" DW_PR_XZEROS DW_PR_DUx ">",
|
||||
length);
|
||||
}
|
||||
printf(" %s", tagname);
|
||||
}
|
||||
else {
|
||||
printf("<%5" DW_PR_DUu "><0x%" DW_PR_XZEROS DW_PR_DUx
|
||||
"><code: %3" DW_PR_DUu ">",
|
||||
abbrev_num, offset, abbrev_code);
|
||||
if (verbose) {
|
||||
printf("<length: 0x%" DW_PR_XZEROS DW_PR_DUx ">",
|
||||
length);
|
||||
}
|
||||
printf(" %-27s", tagname);
|
||||
}
|
||||
/* Process specific TAGs specially. */
|
||||
tag_specific_checks_setup(tag,0);
|
||||
++abbrev_num;
|
||||
acres = dwarf_get_abbrev_children_flag(ab, &child_flag, &paerr);
|
||||
if (acres == DW_DLV_ERROR) {
|
||||
dwarf_dealloc(dbg, ab, DW_DLA_ABBREV);
|
||||
print_error(dbg, "dwarf_get_abbrev_children_flag", acres,
|
||||
paerr);
|
||||
}
|
||||
if (acres == DW_DLV_NO_ENTRY) {
|
||||
child_flag = 0;
|
||||
}
|
||||
/* If tag is zero, it is a null byte, not a real abbreviation,
|
||||
so there is no 'children' flag to print. */
|
||||
if (tag) {
|
||||
const char * child_name = 0;
|
||||
|
||||
child_name = get_children_name(child_flag,
|
||||
dwarf_names_print_on_error);
|
||||
printf(" %s", child_name);
|
||||
}
|
||||
if(!dense) {
|
||||
printf("\n");
|
||||
}
|
||||
/* Abbrev just contains the format of a die, which debug_info
|
||||
then points to with the real data. So here we just print the
|
||||
given format. */
|
||||
for (i = 0; i < abbrev_entry_count; i++) {
|
||||
int aeres = 0;
|
||||
|
||||
aeres = dwarf_get_abbrev_entry(ab, i, &attr, &form, &off,
|
||||
&paerr);
|
||||
if (aeres == DW_DLV_ERROR) {
|
||||
dwarf_dealloc(dbg, ab, DW_DLA_ABBREV);
|
||||
print_error(dbg, "dwarf_get_abbrev_entry", aeres, paerr);
|
||||
}
|
||||
if (aeres == DW_DLV_NO_ENTRY) {
|
||||
attr = -1LL;
|
||||
form = -1LL;
|
||||
}
|
||||
if (dense) {
|
||||
printf(" <%ld>%s<%s>", (unsigned long) off,
|
||||
get_AT_name(attr,dwarf_names_print_on_error),
|
||||
get_FORM_name((Dwarf_Half) form,
|
||||
dwarf_names_print_on_error));
|
||||
} else {
|
||||
printf(" <0x%08lx> %-28s%s\n",
|
||||
(unsigned long) off,
|
||||
get_AT_name(attr,
|
||||
dwarf_names_print_on_error),
|
||||
get_FORM_name((Dwarf_Half) form,
|
||||
dwarf_names_print_on_error));
|
||||
}
|
||||
}
|
||||
dwarf_dealloc(dbg, ab, DW_DLA_ABBREV);
|
||||
offset += length;
|
||||
if (dense) {
|
||||
printf("\n");
|
||||
}
|
||||
}
|
||||
if (abres == DW_DLV_ERROR) {
|
||||
print_error(dbg, "dwarf_get_abbrev", abres, paerr);
|
||||
}
|
||||
}
|
||||
|
||||
/* Abbreviations array info for checking abbrev tags.
|
||||
The [zero] entry is not used.
|
||||
We never shrink the array, but it never grows beyond
|
||||
the largest abbreviation count of all the CUs.
|
||||
It is set up when we start a new CU and
|
||||
used to validate abbreviations on each DIE in the CU.
|
||||
See print_die.c
|
||||
*/
|
||||
|
||||
static Dwarf_Unsigned *abbrev_array = NULL;
|
||||
/* Size of the array, the same as the abbrev tag
|
||||
count of the CU with the most of them.
|
||||
Be careful as abbrev_array[abbrev_array_size]
|
||||
is outside the high bound. */
|
||||
static Dwarf_Unsigned abbrev_array_size = 0;
|
||||
#define ABBREV_ARRAY_INITIAL_SIZE 64
|
||||
|
||||
void
|
||||
destruct_abbrev_array(void)
|
||||
{
|
||||
free(abbrev_array);
|
||||
abbrev_array = 0;
|
||||
abbrev_array_size = 0;
|
||||
}
|
||||
|
||||
/* Normally abbreviation numbers are allocated in sequence from 1
|
||||
and increase by 1
|
||||
but in case of a compiler bug or a damaged object file one can
|
||||
see strange things. This looks for surprises and reports them.
|
||||
Returns the abbrev_code unless the value looks very wrong,
|
||||
and then it returns zero as we do not want a gigantic
|
||||
abbrev code to cause trouble.
|
||||
*/
|
||||
static Dwarf_Unsigned
|
||||
check_abbrev_num_sequence(Dwarf_Unsigned abbrev_code,
|
||||
Dwarf_Unsigned last_abbrev_code,
|
||||
UNUSEDARG Dwarf_Unsigned l_abbrev_array_size,
|
||||
UNUSEDARG Dwarf_Unsigned abbrev_entry_count,
|
||||
UNUSEDARG Dwarf_Unsigned total_abbrevs_counted)
|
||||
{
|
||||
char buf[128];
|
||||
|
||||
DWARF_CHECK_COUNT(abbreviations_result,1);
|
||||
if (abbrev_code > last_abbrev_code) {
|
||||
if ((abbrev_code-last_abbrev_code) > 100 ) {
|
||||
snprintf(buf, sizeof(buf),
|
||||
"Abbrev code %" DW_PR_DUu
|
||||
" skips up by %" DW_PR_DUu
|
||||
" from last abbrev code of %" DW_PR_DUu ,
|
||||
abbrev_code,
|
||||
(abbrev_code-last_abbrev_code),
|
||||
last_abbrev_code);
|
||||
DWARF_CHECK_ERROR2(abbreviations_result,buf,
|
||||
"Questionable abbreviation code! Not checking reuse.");
|
||||
return 0;
|
||||
} else if ((abbrev_code-last_abbrev_code) > 1 ) {
|
||||
snprintf(buf, sizeof(buf),
|
||||
"Abbrev code %" DW_PR_DUu
|
||||
" skips up by %" DW_PR_DUu
|
||||
" from last abbrev code of %" DW_PR_DUu ,
|
||||
abbrev_code,
|
||||
(abbrev_code-last_abbrev_code),
|
||||
last_abbrev_code);
|
||||
DWARF_CHECK_ERROR2(abbreviations_result,buf,
|
||||
"Questionable abbreviation code.");
|
||||
}
|
||||
} else if (abbrev_code < last_abbrev_code) {
|
||||
snprintf(buf, sizeof(buf),
|
||||
"Abbrev code %" DW_PR_DUu
|
||||
" skips down by %" DW_PR_DUu
|
||||
" from last abbrev code of %" DW_PR_DUu ,
|
||||
abbrev_code,
|
||||
(last_abbrev_code - abbrev_code),
|
||||
last_abbrev_code);
|
||||
DWARF_CHECK_ERROR2(abbreviations_result,buf,
|
||||
"Questionable abbreviation code.");
|
||||
} else {
|
||||
snprintf(buf, sizeof(buf),
|
||||
"Abbrev code %" DW_PR_DUu
|
||||
" unchanged from last abbrev code!.",
|
||||
abbrev_code);
|
||||
DWARF_CHECK_ERROR2(abbreviations_result,buf,
|
||||
"Questionable abbreviation code.");
|
||||
}
|
||||
return abbrev_code;
|
||||
}
|
||||
|
||||
static void
|
||||
check_reused_code(Dwarf_Unsigned abbrev_code,
|
||||
Dwarf_Unsigned abbrev_entry_count)
|
||||
{
|
||||
char buf[128];
|
||||
|
||||
if (abbrev_code >= abbrev_array_size) {
|
||||
snprintf(buf, sizeof(buf),
|
||||
"Abbrev code %" DW_PR_DUu
|
||||
" entry_count unchecked: %" DW_PR_DUu " ",
|
||||
abbrev_code,abbrev_entry_count);
|
||||
DWARF_CHECK_ERROR2(abbreviations_result,buf,
|
||||
"Questionable abbreviation code.");
|
||||
return;
|
||||
}
|
||||
if (abbrev_array[abbrev_code]) {
|
||||
DWARF_CHECK_COUNT(abbreviations_result,1);
|
||||
/* This abbrev code slot was used before. */
|
||||
if (abbrev_array[abbrev_code] == abbrev_entry_count) {
|
||||
snprintf(buf, sizeof(buf),
|
||||
"Abbrev code %" DW_PR_DUu
|
||||
" reused for same entry_count: %" DW_PR_DUu " ",
|
||||
abbrev_code,abbrev_entry_count);
|
||||
DWARF_CHECK_ERROR2(abbreviations_result,buf,
|
||||
"Questionable abbreviation code.");
|
||||
} else {
|
||||
snprintf(buf, sizeof(buf),
|
||||
"Abbrev code %" DW_PR_DUu
|
||||
" reused for different entry_count. "
|
||||
" %" DW_PR_DUu " now %" DW_PR_DUu
|
||||
" ",
|
||||
abbrev_code,
|
||||
abbrev_array[abbrev_code],
|
||||
abbrev_entry_count);
|
||||
DWARF_CHECK_ERROR2(abbreviations_result,buf,
|
||||
"Invalid abbreviation code.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Calculate the number of abbreviations for the
|
||||
current CU and set up basic abbreviations array info,
|
||||
storing the number of attributes per abbreviation
|
||||
*/
|
||||
void
|
||||
get_abbrev_array_info(Dwarf_Debug dbg, Dwarf_Unsigned offset_in)
|
||||
{
|
||||
Dwarf_Unsigned offset = offset_in;
|
||||
if (glflags.gf_check_abbreviations) {
|
||||
Dwarf_Abbrev ab = 0;
|
||||
Dwarf_Unsigned length = 0;
|
||||
Dwarf_Unsigned abbrev_entry_count = 0;
|
||||
Dwarf_Unsigned abbrev_code;
|
||||
int abres = DW_DLV_OK;
|
||||
Dwarf_Error aberr = 0;
|
||||
Dwarf_Unsigned last_abbrev_code = 0;
|
||||
|
||||
Dwarf_Bool bMore = TRUE;
|
||||
Dwarf_Unsigned CU_abbrev_count = 0;
|
||||
|
||||
if (abbrev_array == NULL) {
|
||||
/* Allocate initial abbreviation array info */
|
||||
abbrev_array_size = ABBREV_ARRAY_INITIAL_SIZE;
|
||||
abbrev_array = (Dwarf_Unsigned *)
|
||||
calloc(abbrev_array_size,sizeof(Dwarf_Unsigned));
|
||||
} else {
|
||||
/* Clear out values from previous CU */
|
||||
memset((void *)abbrev_array,0,
|
||||
(abbrev_array_size) * sizeof(Dwarf_Unsigned));
|
||||
}
|
||||
|
||||
while (bMore && (abres = dwarf_get_abbrev(dbg, offset, &ab,
|
||||
&length, &abbrev_entry_count,
|
||||
&aberr)) == DW_DLV_OK) {
|
||||
dwarf_get_abbrev_code(ab,&abbrev_code,&aberr);
|
||||
if (abbrev_code == 0) {
|
||||
/* End of abbreviation table for this CU */
|
||||
++offset; /* Skip abbreviation code */
|
||||
bMore = FALSE;
|
||||
} else {
|
||||
/* Valid abbreviation code. We hope. */
|
||||
if (abbrev_code > 0) {
|
||||
Dwarf_Unsigned abhigh = check_abbrev_num_sequence(
|
||||
abbrev_code,
|
||||
last_abbrev_code,
|
||||
abbrev_array_size,abbrev_entry_count,
|
||||
CU_abbrev_count);
|
||||
if (abhigh >= abbrev_array_size) {
|
||||
/* It is a new high, but is not outrageous. */
|
||||
while (abbrev_code >= abbrev_array_size) {
|
||||
Dwarf_Unsigned old_size = abbrev_array_size;
|
||||
size_t addl_size_bytes = old_size *
|
||||
sizeof(Dwarf_Unsigned);
|
||||
|
||||
/* Resize abbreviation array.
|
||||
Only a bogus abbreviation number
|
||||
will iterate
|
||||
more than once. The abhigh check.
|
||||
prevents a runaway. */
|
||||
abbrev_array_size *= 2;
|
||||
abbrev_array = (Dwarf_Unsigned *)
|
||||
realloc(abbrev_array,
|
||||
abbrev_array_size * sizeof(Dwarf_Unsigned));
|
||||
/* Zero out the new bytes. */
|
||||
memset(abbrev_array + old_size,0,
|
||||
addl_size_bytes);
|
||||
}
|
||||
last_abbrev_code = abbrev_code;
|
||||
check_reused_code(abbrev_code,
|
||||
abbrev_entry_count);
|
||||
abbrev_array[abbrev_code] = abbrev_entry_count;
|
||||
} else {
|
||||
/* Zero is the case of 'too high' abbev_code. */
|
||||
if (abhigh > 0) {
|
||||
/* More or less normal abbrev_code. */
|
||||
last_abbrev_code = abbrev_code;
|
||||
check_reused_code(abbrev_code,
|
||||
abbrev_entry_count);
|
||||
abbrev_array[abbrev_code] =
|
||||
abbrev_entry_count;
|
||||
}
|
||||
}
|
||||
++CU_abbrev_count;
|
||||
offset += length;
|
||||
} else {
|
||||
/* Invalid abbreviation code */
|
||||
print_error(dbg, "get_abbrev_array_info",
|
||||
abres, aberr);
|
||||
last_abbrev_code = abbrev_code;
|
||||
}
|
||||
}
|
||||
dwarf_dealloc(dbg, ab, DW_DLA_ABBREV);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Validate an abbreviation for the current CU.
|
||||
In case of bogus abbrev input the CU_abbrev_count
|
||||
might not be as large as abbrev_array_size says
|
||||
the array is. This should catch that case. */
|
||||
void
|
||||
validate_abbrev_code(UNUSEDARG Dwarf_Debug dbg,
|
||||
Dwarf_Unsigned abbrev_code)
|
||||
{
|
||||
char buf[128];
|
||||
|
||||
DWARF_CHECK_COUNT(abbreviations_result,1);
|
||||
if (abbrev_code && abbrev_code >= abbrev_array_size) {
|
||||
snprintf(buf, sizeof(buf),
|
||||
"Abbrev code %" DW_PR_DUu
|
||||
" outside valid range of [0-%" DW_PR_DUu "]",
|
||||
abbrev_code,abbrev_array_size);
|
||||
DWARF_CHECK_ERROR2(abbreviations_result,buf,
|
||||
"Invalid abbreviation code.");
|
||||
} else {
|
||||
Dwarf_Unsigned abbrev_entry_count =
|
||||
abbrev_array[abbrev_code];
|
||||
if (abbrev_entry_count > SNLINKER_MAX_ATTRIB_COUNT) {
|
||||
if (abbrev_entry_count > GENERAL_MAX_ATTRIB_COUNT) {
|
||||
snprintf(buf, sizeof(buf),
|
||||
"Abbrev code %" DW_PR_DUu
|
||||
", with %" DW_PR_DUu " attributes: "
|
||||
"outside a sanity-check maximum of %d.",
|
||||
abbrev_code,
|
||||
abbrev_entry_count,
|
||||
GENERAL_MAX_ATTRIB_COUNT);
|
||||
DWARF_CHECK_ERROR2(abbreviations_result,buf,
|
||||
"Number of attributes exceeds sanity check");
|
||||
} else {
|
||||
/* These apply only to one compiliation environment,
|
||||
and are not generally applicable. */
|
||||
snprintf(buf, sizeof(buf),
|
||||
"Abbrev code %" DW_PR_DUu
|
||||
", with %" DW_PR_DUu " attributes: "
|
||||
"outside an SN-LINKER expected-maximum of %d.",
|
||||
abbrev_code,
|
||||
abbrev_entry_count,
|
||||
SNLINKER_MAX_ATTRIB_COUNT);
|
||||
DWARF_CHECK_ERROR2(abbreviations_result,buf,
|
||||
"Number of attributes exceeds SN-LINKER-specific sanity check.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,278 @@
|
|||
/*
|
||||
Copyright (C) 2000-2006 Silicon Graphics, Inc. All Rights Reserved.
|
||||
Portions Copyright 2007-2010 Sun Microsystems, Inc. All rights reserved.
|
||||
Portions Copyright 2009-2012 SN Systems Ltd. All rights reserved.
|
||||
Portions Copyright 2008-2012 David Anderson. All rights reserved.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of version 2 of the GNU General Public License as
|
||||
published by the Free Software Foundation.
|
||||
|
||||
This program is distributed in the hope that it would be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
Further, this software is distributed without any warranty that it is
|
||||
free of the rightful claim of any third person regarding infringement
|
||||
or the like. Any license provided herein, whether implied or
|
||||
otherwise, applies only to this software file. Patent licenses, if
|
||||
any, provided herein do not apply to combinations of this program with
|
||||
other software, or any other product whatsoever.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write the Free Software Foundation, Inc., 51
|
||||
Franklin Street - Fifth Floor, Boston MA 02110-1301, USA.
|
||||
|
||||
*/
|
||||
|
||||
/* The address of the Free Software Foundation is
|
||||
Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
|
||||
Boston, MA 02110-1301, USA.
|
||||
SGI has moved from the Crittenden Lane address.
|
||||
*/
|
||||
|
||||
#include "globals.h"
|
||||
#include "naming.h"
|
||||
#include "dwconf.h"
|
||||
#include "esb.h"
|
||||
|
||||
#include "print_sections.h"
|
||||
|
||||
|
||||
static void
|
||||
do_checking(Dwarf_Debug dbg, Dwarf_Arange *arange_buf,Dwarf_Signed i,
|
||||
Dwarf_Off cu_die_offset,Dwarf_Bool first_cu,
|
||||
Dwarf_Off cu_die_offset_prev, Dwarf_Die cu_die )
|
||||
{
|
||||
int dres = 0;
|
||||
Dwarf_Off cuhdroff = 0;
|
||||
Dwarf_Off cudieoff3 = 0;
|
||||
Dwarf_Error checking_err = 0;
|
||||
/* .debug_types has no address ranges, only .debug_info[.dwo]
|
||||
has them.*/
|
||||
int is_info = 1;
|
||||
|
||||
|
||||
dres = dwarf_get_arange_cu_header_offset(
|
||||
arange_buf[i],&cuhdroff,&checking_err);
|
||||
if (dres == DW_DLV_OK) {
|
||||
Dwarf_Off cudieoff2 = 0;
|
||||
|
||||
/* Get the CU offset for easy error reporting */
|
||||
if (first_cu || cu_die_offset != cu_die_offset_prev) {
|
||||
cu_die_offset_prev = cu_die_offset;
|
||||
dres = dwarf_die_offsets(cu_die,&DIE_overall_offset,
|
||||
&DIE_offset,&checking_err);
|
||||
DIE_CU_overall_offset = DIE_overall_offset;
|
||||
DIE_CU_offset = DIE_offset;
|
||||
if (dres != DW_DLV_OK) {
|
||||
print_error(dbg, "dwarf_die_offsets", dres, checking_err);
|
||||
}
|
||||
}
|
||||
dres = dwarf_get_cu_die_offset_given_cu_header_offset_b(
|
||||
dbg,cuhdroff,is_info,&cudieoff2,&checking_err);
|
||||
if (dres == DW_DLV_OK) {
|
||||
/* Get the CU offset for easy error reporting */
|
||||
dwarf_die_offsets(cu_die,&DIE_overall_offset,&DIE_offset,&checking_err);
|
||||
DIE_CU_overall_offset = DIE_overall_offset;
|
||||
DIE_CU_offset = DIE_offset;
|
||||
DWARF_CHECK_COUNT(aranges_result,1);
|
||||
if (cu_die_offset != cudieoff2) {
|
||||
printf("Error, cu_die offsets mismatch, 0x%"
|
||||
DW_PR_DUx " != 0x%" DW_PR_DUx
|
||||
" from arange data",
|
||||
cu_die_offset,cudieoff2);
|
||||
DWARF_CHECK_ERROR(aranges_result,
|
||||
" dwarf_get_cu_die_offset_given_cu..."
|
||||
" gets wrong offset");
|
||||
}
|
||||
} else {
|
||||
print_error(dbg, "dwarf_get_cu_die_offset_given...", dres, checking_err);
|
||||
}
|
||||
} else {
|
||||
print_error(dbg, "dwarf_get_arange_cu_header_offset", dres, checking_err);
|
||||
}
|
||||
dres = dwarf_get_cu_die_offset(arange_buf[i],&cudieoff3,
|
||||
&checking_err);
|
||||
if (dres == DW_DLV_OK) {
|
||||
DWARF_CHECK_COUNT(aranges_result,1);
|
||||
if (cudieoff3 != cu_die_offset) {
|
||||
printf(
|
||||
"Error, cu_die offsets (b) mismatch , 0x%"
|
||||
DW_PR_DUx
|
||||
" != 0x%" DW_PR_DUx " from arange data",
|
||||
cu_die_offset,cudieoff3);
|
||||
DWARF_CHECK_ERROR(aranges_result,
|
||||
" dwarf_get_cu_die_offset "
|
||||
" gets wrong offset");
|
||||
}
|
||||
} else {
|
||||
print_error(dbg, "dwarf_get_cu_die_offset failed ",
|
||||
dres,checking_err);
|
||||
}
|
||||
}
|
||||
|
||||
/* get all the data in .debug_aranges */
|
||||
extern void
|
||||
print_aranges(Dwarf_Debug dbg)
|
||||
{
|
||||
Dwarf_Signed count = 0;
|
||||
Dwarf_Signed i = 0;
|
||||
Dwarf_Arange *arange_buf = NULL;
|
||||
int ares = 0;
|
||||
int aires = 0;
|
||||
Dwarf_Off prev_off = 0; /* Holds previous CU offset */
|
||||
Dwarf_Bool first_cu = TRUE;
|
||||
Dwarf_Off cu_die_offset_prev = 0;
|
||||
Dwarf_Error pa_error = 0;
|
||||
|
||||
/* Reset the global state, so we can traverse the debug_info */
|
||||
seen_CU = FALSE;
|
||||
need_CU_name = TRUE;
|
||||
need_CU_base_address = TRUE;
|
||||
need_CU_high_address = TRUE;
|
||||
|
||||
current_section_id = DEBUG_ARANGES;
|
||||
if (glflags.gf_do_print_dwarf) {
|
||||
const char *sec_name = 0;
|
||||
ares = dwarf_get_aranges_section_name(dbg,
|
||||
&sec_name,&pa_error);
|
||||
if (ares != DW_DLV_OK || !sec_name || !strlen(sec_name)) {
|
||||
sec_name = ".debug_aranges";
|
||||
}
|
||||
printf("\n%s\n",sanitized(sec_name));
|
||||
}
|
||||
ares = dwarf_get_aranges(dbg, &arange_buf, &count, &pa_error);
|
||||
if (ares == DW_DLV_ERROR) {
|
||||
print_error(dbg, "dwarf_get_aranges", ares, pa_error);
|
||||
} else if (ares == DW_DLV_NO_ENTRY) {
|
||||
/* no arange is included */
|
||||
} else {
|
||||
for (i = 0; i < count; i++) {
|
||||
Dwarf_Unsigned segment = 0;
|
||||
Dwarf_Unsigned segment_entry_size = 0;
|
||||
Dwarf_Addr start = 0;
|
||||
Dwarf_Unsigned length = 0;
|
||||
Dwarf_Off cu_die_offset = 0;
|
||||
Dwarf_Die cu_die = NULL;
|
||||
aires = dwarf_get_arange_info_b(arange_buf[i],
|
||||
&segment,
|
||||
&segment_entry_size,
|
||||
&start, &length,
|
||||
&cu_die_offset, &pa_error);
|
||||
if (aires != DW_DLV_OK) {
|
||||
print_error(dbg, "dwarf_get_arange_info", aires, pa_error);
|
||||
} else {
|
||||
int dres;
|
||||
struct esb_s producer_name;
|
||||
esb_constructor(&producer_name);
|
||||
/* Get basic locations for error reporting */
|
||||
dres = dwarf_offdie(dbg, cu_die_offset, &cu_die, &pa_error);
|
||||
if (dres != DW_DLV_OK) {
|
||||
print_error(dbg, "dwarf_offdie", dres, pa_error);
|
||||
}
|
||||
|
||||
if (glflags.gf_cu_name_flag) {
|
||||
if (should_skip_this_cu(dbg,cu_die)) {
|
||||
continue;
|
||||
}
|
||||
}
|
||||
/* Get producer name for this CU and update compiler list */
|
||||
get_producer_name(dbg,cu_die,cu_die_offset,&producer_name);
|
||||
update_compiler_target(esb_get_string(&producer_name));
|
||||
esb_destructor(&producer_name);
|
||||
if (!checking_this_compiler()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (glflags.gf_check_aranges) {
|
||||
do_checking(dbg,arange_buf,i,
|
||||
cu_die_offset,first_cu,
|
||||
cu_die_offset_prev,cu_die);
|
||||
}
|
||||
/* Get the offset of the cu header itself in the
|
||||
section, but not for end-entries. */
|
||||
if (start || length) {
|
||||
Dwarf_Off off = 0;
|
||||
int cures3 = dwarf_get_arange_cu_header_offset(
|
||||
arange_buf[i], &off, &pa_error);
|
||||
if (cures3 != DW_DLV_OK) {
|
||||
print_error(dbg, "dwarf_get_cu_hdr_offset",
|
||||
cures3, pa_error);
|
||||
}
|
||||
|
||||
/* Print the CU information if different. */
|
||||
if (prev_off != off || first_cu) {
|
||||
first_cu = FALSE;
|
||||
prev_off = off;
|
||||
/* We are faking the indent level. We do not know
|
||||
what level it is, really.
|
||||
|
||||
If do_check_dwarf we do not want to do
|
||||
the die print call as it will do
|
||||
check/print we may not have asked for.
|
||||
And if we did ask for debug_info checks
|
||||
this will do the checks a second time!
|
||||
So only call print_one_die if printing.
|
||||
*/
|
||||
if (glflags.gf_do_print_dwarf){
|
||||
/* There is no die if its a set-end entry */
|
||||
print_one_die(dbg, cu_die,
|
||||
cu_die_offset,
|
||||
/* print_information= */ (boolean) TRUE,
|
||||
/* indent_level = */0,
|
||||
/* srcfiles= */ 0,
|
||||
/* cnt= */ 0,
|
||||
/* ignore_die_stack= */TRUE);
|
||||
}
|
||||
/* Reset the state, so we can traverse the debug_info */
|
||||
seen_CU = FALSE;
|
||||
need_CU_name = TRUE;
|
||||
if (glflags.gf_do_print_dwarf) {
|
||||
printf("\n");
|
||||
}
|
||||
}
|
||||
|
||||
if (glflags.gf_do_print_dwarf) {
|
||||
/* Print current aranges record */
|
||||
if (segment_entry_size) {
|
||||
printf(
|
||||
"\narange starts at seg,off 0x%"
|
||||
DW_PR_XZEROS DW_PR_DUx
|
||||
",0x%" DW_PR_XZEROS DW_PR_DUx
|
||||
", ",
|
||||
segment,
|
||||
(Dwarf_Unsigned)start);
|
||||
} else {
|
||||
printf("\narange starts at 0x%"
|
||||
DW_PR_XZEROS DW_PR_DUx ", ",
|
||||
(Dwarf_Unsigned)start);
|
||||
}
|
||||
printf("length of 0x%" DW_PR_XZEROS DW_PR_DUx
|
||||
", cu_die_offset = 0x%" DW_PR_XZEROS DW_PR_DUx,
|
||||
length,
|
||||
(Dwarf_Unsigned)cu_die_offset);
|
||||
|
||||
}
|
||||
if (verbose && glflags.gf_do_print_dwarf) {
|
||||
printf(" cuhdr 0x%" DW_PR_XZEROS DW_PR_DUx "\n",
|
||||
(Dwarf_Unsigned)off);
|
||||
}
|
||||
dwarf_dealloc(dbg, cu_die, DW_DLA_DIE);
|
||||
cu_die = 0;
|
||||
} else {
|
||||
/* Must be a range end. We really do want to print
|
||||
this as there is a real record here, an
|
||||
'arange end' record. */
|
||||
if (glflags.gf_do_print_dwarf) {
|
||||
printf("\narange end\n");
|
||||
}
|
||||
}/* end start||length test */
|
||||
} /* end aires DW_DLV_OK test */
|
||||
|
||||
/* print associated die too? */
|
||||
dwarf_dealloc(dbg, arange_buf[i], DW_DLA_ARANGE);
|
||||
}
|
||||
dwarf_dealloc(dbg, arange_buf, DW_DLA_LIST);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,190 @@
|
|||
/*
|
||||
Copyright 2014-2014 David Anderson. All rights reserved.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of version 2 of the GNU General Public License as
|
||||
published by the Free Software Foundation.
|
||||
|
||||
This program is distributed in the hope that it would be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
Further, this software is distributed without any warranty that it is
|
||||
free of the rightful claim of any third person regarding infringement
|
||||
or the like. Any license provided herein, whether implied or
|
||||
otherwise, applies only to this software file. Patent licenses, if
|
||||
any, provided herein do not apply to combinations of this program with
|
||||
other software, or any other product whatsoever.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write the Free Software Foundation, Inc., 51
|
||||
Franklin Street - Fifth Floor, Boston MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#include "globals.h"
|
||||
#include "naming.h"
|
||||
#include "esb.h"
|
||||
|
||||
#include "print_sections.h"
|
||||
|
||||
#define TRUE 1
|
||||
#define FALSE 0
|
||||
|
||||
static int
|
||||
hashval_zero(Dwarf_Sig8 *val)
|
||||
{
|
||||
unsigned u = 0;
|
||||
|
||||
for(u=0 ; u < sizeof(Dwarf_Sig8);++u) {
|
||||
if (val->signature[u]) {
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
extern void
|
||||
print_debugfission_index(Dwarf_Debug dbg,const char *type)
|
||||
{
|
||||
int res = 0;
|
||||
Dwarf_Xu_Index_Header xuhdr = 0;
|
||||
Dwarf_Unsigned version_number = 0;
|
||||
Dwarf_Unsigned offsets_count = 0;
|
||||
Dwarf_Unsigned units_count = 0;
|
||||
Dwarf_Unsigned hash_slots_count = 0;
|
||||
Dwarf_Error fierr = 0;
|
||||
const char * section_name = 0;
|
||||
const char * section_type2 = 0;
|
||||
const char * section_name2 = 0;
|
||||
int is_cu = !strcmp(type,"cu")?TRUE:FALSE;
|
||||
|
||||
res = dwarf_get_xu_index_header(dbg,
|
||||
type,
|
||||
&xuhdr,
|
||||
&version_number,
|
||||
&offsets_count,
|
||||
&units_count,
|
||||
&hash_slots_count,
|
||||
§ion_name,
|
||||
&fierr);
|
||||
if (res == DW_DLV_NO_ENTRY) {
|
||||
/* This applies to most object files. */
|
||||
return;
|
||||
}
|
||||
if (res == DW_DLV_ERROR) {
|
||||
/* Odd. FIXME */
|
||||
return;
|
||||
}
|
||||
res = dwarf_get_xu_index_section_type(xuhdr,
|
||||
§ion_type2,
|
||||
§ion_name2,
|
||||
&fierr);
|
||||
if (res == DW_DLV_NO_ENTRY) {
|
||||
/* Impossible. */
|
||||
print_error(dbg,"dwarf_get_xu_index_section_type",
|
||||
DW_DLE_XU_IMPOSSIBLE_ERROR,fierr);
|
||||
dwarf_xu_header_free(xuhdr);
|
||||
return;
|
||||
}
|
||||
if (res == DW_DLV_ERROR) {
|
||||
/* Impossible. FIXME */
|
||||
print_error(dbg,"dwarf_get_xu_index_section_type", res,fierr);
|
||||
dwarf_xu_header_free(xuhdr);
|
||||
return;
|
||||
}
|
||||
if (strcmp(section_type2,type)) {
|
||||
print_error(dbg,"dwarf_get_xu_index_section_type",
|
||||
DW_DLE_XU_IMPOSSIBLE_ERROR,fierr);
|
||||
dwarf_xu_header_free(xuhdr);
|
||||
return;
|
||||
}
|
||||
if(!section_name || !*section_name) {
|
||||
section_name = (is_cu?".debug_cu_index":".debug_tu_index");
|
||||
}
|
||||
printf("\n%s\n",sanitized(section_name));
|
||||
printf(" Version: %" DW_PR_DUu "\n",
|
||||
version_number);
|
||||
printf(" Number of columns: %" DW_PR_DUu "\n",
|
||||
offsets_count);
|
||||
printf(" number of entries: %" DW_PR_DUu "\n",
|
||||
units_count);
|
||||
printf(" Number of slots: %" DW_PR_DUu "\n",
|
||||
hash_slots_count);
|
||||
|
||||
if (hash_slots_count > 0) {
|
||||
printf("\n");
|
||||
printf(" hash index\n");
|
||||
}
|
||||
|
||||
{
|
||||
Dwarf_Unsigned h = 0;
|
||||
for( h = 0; h < hash_slots_count; h++) {
|
||||
Dwarf_Sig8 hashval;
|
||||
Dwarf_Unsigned index = 0;
|
||||
Dwarf_Unsigned col = 0;
|
||||
struct esb_s hashhexstring;
|
||||
|
||||
esb_constructor(&hashhexstring);
|
||||
memset(&hashval,0,sizeof(hashval));
|
||||
res = dwarf_get_xu_hash_entry(xuhdr,h,
|
||||
&hashval,&index,&fierr);
|
||||
if (res == DW_DLV_ERROR) {
|
||||
print_error(dbg,"dwarf_get_xu_hash_entry",res,fierr);
|
||||
dwarf_xu_header_free(xuhdr);
|
||||
esb_destructor(&hashhexstring);
|
||||
return;
|
||||
} else if (res == DW_DLV_NO_ENTRY) {
|
||||
/* Impossible */
|
||||
printf(" [%4" DW_PR_DUu "] "
|
||||
"dwarf_get_xu_hash_entry impossible return code: "
|
||||
"No entry?\n",
|
||||
h);
|
||||
dwarf_xu_header_free(xuhdr);
|
||||
esb_destructor(&hashhexstring);
|
||||
return;
|
||||
} else if (hashval_zero(&hashval) && index == 0 ) {
|
||||
/* An unused hash slot, we do not print them */
|
||||
continue;
|
||||
}
|
||||
format_sig8_string(&hashval,&hashhexstring);
|
||||
printf(" [%4" DW_PR_DUu "] %s"
|
||||
" %8" DW_PR_DUu "\n",
|
||||
h,
|
||||
esb_get_string(&hashhexstring),
|
||||
index);
|
||||
esb_destructor(&hashhexstring);
|
||||
printf(" col section "
|
||||
"offset size\n");
|
||||
for (col = 0; col < offsets_count; col++) {
|
||||
Dwarf_Unsigned off = 0;
|
||||
Dwarf_Unsigned len = 0;
|
||||
const char * name = 0;
|
||||
Dwarf_Unsigned num = 0;
|
||||
res = dwarf_get_xu_section_names(xuhdr,
|
||||
col,&num,&name,&fierr);
|
||||
if (res != DW_DLV_OK) {
|
||||
print_error(dbg,"dwarf_get_xu_section_names",res,fierr);
|
||||
dwarf_xu_header_free(xuhdr);
|
||||
return;
|
||||
}
|
||||
res = dwarf_get_xu_section_offset(xuhdr,
|
||||
index,col,&off,&len,&fierr);
|
||||
if (res != DW_DLV_OK) {
|
||||
print_error(dbg,"dwarf_get_xu_section_offset",res,fierr);
|
||||
dwarf_xu_header_free(xuhdr);
|
||||
return;
|
||||
}
|
||||
printf(" [,%2" DW_PR_DUu "] %20s "
|
||||
"0x%" DW_PR_XZEROS DW_PR_DUx
|
||||
" (%8" DW_PR_DUu ") "
|
||||
"0x%" DW_PR_XZEROS DW_PR_DUx
|
||||
" (%8" DW_PR_DUu ")\n",
|
||||
col,name,
|
||||
off,off,
|
||||
len,len);
|
||||
}
|
||||
}
|
||||
}
|
||||
dwarf_xu_header_free(xuhdr);
|
||||
}
|
||||
|
5723
dwarf-compilation.base/contrib/libdwarf/dwarfdump/print_die.c
Normal file
5723
dwarf-compilation.base/contrib/libdwarf/dwarfdump/print_die.c
Normal file
File diff suppressed because it is too large
Load diff
|
@ -0,0 +1,47 @@
|
|||
/*
|
||||
Copyright 2017-2017 David Anderson. All rights reserved.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of version 2 of the GNU General Public License as
|
||||
published by the Free Software Foundation.
|
||||
|
||||
This program is distributed in the hope that it would be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
Further, this software is distributed without any warranty that it is
|
||||
free of the rightful claim of any third person regarding infringement
|
||||
or the like. Any license provided herein, whether implied or
|
||||
otherwise, applies only to this software file. Patent licenses, if
|
||||
any, provided herein do not apply to combinations of this program with
|
||||
other software, or any other product whatsoever.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write the Free Software Foundation, Inc., 51
|
||||
Franklin Street - Fifth Floor, Boston MA 02110-1301, USA.
|
||||
|
||||
*/
|
||||
|
||||
#include "globals.h"
|
||||
#include "naming.h"
|
||||
#include "dwconf.h"
|
||||
#include "esb.h"
|
||||
|
||||
extern void
|
||||
print_debug_names(Dwarf_Debug dbg)
|
||||
{
|
||||
|
||||
if(!dbg) {
|
||||
printf("Cannot print .debug_names, no Dwarf_Debug passed in");
|
||||
printf("dwarfdump giving up. exit.\n");
|
||||
exit(1);
|
||||
}
|
||||
current_section_id = DEBUG_NAMES;
|
||||
|
||||
/* Do nothing if not printing. */
|
||||
if (!glflags.gf_do_print_dwarf) {
|
||||
return;
|
||||
}
|
||||
/* Only print anything if we know it has debug names
|
||||
present. And for now there is none. FIXME. */
|
||||
}
|
2429
dwarf-compilation.base/contrib/libdwarf/dwarfdump/print_frames.c
Normal file
2429
dwarf-compilation.base/contrib/libdwarf/dwarfdump/print_frames.c
Normal file
File diff suppressed because it is too large
Load diff
|
@ -0,0 +1,37 @@
|
|||
/*
|
||||
Copyright (C) 2006 Silicon Graphics, Inc. All Rights Reserved.
|
||||
Portions Copyright (C) 2009-2011 David Anderson. All Rights Reserved.
|
||||
|
||||
This program is free software; you can redistribute it and/or modify it
|
||||
under the terms of version 2 of the GNU General Public License as
|
||||
published by the Free Software Foundation.
|
||||
|
||||
This program is distributed in the hope that it would be useful, but
|
||||
WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
Further, this software is distributed without any warranty that it is
|
||||
free of the rightful claim of any third person regarding infringement
|
||||
or the like. Any license provided herein, whether implied or
|
||||
otherwise, applies only to this software file. Patent licenses, if
|
||||
any, provided herein do not apply to combinations of this program with
|
||||
other software, or any other product whatsoever.
|
||||
|
||||
You should have received a copy of the GNU General Public License along
|
||||
with this program; if not, write the Free Software Foundation, Inc., 51
|
||||
Franklin Street - Fifth Floor, Boston MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
int print_one_cie(Dwarf_Debug dbg, Dwarf_Cie cie,
|
||||
Dwarf_Unsigned cie_index,
|
||||
Dwarf_Half address_size,
|
||||
struct dwconf_s * config_data);
|
||||
|
||||
void get_string_from_locs(Dwarf_Debug dbg,
|
||||
Dwarf_Ptr bytes_in,
|
||||
Dwarf_Unsigned block_len,
|
||||
Dwarf_Half addr_size,
|
||||
Dwarf_Half offset_size,
|
||||
Dwarf_Half version,
|
||||
struct esb_s *out_string);
|
||||
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue