mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-04-02 12:32:55 +00:00
Bug 901898 - Remove codesighs now that it's no longer run in automation; r=gps
This commit is contained in:
parent
ebb5e958d6
commit
a4ae239c93
@ -168,9 +168,6 @@ ifdef MOZ_CRASHREPORTER
|
||||
$(SHELL) $(topsrcdir)/toolkit/crashreporter/tools/upload_symbols.sh $(SYMBOL_INDEX_NAME) "$(DIST)/$(PKG_PATH)$(SYMBOL_FULL_ARCHIVE_BASENAME).zip"
|
||||
endif
|
||||
|
||||
codesighs:
|
||||
$(MAKE) -C $(MOZ_BUILD_APP)/installer codesighs
|
||||
|
||||
# defined in package-name.mk
|
||||
export MOZ_SOURCE_STAMP
|
||||
|
||||
|
@ -3,7 +3,6 @@
|
||||
|
||||
ac_add_options --enable-update-channel=${MOZ_UPDATE_CHANNEL}
|
||||
ac_add_options --enable-update-packaging
|
||||
ac_add_options --enable-codesighs
|
||||
ac_add_options --enable-signmar
|
||||
|
||||
# Nightlies only since this has a cost in performance
|
||||
|
@ -3,7 +3,6 @@
|
||||
|
||||
ac_add_options --enable-update-channel=${MOZ_UPDATE_CHANNEL}
|
||||
ac_add_options --enable-update-packaging
|
||||
ac_add_options --enable-codesighs
|
||||
ac_add_options --enable-signmar
|
||||
|
||||
# Nightlies only since this has a cost in performance
|
||||
|
@ -2,7 +2,6 @@
|
||||
|
||||
ac_add_options --enable-update-channel=${MOZ_UPDATE_CHANNEL}
|
||||
ac_add_options --enable-update-packaging
|
||||
ac_add_options --enable-codesighs
|
||||
ac_add_options --enable-signmar
|
||||
|
||||
# Nightlies only since this has a cost in performance
|
||||
|
@ -1,6 +1,5 @@
|
||||
. "$topsrcdir/browser/config/mozconfigs/linux32/common-opt"
|
||||
|
||||
ac_add_options --enable-codesighs
|
||||
ac_add_options --enable-signmar
|
||||
ac_add_options --enable-profiling
|
||||
ac_add_options --disable-elf-hack # --enable-elf-hack conflicts with --enable-profiling
|
||||
|
@ -5,9 +5,6 @@ ac_add_options --enable-optimize="-O2 -g"
|
||||
# ASan specific options on Linux
|
||||
ac_add_options --enable-valgrind
|
||||
|
||||
# Other options
|
||||
ac_add_options --enable-codesighs
|
||||
|
||||
. $topsrcdir/build/unix/mozconfig.asan
|
||||
|
||||
# Package js shell.
|
||||
|
@ -1,6 +1,5 @@
|
||||
. "$topsrcdir/browser/config/mozconfigs/linux64/common-opt"
|
||||
|
||||
ac_add_options --enable-codesighs
|
||||
ac_add_options --enable-signmar
|
||||
ac_add_options --enable-profiling
|
||||
ac_add_options --disable-elf-hack # --enable-elf-hack conflicts with --enable-profiling
|
||||
|
@ -5,9 +5,6 @@ ac_add_options --enable-optimize="-O2 -g"
|
||||
# ASan specific options on Linux
|
||||
ac_add_options --enable-valgrind
|
||||
|
||||
# Other options
|
||||
ac_add_options --enable-codesighs
|
||||
|
||||
. $topsrcdir/build/unix/mozconfig.asan
|
||||
|
||||
# Package js shell.
|
||||
|
@ -1,6 +1,5 @@
|
||||
. "$topsrcdir/browser/config/mozconfigs/macosx-universal/common-opt"
|
||||
|
||||
ac_add_options --enable-codesighs
|
||||
ac_add_options --disable-install-strip
|
||||
ac_add_options --enable-signmar
|
||||
ac_add_options --enable-profiling
|
||||
|
@ -16,7 +16,6 @@ for platform in all_platforms:
|
||||
|
||||
for platform in ['linux32', 'linux64', 'macosx-universal']:
|
||||
whitelist['nightly'][platform] += [
|
||||
'ac_add_options --enable-codesighs',
|
||||
'mk_add_options MOZ_MAKE_FLAGS="-j4"',
|
||||
]
|
||||
|
||||
|
@ -324,23 +324,11 @@ ifdef MOZ_DEBUG
|
||||
CODFILE=$(basename $(@F)).cod
|
||||
endif
|
||||
|
||||
ifdef MOZ_MAPINFO
|
||||
ifdef SHARED_LIBRARY_NAME
|
||||
MAPFILE=$(SHARED_LIBRARY_NAME).map
|
||||
else
|
||||
MAPFILE=$(basename $(@F)).map
|
||||
endif # SHARED_LIBRARY_NAME
|
||||
endif # MOZ_MAPINFO
|
||||
|
||||
ifdef DEFFILE
|
||||
OS_LDFLAGS += -DEF:$(call normalizepath,$(DEFFILE))
|
||||
EXTRA_DEPS += $(DEFFILE)
|
||||
endif
|
||||
|
||||
ifdef MAPFILE
|
||||
OS_LDFLAGS += -MAP:$(MAPFILE)
|
||||
endif
|
||||
|
||||
else #!GNU_CC
|
||||
|
||||
ifdef DEFFILE
|
||||
@ -399,7 +387,7 @@ ALL_TRASH = \
|
||||
$(OBJS:.$(OBJ_SUFFIX)=.i) $(OBJS:.$(OBJ_SUFFIX)=.i_o) \
|
||||
$(HOST_PROGOBJS) $(HOST_OBJS) $(IMPORT_LIBRARY) $(DEF_FILE)\
|
||||
$(EXE_DEF_FILE) so_locations _gen _stubs $(wildcard *.res) $(wildcard *.RES) \
|
||||
$(wildcard *.pdb) $(CODFILE) $(MAPFILE) $(IMPORT_LIBRARY) \
|
||||
$(wildcard *.pdb) $(CODFILE) $(IMPORT_LIBRARY) \
|
||||
$(SHARED_LIBRARY:$(DLL_SUFFIX)=.exp) $(wildcard *.ilk) \
|
||||
$(PROGRAM:$(BIN_SUFFIX)=.exp) $(SIMPLE_PROGRAMS:$(BIN_SUFFIX)=.exp) \
|
||||
$(PROGRAM:$(BIN_SUFFIX)=.lib) $(SIMPLE_PROGRAMS:$(BIN_SUFFIX)=.lib) \
|
||||
|
16
configure.in
16
configure.in
@ -7567,21 +7567,6 @@ if test -n "$MOZ_REFLOW_PERF"; then
|
||||
AC_DEFINE(MOZ_REFLOW_PERF)
|
||||
fi
|
||||
|
||||
dnl ========================================================
|
||||
dnl Enable code size metrics.
|
||||
dnl ========================================================
|
||||
MOZ_ARG_ENABLE_BOOL(codesighs,
|
||||
[ --enable-codesighs Enable code size analysis tools],
|
||||
_ENABLE_CODESIGHS=1,
|
||||
_ENABLE_CODESIGHS= )
|
||||
if test -n "$_ENABLE_CODESIGHS"; then
|
||||
if test -d $srcdir/tools/codesighs; then
|
||||
MOZ_MAPINFO=1
|
||||
else
|
||||
AC_MSG_ERROR([Codesighs directory $srcdir/tools/codesighs required.])
|
||||
fi
|
||||
fi
|
||||
|
||||
dnl ========================================================
|
||||
dnl = Enable Radio Interface for B2G (Gonk usually)
|
||||
dnl ========================================================
|
||||
@ -8774,7 +8759,6 @@ if test -n "$MOZ_TELEMETRY_REPORTING" || test -n "$MOZ_SERVICES_HEALTHREPORT" ||
|
||||
fi
|
||||
|
||||
dnl win32 options
|
||||
AC_SUBST(MOZ_MAPINFO)
|
||||
AC_SUBST(MOZ_BROWSE_INFO)
|
||||
AC_SUBST(MOZ_TOOLS_DIR)
|
||||
AC_SUBST(WIN32_REDIST_DIR)
|
||||
|
@ -324,23 +324,11 @@ ifdef MOZ_DEBUG
|
||||
CODFILE=$(basename $(@F)).cod
|
||||
endif
|
||||
|
||||
ifdef MOZ_MAPINFO
|
||||
ifdef SHARED_LIBRARY_NAME
|
||||
MAPFILE=$(SHARED_LIBRARY_NAME).map
|
||||
else
|
||||
MAPFILE=$(basename $(@F)).map
|
||||
endif # SHARED_LIBRARY_NAME
|
||||
endif # MOZ_MAPINFO
|
||||
|
||||
ifdef DEFFILE
|
||||
OS_LDFLAGS += -DEF:$(call normalizepath,$(DEFFILE))
|
||||
EXTRA_DEPS += $(DEFFILE)
|
||||
endif
|
||||
|
||||
ifdef MAPFILE
|
||||
OS_LDFLAGS += -MAP:$(MAPFILE)
|
||||
endif
|
||||
|
||||
else #!GNU_CC
|
||||
|
||||
ifdef DEFFILE
|
||||
@ -399,7 +387,7 @@ ALL_TRASH = \
|
||||
$(OBJS:.$(OBJ_SUFFIX)=.i) $(OBJS:.$(OBJ_SUFFIX)=.i_o) \
|
||||
$(HOST_PROGOBJS) $(HOST_OBJS) $(IMPORT_LIBRARY) $(DEF_FILE)\
|
||||
$(EXE_DEF_FILE) so_locations _gen _stubs $(wildcard *.res) $(wildcard *.RES) \
|
||||
$(wildcard *.pdb) $(CODFILE) $(MAPFILE) $(IMPORT_LIBRARY) \
|
||||
$(wildcard *.pdb) $(CODFILE) $(IMPORT_LIBRARY) \
|
||||
$(SHARED_LIBRARY:$(DLL_SUFFIX)=.exp) $(wildcard *.ilk) \
|
||||
$(PROGRAM:$(BIN_SUFFIX)=.exp) $(SIMPLE_PROGRAMS:$(BIN_SUFFIX)=.exp) \
|
||||
$(PROGRAM:$(BIN_SUFFIX)=.lib) $(SIMPLE_PROGRAMS:$(BIN_SUFFIX)=.lib) \
|
||||
|
@ -4072,7 +4072,6 @@ AC_SUBST(MOZ_PKG_SPECIAL)
|
||||
AC_SUBST(MOZILLA_OFFICIAL)
|
||||
|
||||
dnl win32 options
|
||||
AC_SUBST(MOZ_MAPINFO)
|
||||
AC_SUBST(MOZ_BROWSE_INFO)
|
||||
AC_SUBST(MOZ_TOOLS_DIR)
|
||||
|
||||
|
@ -17,10 +17,6 @@ LIBS = \
|
||||
$(NSPR_LIBS) \
|
||||
$(NULL)
|
||||
|
||||
ifeq ($(OS_ARCH),WINNT)
|
||||
MAPFILE=rdfcat.map
|
||||
endif
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
CXXFLAGS += $(TK_CFLAGS)
|
||||
|
@ -17,10 +17,6 @@ LIBS = \
|
||||
$(NSPR_LIBS) \
|
||||
$(NULL)
|
||||
|
||||
ifeq ($(OS_ARCH),WINNT)
|
||||
MAPFILE=triplescat.map
|
||||
endif
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
CXXFLAGS += $(TK_CFLAGS)
|
||||
|
@ -513,7 +513,6 @@ NO_PKG_FILES += \
|
||||
nsinstall \
|
||||
viewer \
|
||||
TestGtkEmbed \
|
||||
codesighs* \
|
||||
elf-dynstr-gc \
|
||||
mangle* \
|
||||
maptsv* \
|
||||
@ -818,16 +817,6 @@ upload: checksum
|
||||
$(UPLOAD_FILES) \
|
||||
$(CHECKSUM_FILES)
|
||||
|
||||
ifeq (WINNT,$(OS_TARGET))
|
||||
CODESIGHS_PACKAGE = $(INSTALLER_PACKAGE)
|
||||
else
|
||||
CODESIGHS_PACKAGE = $(DIST)/$(PACKAGE)
|
||||
endif
|
||||
|
||||
codesighs:
|
||||
$(PYTHON) $(topsrcdir)/tools/codesighs/codesighs.py \
|
||||
"$(DIST)/$(MOZ_PKG_DIR)" "$(CODESIGHS_PACKAGE)"
|
||||
|
||||
ifndef MOZ_PKG_SRCDIR
|
||||
MOZ_PKG_SRCDIR = $(topsrcdir)
|
||||
endif
|
||||
|
@ -177,9 +177,6 @@ if not CONFIG['MOZ_ENABLE_LIBCONIC'] and not CONFIG['MOZ_ENABLE_QTNETWORK'] and
|
||||
|
||||
add_tier_dir('platform', 'addon-sdk')
|
||||
|
||||
if CONFIG['MOZ_MAPINFO']:
|
||||
add_tier_dir('platform', 'tools/codesighs')
|
||||
|
||||
if CONFIG['ENABLE_MARIONETTE'] or CONFIG['MOZ_WIDGET_TOOLKIT'] not in ('gonk', 'android'):
|
||||
add_tier_dir('platform', 'testing/marionette')
|
||||
|
||||
|
@ -1,41 +0,0 @@
|
||||
#
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
DEPTH = @DEPTH@
|
||||
topsrcdir = @top_srcdir@
|
||||
srcdir = @srcdir@
|
||||
VPATH = @srcdir@
|
||||
|
||||
include $(DEPTH)/config/autoconf.mk
|
||||
|
||||
|
||||
DISABLED_CSRCS += \
|
||||
codesighs.c \
|
||||
maptsvdifftool.c \
|
||||
$(NULL)
|
||||
|
||||
ifeq ($(OS_ARCH),WINNT)
|
||||
DISABLED_CSRCS += \
|
||||
msmap2tsv.c \
|
||||
msdump2symdb.c \
|
||||
$(NULL)
|
||||
else
|
||||
DISABLED_CSRCS += \
|
||||
nm2tsv.c \
|
||||
$(NULL)
|
||||
endif
|
||||
|
||||
DISABLED_SIMPLE_PROGRAMS = $(CSRCS:.c=$(BIN_SUFFIX))
|
||||
|
||||
include $(topsrcdir)/config/config.mk
|
||||
|
||||
ifeq ($(OS_ARCH),WINNT)
|
||||
OS_LIBS += \
|
||||
imagehlp.lib \
|
||||
$(NULL)
|
||||
endif
|
||||
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
@ -1,215 +0,0 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
#
|
||||
# Check for optional objdir
|
||||
#
|
||||
if [ "$1" = "-o" ]; then
|
||||
OBJROOT="$2"
|
||||
shift
|
||||
shift
|
||||
else
|
||||
OBJROOT="./mozilla"
|
||||
fi
|
||||
|
||||
if [ "$1" = "-s" ]; then
|
||||
SRCROOT="$2"
|
||||
shift
|
||||
shift
|
||||
else
|
||||
SRCROOT="./mozilla"
|
||||
fi
|
||||
|
||||
#
|
||||
# A little help for my friends.
|
||||
#
|
||||
if [ "-h" == "$1" ];then
|
||||
SHOWHELP="1"
|
||||
fi
|
||||
if [ "--help" == "$1" ];then
|
||||
SHOWHELP="1"
|
||||
fi
|
||||
if [ "" == "$1" ]; then
|
||||
SHOWHELP="1"
|
||||
fi
|
||||
if [ "" == "$2" ]; then
|
||||
SHOWHELP="1"
|
||||
fi
|
||||
if [ "" == "$3" ]; then
|
||||
SHOWHELP="1"
|
||||
fi
|
||||
|
||||
|
||||
#
|
||||
# Show the help if required.
|
||||
#
|
||||
if [ $SHOWHELP ]; then
|
||||
echo "usage: $0 <save_results> <old_results> <summary>"
|
||||
echo " <save_results> is a file that will receive the results of this run."
|
||||
echo " This file can be used in a future run as the old results."
|
||||
echo " <old_results> is a results file from a previous run."
|
||||
echo " It is used to diff with current results and come up with a summary"
|
||||
echo " of changes."
|
||||
echo " It is OK if the file does not exist, just supply the argument."
|
||||
echo " <summary> is a file which will contain a human readable report."
|
||||
echo " This file is most useful by providing more information than the"
|
||||
echo " normally single digit output of this script."
|
||||
echo ""
|
||||
echo "Run this command from the parent directory of the mozilla tree."
|
||||
echo ""
|
||||
echo "This command will output two numbers to stdout that will represent"
|
||||
echo " the total size of all code and data, and a delta from the prior."
|
||||
echo " the old results."
|
||||
echo "For much more detail on size drifts refer to the summary report."
|
||||
echo ""
|
||||
echo "This tool reports on all executables in the directory tree."
|
||||
exit
|
||||
fi
|
||||
|
||||
#
|
||||
# Stash our arguments away.
|
||||
#
|
||||
COPYSORTTSV="$1"
|
||||
OLDTSVFILE="$2"
|
||||
SUMMARYFILE="$3"
|
||||
|
||||
OSTYPE=`uname -s`
|
||||
|
||||
#
|
||||
# On Mac OS X, use the --zerodrift option to maptsvdifftool
|
||||
#
|
||||
if [ $OSTYPE == "Darwin" ]; then
|
||||
ZERODRIFT="--zerodrift"
|
||||
else
|
||||
ZERODRIFT=""
|
||||
fi
|
||||
|
||||
#
|
||||
# Create our temporary directory.
|
||||
# mktemp on Darwin doesn't support -d (suckage)
|
||||
#
|
||||
if [ $OSTYPE == "Darwin" ]; then
|
||||
ZERODRIFT="--zerodrift"
|
||||
MYTMPDIR=`mktemp ./codesighs.tmp.XXXXXXXX`
|
||||
rm $MYTMPDIR
|
||||
mkdir $MYTMPDIR
|
||||
else
|
||||
MYTMPDIR=`mktemp -d ./codesighs.tmp.XXXXXXXX`
|
||||
fi
|
||||
|
||||
#
|
||||
# Find all relevant files.
|
||||
#
|
||||
ALLFILES="$MYTMPDIR/allfiles.list"
|
||||
|
||||
if [ $OSTYPE == "Darwin" ] || [ $OSTYPE == "SunOS" ]; then
|
||||
find $OBJROOT/dist/bin ! -type d > $ALLFILES
|
||||
else
|
||||
find $OBJROOT/dist/bin -not -type d > $ALLFILES
|
||||
fi
|
||||
|
||||
# Check whether we have 'eu-readelf' or 'readelf' available.
|
||||
# If we do, it will give more accurate symbol sizes than nm.
|
||||
|
||||
if [ $OSTYPE == "Darwin" ]; then
|
||||
USE_READELF=
|
||||
else
|
||||
READELF_PROG=`which eu-readelf 2>/dev/null | grep /eu-readelf$`
|
||||
if test "$READELF_PROG"; then
|
||||
USE_READELF=1
|
||||
else
|
||||
READELF_PROG=`which readelf 2>/dev/null | grep /readelf$`
|
||||
if test "$READELF_PROG"; then
|
||||
# Check whether we need -W
|
||||
if readelf --help | grep "\--wide" >&/dev/null; then
|
||||
READELF_PROG="readelf -W"
|
||||
else
|
||||
READELF_PROG="readelf"
|
||||
fi
|
||||
USE_READELF=1
|
||||
else
|
||||
USE_READELF=
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
RAWTSVFILE="$MYTMPDIR/raw.tsv"
|
||||
if test "$USE_READELF"; then
|
||||
export READELF_PROG
|
||||
xargs -n 1 $SRCROOT/tools/codesighs/readelf_wrap.pl < $ALLFILES > $RAWTSVFILE 2> /dev/null
|
||||
else
|
||||
|
||||
#
|
||||
# Produce the cumulative nm output.
|
||||
# We are very particular on what switches to use.
|
||||
# nm --format=bsd --size-sort --print-file-name --demangle
|
||||
#
|
||||
# Darwin (Mac OS X) has a lame nm that we have to wrap in a perl
|
||||
# script to get decent output.
|
||||
#
|
||||
NMRESULTS="$MYTMPDIR/nm.txt"
|
||||
if [ $OSTYPE == "Darwin" ]; then
|
||||
xargs -n 1 $SRCROOT/tools/codesighs/nm_wrap_osx.pl < $ALLFILES > $NMRESULTS 2> /dev/null
|
||||
else
|
||||
xargs -n 1 nm --format=bsd --size-sort --print-file-name --demangle < $ALLFILES > $NMRESULTS 2> /dev/null
|
||||
fi
|
||||
|
||||
|
||||
#
|
||||
# Produce the TSV output.
|
||||
#
|
||||
|
||||
$OBJROOT/dist/bin/nm2tsv --input $NMRESULTS > $RAWTSVFILE
|
||||
|
||||
fi # USE_READELF
|
||||
|
||||
#
|
||||
# Sort the TSV output for useful diffing and eyeballing in general.
|
||||
#
|
||||
sort -r $RAWTSVFILE > $COPYSORTTSV
|
||||
|
||||
|
||||
#
|
||||
# If a historical file was specified, diff it with our sorted tsv values.
|
||||
# Run it through a tool to summaries the diffs to the module
|
||||
# level report.
|
||||
# Otherwise, generate the module level report from our new data.
|
||||
#
|
||||
|
||||
rm -f $SUMMARYFILE
|
||||
DIFFFILE="$MYTMPDIR/diff.txt"
|
||||
if [ -e $OLDTSVFILE ]; then
|
||||
diff $OLDTSVFILE $COPYSORTTSV > $DIFFFILE
|
||||
$OBJROOT/dist/bin/maptsvdifftool $ZERODRIFT --input $DIFFFILE >> $SUMMARYFILE
|
||||
else
|
||||
$OBJROOT/dist/bin/codesighs --modules --input $COPYSORTTSV >> $SUMMARYFILE
|
||||
fi
|
||||
|
||||
|
||||
#
|
||||
# Output our numbers, that will let tinderbox specify everything all
|
||||
# at once.
|
||||
# First number is in fact the total size of all code and data in the map
|
||||
# files parsed.
|
||||
# Second number, if present, is growth/shrinkage.
|
||||
#
|
||||
|
||||
if [ $TINDERBOX_OUTPUT ]; then
|
||||
echo -n "__codesize:"
|
||||
fi
|
||||
$OBJROOT/dist/bin/codesighs --totalonly --input $COPYSORTTSV
|
||||
|
||||
if [ -e $DIFFFILE ]; then
|
||||
if [ $TINDERBOX_OUTPUT ]; then
|
||||
echo -n "__codesizeDiff:"
|
||||
fi
|
||||
$OBJROOT/dist/bin/maptsvdifftool $ZERODRIFT --summary --input $DIFFFILE
|
||||
fi
|
||||
|
||||
#
|
||||
# Remove our temporary directory.
|
||||
#
|
||||
rm -rf $MYTMPDIR
|
@ -1,177 +0,0 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
#
|
||||
# Check for optional objdir
|
||||
#
|
||||
if [ "$1" = "-o" ]; then
|
||||
OBJROOT="$2"
|
||||
shift
|
||||
shift
|
||||
else
|
||||
OBJROOT="./mozilla"
|
||||
fi
|
||||
|
||||
if [ "$1" = "-s" ]; then
|
||||
SRCROOT="$2"
|
||||
shift
|
||||
shift
|
||||
else
|
||||
SRCROOT="./mozilla"
|
||||
fi
|
||||
|
||||
#
|
||||
# A little help for my friends.
|
||||
#
|
||||
if [ "-h" == "$1" ];then
|
||||
SHOWHELP="1"
|
||||
fi
|
||||
if [ "--help" == "$1" ];then
|
||||
SHOWHELP="1"
|
||||
fi
|
||||
if [ "" == "$1" ]; then
|
||||
SHOWHELP="1"
|
||||
fi
|
||||
if [ "" == "$2" ]; then
|
||||
SHOWHELP="1"
|
||||
fi
|
||||
if [ "" == "$3" ]; then
|
||||
SHOWHELP="1"
|
||||
fi
|
||||
|
||||
|
||||
#
|
||||
# Show the help if required.
|
||||
#
|
||||
if [ $SHOWHELP ]; then
|
||||
echo "usage: $0 <save_results> <old_results> <summary>"
|
||||
echo " <save_results> is a file that will receive the results of this run."
|
||||
echo " This file can be used in a future run as the old results."
|
||||
echo " <old_results> is a results file from a previous run."
|
||||
echo " It is used to diff with current results and come up with a summary"
|
||||
echo " of changes."
|
||||
echo " It is OK if the file does not exist, just supply the argument."
|
||||
echo " <summary> is a file which will contain a human readable report."
|
||||
echo " This file is most useful by providing more information than the"
|
||||
echo " normally single digit output of this script."
|
||||
echo ""
|
||||
echo "Run this command from the parent directory of the mozilla tree."
|
||||
echo ""
|
||||
echo "This command will output two numbers to stdout that will represent"
|
||||
echo " the total size of all code and data, and a delta from the prior."
|
||||
echo " the old results."
|
||||
echo "For much more detail on size drifts refer to the summary report."
|
||||
echo ""
|
||||
echo "This tool reports on all executables in the directory tree."
|
||||
exit
|
||||
fi
|
||||
|
||||
|
||||
#
|
||||
# Stash our arguments away.
|
||||
#
|
||||
COPYSORTTSV="$1"
|
||||
OLDTSVFILE="$2"
|
||||
SUMMARYFILE="$3"
|
||||
|
||||
|
||||
#
|
||||
# Create our temporary directory.
|
||||
#
|
||||
MYTMPDIR=`mktemp -d ./codesighs.tmp.XXXXXXXX`
|
||||
|
||||
|
||||
#
|
||||
# Find the types of files we are interested in.
|
||||
#
|
||||
ONEFINDPASS="$MYTMPDIR/onefind.list"
|
||||
/usr/bin/find $OBJROOT -type f -name "*.obj" -or -name "*.map" | while read FNAME; do
|
||||
cygpath -m $FNAME >> $ONEFINDPASS
|
||||
done
|
||||
|
||||
|
||||
#
|
||||
# Find all object files.
|
||||
#
|
||||
ALLOBJSFILE="$MYTMPDIR/allobjs.list"
|
||||
grep -i "\.obj$" < $ONEFINDPASS > $ALLOBJSFILE
|
||||
|
||||
|
||||
#
|
||||
# Get a dump of the symbols in every object file.
|
||||
#
|
||||
ALLOBJSYMSFILE="$MYTMPDIR/allobjsyms.list"
|
||||
xargs -n 1 dumpbin.exe /symbols < $ALLOBJSFILE > $ALLOBJSYMSFILE 2> /dev/null
|
||||
|
||||
|
||||
#
|
||||
# Produce the symdb for the symbols in all object files.
|
||||
#
|
||||
SYMDBFILE="$MYTMPDIR/symdb.tsv"
|
||||
$OBJROOT/dist/bin/msdump2symdb --input $ALLOBJSYMSFILE | /usr/bin/sort > $SYMDBFILE 2> /dev/null
|
||||
|
||||
|
||||
#
|
||||
# Find all map files.
|
||||
#
|
||||
ALLMAPSFILE="$MYTMPDIR/allmaps.list"
|
||||
grep -i "\.map$" < $ONEFINDPASS > $ALLMAPSFILE
|
||||
|
||||
|
||||
#
|
||||
# Produce the TSV output.
|
||||
#
|
||||
RAWTSVFILE="$MYTMPDIR/raw.tsv"
|
||||
$OBJROOT/dist/bin/msmap2tsv --symdb $SYMDBFILE --batch < $ALLMAPSFILE > $RAWTSVFILE 2> /dev/null
|
||||
|
||||
|
||||
#
|
||||
# Sort the TSV output for useful diffing and eyeballing in general.
|
||||
#
|
||||
/usr/bin/sort -r $RAWTSVFILE > $COPYSORTTSV
|
||||
|
||||
|
||||
#
|
||||
# If a historical file was specified, diff it with our sorted tsv values.
|
||||
# Run it through a tool to summaries the diffs to the module
|
||||
# level report.
|
||||
# Otherwise, generate the module level report from our new data.
|
||||
#
|
||||
rm -f $SUMMARYFILE
|
||||
DIFFFILE="$MYTMPDIR/diff.txt"
|
||||
if [ -e $OLDTSVFILE ]; then
|
||||
diff $OLDTSVFILE $COPYSORTTSV > $DIFFFILE
|
||||
$OBJROOT/dist/bin/maptsvdifftool --negation --input $DIFFFILE | dos2unix >> $SUMMARYFILE
|
||||
else
|
||||
$OBJROOT/dist/bin/codesighs --modules --input $COPYSORTTSV | dos2unix >> $SUMMARYFILE
|
||||
fi
|
||||
|
||||
|
||||
#
|
||||
# Output our numbers, that will let tinderbox specify everything all
|
||||
# at once.
|
||||
# First number is in fact the total size of all code and data in the map
|
||||
# files parsed.
|
||||
# Second number, if present, is growth/shrinkage.
|
||||
#
|
||||
|
||||
if [ $TINDERBOX_OUTPUT ]; then
|
||||
echo -n "__codesize:"
|
||||
fi
|
||||
$OBJROOT/dist/bin/codesighs --totalonly --input $COPYSORTTSV | dos2unix
|
||||
|
||||
|
||||
if [ -e $DIFFFILE ]; then
|
||||
if [ $TINDERBOX_OUTPUT ]; then
|
||||
echo -n "__codesizeDiff:"
|
||||
fi
|
||||
$OBJROOT/dist/bin/maptsvdifftool --negation --summary --input $DIFFFILE | dos2unix
|
||||
fi
|
||||
|
||||
#
|
||||
# Remove our temporary directory.
|
||||
#
|
||||
rm -rf $MYTMPDIR
|
File diff suppressed because it is too large
Load Diff
@ -1,64 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
# Copyright 2011 Mozilla Foundation. 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.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE MOZILLA FOUNDATION ``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 MOZILLA FOUNDATION 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 views and conclusions contained in the software and documentation
|
||||
# are those of the authors and should not be interpreted as representing
|
||||
# official policies, either expressed or implied, of the Mozilla
|
||||
# Foundation.
|
||||
|
||||
import sys, os
|
||||
|
||||
def sumDirectorySize(path):
|
||||
"""
|
||||
Calculate the total size of all the files under |path|.
|
||||
"""
|
||||
total = 0
|
||||
def reraise(e):
|
||||
raise e
|
||||
for root, dirs, files in os.walk(path, onerror=reraise):
|
||||
for f in files:
|
||||
total += os.path.getsize(os.path.join(root, f))
|
||||
return total
|
||||
|
||||
def codesighs(stagepath, installerpath):
|
||||
"""
|
||||
Calculate the total size of the files under |stagepath| on disk
|
||||
and print it as "__codesize", and print the size of the file at
|
||||
|installerpath| as "__installersize".
|
||||
"""
|
||||
try:
|
||||
print "__codesize:%d" % sumDirectorySize(stagepath)
|
||||
print "__installersize:%d" % os.path.getsize(installerpath)
|
||||
except OSError, e:
|
||||
print >>sys.stderr, """Couldn't read file %s.
|
||||
Perhaps you need to run |make package| or |make installer|?""" % e.filename
|
||||
|
||||
if __name__ == '__main__':
|
||||
if len(sys.argv) < 3:
|
||||
print >>sys.stderr, "Usage: codesighs.py <package stage path> <installer path>"
|
||||
sys.exit(1)
|
||||
codesighs(sys.argv[1], sys.argv[2])
|
File diff suppressed because it is too large
Load Diff
@ -1,25 +0,0 @@
|
||||
# -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
|
||||
# vim: set filetype=python:
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
CSRCS += [
|
||||
'codesighs.c',
|
||||
'maptsvdifftool.c',
|
||||
]
|
||||
|
||||
if CONFIG['OS_ARCH'] == 'WINNT':
|
||||
CSRCS += [
|
||||
'msdump2symdb.c',
|
||||
'msmap2tsv.c',
|
||||
]
|
||||
else:
|
||||
CSRCS += [
|
||||
'nm2tsv.c',
|
||||
]
|
||||
|
||||
bin_suffix = CONFIG['BIN_SUFFIX']
|
||||
SIMPLE_PROGRAMS += [
|
||||
"%s%s" % (x[0:-2], bin_suffix) for x in CSRCS
|
||||
]
|
File diff suppressed because it is too large
Load Diff
@ -1,115 +0,0 @@
|
||||
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#if !defined __msmap_H
|
||||
#define __msmap_H
|
||||
|
||||
|
||||
#if defined(__cplusplus)
|
||||
extern "C" {
|
||||
#endif
|
||||
#if 0
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/*
|
||||
** Used to numerically represent addresses.
|
||||
*/
|
||||
typedef unsigned long address;
|
||||
|
||||
|
||||
typedef enum __enum_MSMap_SymbolScope
|
||||
/*
|
||||
** Symbol scope.
|
||||
*/
|
||||
{
|
||||
PUBLIC,
|
||||
STATIC,
|
||||
UNDEFINED
|
||||
}
|
||||
MSMap_SymbolScope;
|
||||
|
||||
|
||||
typedef enum __enum_MSMap_SegmentClass
|
||||
/*
|
||||
** Segment class.
|
||||
*/
|
||||
{
|
||||
CODE,
|
||||
DATA
|
||||
}
|
||||
MSMap_SegmentClass;
|
||||
|
||||
|
||||
typedef struct __struct_MSMap_Segment
|
||||
/*
|
||||
** Information about a segment.
|
||||
*/
|
||||
{
|
||||
address mPrefix;
|
||||
address mOffset;
|
||||
address mLength;
|
||||
address mUsed;
|
||||
char* mSegment;
|
||||
MSMap_SegmentClass mClass;
|
||||
}
|
||||
MSMap_Segment;
|
||||
|
||||
|
||||
typedef struct __struct_MSMap_Symbol
|
||||
/*
|
||||
** Information about a symbol.
|
||||
*/
|
||||
{
|
||||
address mPrefix;
|
||||
address mOffset;
|
||||
char* mSymbol;
|
||||
address mRVABase;
|
||||
char* mObject;
|
||||
MSMap_SymbolScope mScope;
|
||||
unsigned mSymDBSize;
|
||||
MSMap_Segment* mSection;
|
||||
}
|
||||
MSMap_Symbol;
|
||||
|
||||
|
||||
typedef struct __struct_MSMap_Module
|
||||
/*
|
||||
** Top level container of the map data.
|
||||
*/
|
||||
{
|
||||
char* mModule;
|
||||
time_t mTimestamp;
|
||||
address mPreferredLoadAddress;
|
||||
MSMap_Segment* mSegments;
|
||||
unsigned mSegmentCount;
|
||||
unsigned mSegmentCapacity;
|
||||
address mEntryPrefix;
|
||||
address mEntryOffset;
|
||||
MSMap_Symbol* mSymbols;
|
||||
unsigned mSymbolCount;
|
||||
unsigned mSymbolCapacity;
|
||||
}
|
||||
MSMap_Module;
|
||||
|
||||
|
||||
/*
|
||||
** How much to grow our arrays by.
|
||||
*/
|
||||
#define MSMAP_SEGMENT_GROWBY 0x10
|
||||
#define MSMAP_SYMBOL_GROWBY 0x100
|
||||
|
||||
|
||||
#if 0
|
||||
{
|
||||
#endif
|
||||
#if defined(__cplusplus)
|
||||
} /* extern "C" */
|
||||
#endif
|
||||
|
||||
|
||||
#endif /* __msmap_H */
|
File diff suppressed because it is too large
Load Diff
@ -1,471 +0,0 @@
|
||||
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
#include <ctype.h>
|
||||
|
||||
|
||||
#define ERROR_REPORT(num, val, msg) fprintf(stderr, "error(%d):\t\"%s\"\t%s\n", (num), (val), (msg));
|
||||
#define CLEANUP(ptr) do { if(NULL != ptr) { free(ptr); ptr = NULL; } } while(0)
|
||||
|
||||
|
||||
typedef struct __struct_Options
|
||||
/*
|
||||
** Options to control how we perform.
|
||||
**
|
||||
** mProgramName Used in help text.
|
||||
** mInput File to read for input.
|
||||
** Default is stdin.
|
||||
** mInputName Name of the file.
|
||||
** mOutput Output file, append.
|
||||
** Default is stdout.
|
||||
** mOutputName Name of the file.
|
||||
** mHelp Whether or not help should be shown.
|
||||
*/
|
||||
{
|
||||
const char* mProgramName;
|
||||
FILE* mInput;
|
||||
char* mInputName;
|
||||
FILE* mOutput;
|
||||
char* mOutputName;
|
||||
int mHelp;
|
||||
}
|
||||
Options;
|
||||
|
||||
|
||||
typedef struct __struct_Switch
|
||||
/*
|
||||
** Command line options.
|
||||
*/
|
||||
{
|
||||
const char* mLongName;
|
||||
const char* mShortName;
|
||||
int mHasValue;
|
||||
const char* mValue;
|
||||
const char* mDescription;
|
||||
}
|
||||
Switch;
|
||||
|
||||
#define DESC_NEWLINE "\n\t\t"
|
||||
|
||||
static Switch gInputSwitch = {"--input", "-i", 1, NULL, "Specify input file." DESC_NEWLINE "stdin is default."};
|
||||
static Switch gOutputSwitch = {"--output", "-o", 1, NULL, "Specify output file." DESC_NEWLINE "Appends if file exists." DESC_NEWLINE "stdout is default."};
|
||||
static Switch gHelpSwitch = {"--help", "-h", 0, NULL, "Information on usage."};
|
||||
|
||||
static Switch* gSwitches[] = {
|
||||
&gInputSwitch,
|
||||
&gOutputSwitch,
|
||||
&gHelpSwitch
|
||||
};
|
||||
|
||||
|
||||
char* scanWhite(char* inScan)
|
||||
/*
|
||||
** Scan for whitespace.
|
||||
*/
|
||||
{
|
||||
char* retval = inScan;
|
||||
|
||||
while('\0' != *retval && 0 == isspace(*retval))
|
||||
{
|
||||
retval++;
|
||||
}
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
void trimWhite(char* inString)
|
||||
/*
|
||||
** Remove any whitespace from the end of the string.
|
||||
*/
|
||||
{
|
||||
int len = strlen(inString);
|
||||
|
||||
while(len)
|
||||
{
|
||||
len--;
|
||||
|
||||
if(isspace(*(inString + len)))
|
||||
{
|
||||
*(inString + len) = '\0';
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
int nm2tsv(Options* inOptions)
|
||||
/*
|
||||
** Read all input.
|
||||
** Output tab separated value data.
|
||||
**
|
||||
** We expect our data to be in a particular format.
|
||||
** nm --format=bsd --size-sort --print-file-name --demangle
|
||||
*/
|
||||
{
|
||||
int retval = 0;
|
||||
char lineBuffer[4096]; /* yes, the are some very large symbols */
|
||||
char* module = NULL;
|
||||
char* size = NULL;
|
||||
char* type = NULL;
|
||||
char* symbol = NULL;
|
||||
|
||||
/*
|
||||
** Read in the nm file.
|
||||
*/
|
||||
while(0 == retval && NULL != fgets(lineBuffer, sizeof(lineBuffer), inOptions->mInput))
|
||||
{
|
||||
trimWhite(lineBuffer);
|
||||
|
||||
/*
|
||||
** Find the various pieces of information we'll be looking for.
|
||||
*/
|
||||
size = strchr(lineBuffer, ':');
|
||||
if(NULL != size)
|
||||
{
|
||||
*size = '\0';
|
||||
size++;
|
||||
|
||||
module = strrchr(lineBuffer, '/');
|
||||
if(NULL == module)
|
||||
{
|
||||
module = lineBuffer;
|
||||
}
|
||||
else
|
||||
{
|
||||
*module = '\0';
|
||||
module++;
|
||||
}
|
||||
|
||||
type = scanWhite(size);
|
||||
*type = '\0';
|
||||
type++;
|
||||
|
||||
symbol = type + 1;
|
||||
*symbol = '\0';
|
||||
symbol++;
|
||||
|
||||
/*
|
||||
** Skip certain types.
|
||||
*/
|
||||
switch(*type)
|
||||
{
|
||||
case '-':
|
||||
continue;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
** Simply output the data with a little more interpretation.
|
||||
** First is size.
|
||||
*/
|
||||
fprintf(inOptions->mOutput, "%s\t", size);
|
||||
|
||||
/*
|
||||
** Type, CODE or DATA
|
||||
*/
|
||||
switch(toupper(*type))
|
||||
{
|
||||
case 'T': /* text (code) */
|
||||
case 'W': /* weak symbol ??? */
|
||||
fprintf(inOptions->mOutput, "CODE\t");
|
||||
break;
|
||||
default:
|
||||
fprintf(inOptions->mOutput, "DATA\t");
|
||||
break;
|
||||
}
|
||||
|
||||
/*
|
||||
** Scope, PUBLIC, STATIC, or UNDEF
|
||||
*/
|
||||
if(islower(*type))
|
||||
{
|
||||
fprintf(inOptions->mOutput, "STATIC\t");
|
||||
}
|
||||
else
|
||||
{
|
||||
switch(*type)
|
||||
{
|
||||
case '?':
|
||||
fprintf(inOptions->mOutput, "UNDEF\t");
|
||||
break;
|
||||
default:
|
||||
fprintf(inOptions->mOutput, "PUBLIC\t");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
** Module name, segment.
|
||||
*/
|
||||
fprintf(inOptions->mOutput, "%s\t", module);
|
||||
fprintf(inOptions->mOutput, "%c\t", toupper(*type));
|
||||
|
||||
/*
|
||||
** Origin
|
||||
*/
|
||||
fprintf(inOptions->mOutput, "UNDEF:%s:%c\t", module, toupper(*type));
|
||||
|
||||
/*
|
||||
** Symbol is last.
|
||||
*/
|
||||
fprintf(inOptions->mOutput, "%s\n", symbol);
|
||||
}
|
||||
else
|
||||
{
|
||||
retval = __LINE__;
|
||||
ERROR_REPORT(retval, lineBuffer, "Malformed input line.");
|
||||
}
|
||||
}
|
||||
|
||||
if(0 == retval && 0 != ferror(inOptions->mInput))
|
||||
{
|
||||
retval = __LINE__;
|
||||
ERROR_REPORT(retval, inOptions->mInputName, "Unable to read file.");
|
||||
}
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
int initOptions(Options* outOptions, int inArgc, char** inArgv)
|
||||
/*
|
||||
** returns int 0 if successful.
|
||||
*/
|
||||
{
|
||||
int retval = 0;
|
||||
int loop = 0;
|
||||
int switchLoop = 0;
|
||||
int match = 0;
|
||||
const int switchCount = sizeof(gSwitches) / sizeof(gSwitches[0]);
|
||||
Switch* current = NULL;
|
||||
|
||||
/*
|
||||
** Set any defaults.
|
||||
*/
|
||||
memset(outOptions, 0, sizeof(Options));
|
||||
outOptions->mProgramName = inArgv[0];
|
||||
outOptions->mInput = stdin;
|
||||
outOptions->mInputName = strdup("stdin");
|
||||
outOptions->mOutput = stdout;
|
||||
outOptions->mOutputName = strdup("stdout");
|
||||
|
||||
if(NULL == outOptions->mOutputName || NULL == outOptions->mInputName)
|
||||
{
|
||||
retval = __LINE__;
|
||||
ERROR_REPORT(retval, "stdin/stdout", "Unable to strdup.");
|
||||
}
|
||||
|
||||
/*
|
||||
** Go through and attempt to do the right thing.
|
||||
*/
|
||||
for(loop = 1; loop < inArgc && 0 == retval; loop++)
|
||||
{
|
||||
match = 0;
|
||||
current = NULL;
|
||||
|
||||
for(switchLoop = 0; switchLoop < switchCount && 0 == retval; switchLoop++)
|
||||
{
|
||||
if(0 == strcmp(gSwitches[switchLoop]->mLongName, inArgv[loop]))
|
||||
{
|
||||
match = __LINE__;
|
||||
}
|
||||
else if(0 == strcmp(gSwitches[switchLoop]->mShortName, inArgv[loop]))
|
||||
{
|
||||
match = __LINE__;
|
||||
}
|
||||
|
||||
if(match)
|
||||
{
|
||||
if(gSwitches[switchLoop]->mHasValue)
|
||||
{
|
||||
/*
|
||||
** Attempt to absorb next option to fullfill value.
|
||||
*/
|
||||
if(loop + 1 < inArgc)
|
||||
{
|
||||
loop++;
|
||||
|
||||
current = gSwitches[switchLoop];
|
||||
current->mValue = inArgv[loop];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
current = gSwitches[switchLoop];
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(0 == match)
|
||||
{
|
||||
outOptions->mHelp = __LINE__;
|
||||
retval = __LINE__;
|
||||
ERROR_REPORT(retval, inArgv[loop], "Unknown command line switch.");
|
||||
}
|
||||
else if(NULL == current)
|
||||
{
|
||||
outOptions->mHelp = __LINE__;
|
||||
retval = __LINE__;
|
||||
ERROR_REPORT(retval, inArgv[loop], "Command line switch requires a value.");
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
** Do something based on address/swtich.
|
||||
*/
|
||||
if(current == &gInputSwitch)
|
||||
{
|
||||
CLEANUP(outOptions->mInputName);
|
||||
if(NULL != outOptions->mInput && stdin != outOptions->mInput)
|
||||
{
|
||||
fclose(outOptions->mInput);
|
||||
outOptions->mInput = NULL;
|
||||
}
|
||||
|
||||
outOptions->mInput = fopen(current->mValue, "r");
|
||||
if(NULL == outOptions->mInput)
|
||||
{
|
||||
retval = __LINE__;
|
||||
ERROR_REPORT(retval, current->mValue, "Unable to open input file.");
|
||||
}
|
||||
else
|
||||
{
|
||||
outOptions->mInputName = strdup(current->mValue);
|
||||
if(NULL == outOptions->mInputName)
|
||||
{
|
||||
retval = __LINE__;
|
||||
ERROR_REPORT(retval, current->mValue, "Unable to strdup.");
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(current == &gOutputSwitch)
|
||||
{
|
||||
CLEANUP(outOptions->mOutputName);
|
||||
if(NULL != outOptions->mOutput && stdout != outOptions->mOutput)
|
||||
{
|
||||
fclose(outOptions->mOutput);
|
||||
outOptions->mOutput = NULL;
|
||||
}
|
||||
|
||||
outOptions->mOutput = fopen(current->mValue, "a");
|
||||
if(NULL == outOptions->mOutput)
|
||||
{
|
||||
retval = __LINE__;
|
||||
ERROR_REPORT(retval, current->mValue, "Unable to open output file.");
|
||||
}
|
||||
else
|
||||
{
|
||||
outOptions->mOutputName = strdup(current->mValue);
|
||||
if(NULL == outOptions->mOutputName)
|
||||
{
|
||||
retval = __LINE__;
|
||||
ERROR_REPORT(retval, current->mValue, "Unable to strdup.");
|
||||
}
|
||||
}
|
||||
}
|
||||
else if(current == &gHelpSwitch)
|
||||
{
|
||||
outOptions->mHelp = __LINE__;
|
||||
}
|
||||
else
|
||||
{
|
||||
retval = __LINE__;
|
||||
ERROR_REPORT(retval, current->mLongName, "No handler for command line switch.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
|
||||
void cleanOptions(Options* inOptions)
|
||||
/*
|
||||
** Clean up any open handles.
|
||||
*/
|
||||
{
|
||||
CLEANUP(inOptions->mInputName);
|
||||
if(NULL != inOptions->mInput && stdin != inOptions->mInput)
|
||||
{
|
||||
fclose(inOptions->mInput);
|
||||
}
|
||||
CLEANUP(inOptions->mOutputName);
|
||||
if(NULL != inOptions->mOutput && stdout != inOptions->mOutput)
|
||||
{
|
||||
fclose(inOptions->mOutput);
|
||||
}
|
||||
|
||||
memset(inOptions, 0, sizeof(Options));
|
||||
}
|
||||
|
||||
|
||||
void showHelp(Options* inOptions)
|
||||
/*
|
||||
** Show some simple help text on usage.
|
||||
*/
|
||||
{
|
||||
int loop = 0;
|
||||
const int switchCount = sizeof(gSwitches) / sizeof(gSwitches[0]);
|
||||
const char* valueText = NULL;
|
||||
|
||||
printf("usage:\t%s [arguments]\n", inOptions->mProgramName);
|
||||
printf("\n");
|
||||
printf("arguments:\n");
|
||||
|
||||
for(loop = 0; loop < switchCount; loop++)
|
||||
{
|
||||
if(gSwitches[loop]->mHasValue)
|
||||
{
|
||||
valueText = " <value>";
|
||||
}
|
||||
else
|
||||
{
|
||||
valueText = "";
|
||||
}
|
||||
|
||||
printf("\t%s%s\n", gSwitches[loop]->mLongName, valueText);
|
||||
printf("\t %s%s", gSwitches[loop]->mShortName, valueText);
|
||||
printf(DESC_NEWLINE "%s\n\n", gSwitches[loop]->mDescription);
|
||||
}
|
||||
|
||||
printf("This tool normalizes nm output for use by other tools.\n");
|
||||
printf("GNU nm is assumed for symbol type determination.\n");
|
||||
printf("i.e. Use this tool to parse the output of:\n");
|
||||
printf("\t/usr/bin/nm --format=bsd --size-sort --print-file-name --demangle <exefile>\n");
|
||||
}
|
||||
|
||||
|
||||
int main(int inArgc, char** inArgv)
|
||||
{
|
||||
int retval = 0;
|
||||
Options options;
|
||||
|
||||
retval = initOptions(&options, inArgc, inArgv);
|
||||
if(options.mHelp)
|
||||
{
|
||||
showHelp(&options);
|
||||
}
|
||||
else if(0 == retval)
|
||||
{
|
||||
retval = nm2tsv(&options);
|
||||
}
|
||||
|
||||
cleanOptions(&options);
|
||||
return retval;
|
||||
}
|
||||
|
@ -1,71 +0,0 @@
|
||||
#!/usr/bin/perl -w
|
||||
#
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
use strict;
|
||||
|
||||
#
|
||||
# A wrapper for nm that produces output listing symbol size.
|
||||
#
|
||||
my($prev_addr) = 0;
|
||||
my($prev_module) = "";
|
||||
my($prev_kind) = "";
|
||||
my($prev_symbol) = "";
|
||||
|
||||
open(NM_OUTPUT, "nm -fnol $ARGV[0] | c++filt |") or die "nm failed to run on $ARGV[0]\n";
|
||||
while (<NM_OUTPUT>)
|
||||
{
|
||||
my($line) = $_;
|
||||
chomp($line);
|
||||
|
||||
if ($line =~ /^([^:]+):\s*([0-9a-f]{8}) (\w) (.+)$/)
|
||||
{
|
||||
my($module) = $1;
|
||||
my($addr) = $2;
|
||||
my($kind) = $3;
|
||||
my($symbol) = $4;
|
||||
|
||||
#Skip absolute addresses, there should be only a few
|
||||
if ('a' eq lc $kind) {
|
||||
if ('trampoline_size' ne $symbol) {
|
||||
warn "Encountered unknown absolutely addressed symbol '$symbol' in $module";
|
||||
}
|
||||
next;
|
||||
}
|
||||
|
||||
# we expect the input to have been piped through c++filt to
|
||||
# demangle symbols. For some reason, it doesn't always demangle
|
||||
# all of them, so push still-mangled symbols back through c++filt again.
|
||||
if ($symbol =~ /^(_[_Z].+)/)
|
||||
{
|
||||
# warn "Trying again to unmangle $1\n";
|
||||
$symbol = `c++filt '$1'`;
|
||||
chomp($symbol);
|
||||
# warn "Unmangling again to $symbol\n";
|
||||
}
|
||||
|
||||
my($prev_size) = hex($addr) - hex($prev_addr);
|
||||
# print "Outputting line $line\n";
|
||||
|
||||
# always print one behind, because only now do we know its size
|
||||
if ($prev_module ne "") {
|
||||
printf "%s:%08x %s %s\n", $prev_module, $prev_size, $prev_kind, $prev_symbol;
|
||||
}
|
||||
|
||||
$prev_addr = $addr;
|
||||
$prev_module = $module;
|
||||
$prev_kind = $kind;
|
||||
$prev_symbol = $symbol;
|
||||
}
|
||||
else
|
||||
{
|
||||
# warn " Discaring line $line\n";
|
||||
}
|
||||
}
|
||||
|
||||
# we don't know how big the last symbol is, so always show 4.
|
||||
if ($prev_module ne "") {
|
||||
printf "%s:%08x %s %s\n", $prev_module, 4, $prev_kind, $prev_symbol;
|
||||
}
|
@ -1,159 +0,0 @@
|
||||
#!/usr/bin/perl -w
|
||||
# -*- Mode: perl; tab-width: 4; indent-tabs-mode: nil; -*-
|
||||
# This Source Code Form is subject to the terms of the Mozilla Public
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
use strict;
|
||||
|
||||
# Section fields (the full list of values is in <elf.h>)
|
||||
my $SECT_NUM = 0; # section index
|
||||
my $SECT_NAME = 1; # section name
|
||||
my $SECT_TYPE = 2; # section type
|
||||
my $SECT_ADDR = 3; # section virtual address
|
||||
my $SECT_OFF = 4; # section offset in file
|
||||
my $SECT_SIZE = 5; # size of section
|
||||
my $SECT_ES = 6; # section entry size
|
||||
my $SECT_FLG = 7; # section flags
|
||||
my $SECT_LK = 8; # link to another section
|
||||
my $SECT_INF = 9; # additional section info
|
||||
my $SECT_AL = 10; # section alignment
|
||||
|
||||
|
||||
# Symbol fields (note: the full list of possible values for each field
|
||||
# is given in <elf.h>)
|
||||
|
||||
my $SYM_NUM = 0; # unique index of the symbol
|
||||
my $SYM_VALUE = 1; # value of the symbol
|
||||
my $SYM_SIZE = 2; # size of the symbol
|
||||
my $SYM_TYPE = 3; # type (NOTYPE, OBJECT, FUNC, SECTION, FILE, ...)
|
||||
my $SYM_BIND = 4; # binding/scope (LOCAL, GLOBAL, WEAK, ...)
|
||||
my $SYM_VIS = 5; # visibility (DEFAULT, INTERNAL, HIDDEN, PROTECTED)
|
||||
my $SYM_NDX = 6; # index of section the symbol is in
|
||||
my $SYM_NAME = 7; # name of the symbol
|
||||
my $SYM_FILE = 8; # (not part of readelf) file for symbol
|
||||
|
||||
# Tell readelf to print out the list of sections and then the symbols
|
||||
die "Usage: $^X <binary>\n" unless ($#ARGV >= 0);
|
||||
my $readelf = $ENV{'READELF_PROG'};
|
||||
if (!$readelf) {
|
||||
$readelf = 'readelf';
|
||||
}
|
||||
open(READELF_OUTPUT, "$readelf -Ss $ARGV[0] 2>/dev/null | c++filt |") or die "readelf failed to run on $ARGV[0]\n";
|
||||
|
||||
my @section_list;
|
||||
my @symbol_list;
|
||||
my ($module) = ($ARGV[0] =~ /([^\/]+)$/);
|
||||
my $in_symbols = 0;
|
||||
|
||||
while (<READELF_OUTPUT>) {
|
||||
|
||||
if (!$in_symbols) {
|
||||
if (/^ *\[ *(\d+)\]/) {
|
||||
my @section;
|
||||
|
||||
# note that we strip off the leading '.' of section names for
|
||||
# readability
|
||||
if (! (@section = (/^ *\[ *(\d+)\] \.([\w\.\-]+) *(\w+) *(.{8}) (.{6}[0-9a-fA-F]*) (.{6}[0-9a-fA-F]*) *(\d+) ([a-zA-Z]+ +| +[a-zA-Z]+|) *(\d+) *(\w+) *(\d+)/))) {
|
||||
# capture the 'null' section which has no name, so that the
|
||||
# array indices are the same as the section indices.
|
||||
|
||||
@section = ($1, '', 'NULL', '00000000', '000000', '000000',
|
||||
'00', '', '0', '0', '0');
|
||||
}
|
||||
|
||||
push (@section_list, \@section);
|
||||
} elsif (/^Symbol table/) {
|
||||
$in_symbols = 1;
|
||||
}
|
||||
} else {
|
||||
|
||||
my @sym;
|
||||
|
||||
if (@sym = /^\s*(\d+): (\w+)\s*(\d+)\s*(\w+)\s*(\w+)\s*(\w+)\s*(\w+) (.*)/)
|
||||
{
|
||||
# Filter out types of symbols that we don't care about:
|
||||
# - anything that's not of type OBJECT or FUNC
|
||||
# - any undefined symbols (ndx = UND[EF])
|
||||
# - any 0-size symbols
|
||||
|
||||
if (($sym[$SYM_TYPE] !~ /^(OBJECT|FUNC)$/) ||
|
||||
$sym[$SYM_NDX] eq 'UND' || $sym[$SYM_NDX] eq 'UNDEF'
|
||||
|| $sym[$SYM_SIZE] eq '0') {
|
||||
next;
|
||||
}
|
||||
push (@symbol_list, \@sym);
|
||||
}
|
||||
elsif (/^Symbol table .*'\.symtab'/) {
|
||||
# We've been using .dynsym up to this point, but if we have .symtab
|
||||
# available, it will have everything in .dynsym and more.
|
||||
# So, reset our symbol list.
|
||||
|
||||
@symbol_list = ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
close(READELF_OUTPUT);
|
||||
|
||||
# spit them out in codesighs TSV format
|
||||
my $sym;
|
||||
my @section_sizes;
|
||||
$#section_sizes = $#section_list;
|
||||
foreach (@section_sizes) { $_ = 0; }
|
||||
|
||||
foreach $sym (@symbol_list) {
|
||||
# size
|
||||
printf "%08x\t", $sym->[$SYM_SIZE];
|
||||
|
||||
# code or data
|
||||
if ($sym->[$SYM_TYPE] eq 'FUNC') {
|
||||
print "CODE\t";
|
||||
} else { # OBJECT
|
||||
print "DATA\t";
|
||||
}
|
||||
|
||||
# scope
|
||||
if ($sym->[$SYM_BIND] eq 'LOCAL') {
|
||||
print "STATIC\t";
|
||||
} elsif ($sym->[$SYM_BIND] =~ /(GLOBAL|WEAK)/) {
|
||||
print "PUBLIC\t";
|
||||
} else {
|
||||
print "UNDEF\t";
|
||||
}
|
||||
|
||||
# module name
|
||||
|
||||
print "$module\t";
|
||||
|
||||
# section
|
||||
my $section = $section_list[$sym->[$SYM_NDX]]->[$SECT_NAME];
|
||||
print "$section\t";
|
||||
|
||||
# should be the object file, but for now just module/section
|
||||
print "UNDEF:$module:$section\t";
|
||||
|
||||
# now the symbol name
|
||||
print $sym->[$SYM_NAME]."\n";
|
||||
|
||||
# update our cumulative section sizes
|
||||
$section_sizes[$section_list[$sym->[$SYM_NDX]]->[$SECT_NUM]] += $sym->[$SYM_SIZE];
|
||||
}
|
||||
|
||||
# Output extra entries to make the sum of the symbol sizes equal the
|
||||
# section size.
|
||||
|
||||
my $section;
|
||||
foreach $section (@section_list) {
|
||||
|
||||
my $diff = hex($section->[$SECT_SIZE]) - $section_sizes[$section->[$SECT_NUM]];
|
||||
if ($diff > 0) {
|
||||
my $sectname = $section->[$SECT_NAME];
|
||||
if ($section->[$SECT_NAME] =~ /^(rodata|data|text|bss)/) {
|
||||
printf "%08x", $diff;
|
||||
print "\tDATA\tSTATIC\t$module\t$sectname\tUNDEF:$module:$sectname\t.nosyms.$sectname\n";
|
||||
# } else {
|
||||
# print "ignoring $diff bytes of empty space in $sectname section\n";
|
||||
}
|
||||
}
|
||||
}
|
@ -44,7 +44,7 @@ smaller_is_better = frozenset(('tdhtmlr_paint', 'tp5n_main_rss_paint',
|
||||
'trace_malloc_leaks', 'tp4m_main_rss_nochrome',
|
||||
'tp4m_shutdown_nochrome', 'tdhtml_nochrome',
|
||||
'ts_shutdown', 'tp5n_%cpu_paint',
|
||||
'trace_malloc_allocs', 'ts', 'codesighs',
|
||||
'trace_malloc_allocs', 'ts',
|
||||
'tsvg_nochrome', 'tp5n_content_rss_paint',
|
||||
'tp5n_main_startup_fileio_paint',
|
||||
'tp5n_nonmain_normal_netio_paint',
|
||||
|
Loading…
x
Reference in New Issue
Block a user