Imported Upstream version 4.6.0.125

Former-commit-id: a2155e9bd80020e49e72e86c44da02a8ac0e57a4
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2016-08-03 10:59:49 +00:00
parent a569aebcfd
commit e79aa3c0ed
17047 changed files with 3137615 additions and 392334 deletions

View File

@@ -271,8 +271,6 @@ NM = @NM@
NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
OPROFILE_CFLAGS = @OPROFILE_CFLAGS@
OPROFILE_LIBS = @OPROFILE_LIBS@
OTOOL = @OTOOL@
OTOOL64 = @OTOOL64@
PACKAGE = @PACKAGE@

View File

@@ -1,242 +0,0 @@
2010-05-07 Marek Habersack <mhabersack@novell.com>
* Makefile.am (lang-data, locale-data): updated URLs for the icu
tarballs - they now live on go-mono.com
2010-02-24 Atsushi Enomoto <atsushi@ximian.com>
* supp/ns_BE.xml : add number format. Fixed bug #324019.
2010-01-06 Atsushi Enomoto <atsushi@ximian.com>
* Driver.cs : support FirstDayOfWeek. Fixed bug #567944.
Patch by Jose Antonio Sanchez Lazaro.
2009-12-18 Dimitar Dobrev <dpldobrev@yahoo.com>
* langs/ka.xml: added a file with the settings of the neutral
Georgian culture
* locales/ka-GE.xml: added a file with the settings of the
specific Georgian culture
* supp/ka-GE.xml: added a file with the date and time formats
of the Georgian culture
* lcids.xml: added entries for the neutral and specific
Georgian culture
* Makefile.am: included supp/ka-GE.xml in the build and dist the new
we're not downloading from primates.ximian.com.
[Fixes bug 564910].
2009-11-05 Rolf Bjarne Kvinge <RKvinge@novell.com>
* Driver.cs: Generate locale data for neutral cultures too. Moonlight
requires it.
2009-05-20 Atsushi Enomoto <atsushi@ximian.com>
* README: added (I needed it!)
2009-03-05 Marek Habersack <mhabersack@novell.com>
* locales/en_TT.xml: added here since openi18n.org times out and
also I can't update icu_locales.tar.gz. File based on en_ZA.xml
from that tarball, with appropriate modifications.
* Makefile.am (supp_data_files): added supp/en_TT.xml
2007-11-03 Atsushi Enomoto <atsushi@ximian.com>
* DateTimeFormatEntry.cs, Driver.cs : adjust the count of
MonthNames and AbbreviatedMonthNames entries to 13.
Fixed bug #332553.
2007-10-30 Atsushi Enomoto <atsushi@ximian.com>
* Driver.cs, DateTimeFormatEntry.cs : since FullDateTimePattern
should be computed on the overriden Long[Date/Time]Pattern, compute
it later than reading all format resources (langs/locales/supp).
2007-08-21 Atsushi Enomoto <atsushi@ximian.com>
* Driver.cs : for Euskara culture (eu_ES) do not trim dd which is
laid after 'ren' in the long format.
2007-05-15 Atsushi Enomoto <atsushi@ximian.com>
* CultureInfoEntry.cs : output Territory, which is used for RegionInfo.
* RegionInfoEntry.cs : added dummy int which is a slot for LCID.
2007-04-25 Atsushi Enomoto <atsushi@ximian.com>
* Driver.cs : use invariant culture to sort culture names.
Fixed bug #81150, patch by Changwoo Ryu.
2007-04-17 Atsushi Enomoto <atsushi@ximian.com>
* Driver.cs : in some cultures month/year and day/month could be in
reverse order, so don't assume month before year and day before
month. Made the "hack" code more practical.
2006-04-10 Atsushi Enomoto <atsushi@ximian.com>
* langs/nn.xml, locales/nn_NO.xml, Driver.cs :
Did the same for nn-NO.
2006-03-29 Atsushi Enomoto <atsushi@ximian.com>
* langs/nb.xml
locales/nb_NO.xml : imported from CLDR 1.3 data. (I know I'm
directly adding them here, since there seems no simple way to
add them as data in "supp" dir).
* Driver.cs :
Reuse XPathDocument for lcids.xml.
For "nb-NO" we need tricky code since its parent culture is "no"
(not "nb"), while some properties seems based on "nb".
Maybe we need some fundamental fixes to consider lcids.xml for
parent-child relationship, but right now, it's mostly fruitless.
2005-08-17 Atsushi Enomoto <atsushi@ximian.com>
* Driver.cs : add primary date/time pattern strings as the first
entry of for each "whole specific patterns".
(e.g. LongDatePatterns[0] should be LongDatePattern.)
2005-08-17 Atsushi Enomoto <atsushi@ximian.com>
* CultureInfoEntry.cs : added RegionId.
* Driver.cs : modified to not write RegionLCIDMap and use
CultureInfoEntry for that lookup purpose instead.
2005-08-15 Atsushi Enomoto <atsushi@ximian.com>
* RegionInfoEntry.cs,
Driver.cs,
Makefile.am : added RegionInfo table output support.
2005-08-11 Atsushi Enomoto <atsushi@ximian.com>
* regions.xml : ugh, it does not match something .net returns, so
remove it.
2005-08-11 Atsushi Enomoto <atsushi@ximian.com>
* regions.xml : new file. All region IDs from existing RegionInfo.cs.
2005-07-07 Atsushi Enomoto <atsushi@ximian.com>
* Driver.cs : Fixed bug #75499. There were hy_AM.xml and
hy_AM_REVISED.xml files in the locale builder archive.
2005-06-27 Atsushi Enomoto <atsushi@ximian.com>
* Driver.cs : basic pattern string should be added to extra pattern
array. This fixes bug #75353.
2005-05-19 Atsushi Enomoto <atsushi@ximian.com>
* Driver.cs, CultureInfoEntry.cs : Use hacky shallow copy to clone
zh-CHS into zh-CHT.
2005-05-18 Atsushi Enomoto <atsushi@ximian.com>
* Driver.cs : quick workaround for zh-CHT related breakage.
2005-05-12 Atsushi Enomoto <atsushi@ximian.com>
* Entry.cs :
build fix. Incorrectly allowed access to protected member.
* CultureInfoEntry.cs,
Driver.cs :
Handle language "zh-CHS" as special case, since there is no "zh".
* Makefile :
use -debug+ instead of -g (convenient when verifying with csc).
2005-02-17 Atsushi Enomoto <atsushi@ximian.com>
* Driver.cs : set \n for writer's NewLine explicitly (otherwise it
results in mixed line ending in culture-info-table.h).
2004-12-13 Ben Maurer <bmaurer@ximian.com>
* CultureInfoEntry.cs (AppendTableRow): Stringify the
textinfoentry
* TextInfoEntry.cs: New file for textinfo data
* textinfo.xml: textinfo data
* Driver.cs: Harness all the stuff above
* Makefile.am: add new files
Mon Aug 9 13:24:09 CEST 2004 Paolo Molaro <lupus@ximian.com>
* Driver.cs, Entry.cs, CultureInfoEntry.cs, DateTimeFormatEntry.cs,
NumberFormatEntry.cs: create a more compact representation of the
data.
2004-06-09 Gonzalo Paniagua Javier <gonzalo@ximian.com>
* Driver.cs: handle single quotes in the pattern. We used to fail for,
at least, es and pt cultures with full patterns like
"EEEE d' de 'MMMM' de 'yyyy".
2004-06-08 Atsushi Enomoto <atsushi@ximian.com>
* Driver.cs : To make "extra pattern only" xxxFormatLength possible,
fill values only when the exact element was available.
2004-06-08 Atsushi Enomoto <atsushi@ximian.com>
* DateTimeFormatEntry.cs : Use "{0}" for empty array.
2004-06-08 Atsushi Enomoto <atsushi@ximian.com>
* DateTimeFormatEntry.cs : Added "all datetime patterns" support.
* Driver.cs : Added "all datetime patterns" support and fixed some
XPathNavigator use to strictly navigate to "pattern" element.
2004-06-05 Atsushi Enomoto <atsushi@ximian.com>
* Driver.cs : Percent patterns are not properly parsed since they are
in fact not separated by '.'
* Entry.cs : Escape '\' to "\\" (for Japanese yen-sign fix).
2004-06-05 Atsushi Enomoto <atsushi@ximian.com>
* Driver.cs :
- NumberDecimalDigits are almost differently specified by locale
xml files. Almost all of them have ".###", but we need ".##" in
almost all the locale. So let's *assume* that the number of
digit is always +1 extraneous by this Driver itself.
This change accompanies with some existing supp/*.xml changes.
- For decimal patterns and currency patterns, when numeric patterns
does not have ';'-separated patterns, it ignored the whole pattern
string. Fixed it by just copying the same patterns.
- When parsing percent patterns, '%' characters were in the way.
- When the decimal part of the percent pattern ends with ".##0",
the value of PercentDecimalDigits is 2.
- Assume PercentDecimalDigits as 2 by default.
2004-06-05 Atsushi Enomoto <atsushi@ximian.com>
* Driver.cs : Let's ignore DTD that takes most of the running time.
2004-06-03 Atsushi Enomoto <atsushi@ximian.com>
* Driver.cs : {3} is the almost default number for group digits.
2004-05-26 Atsushi Enomoto <atsushi@ximian.com>
* Driver.cs : for af_ZA locale, am/pm part got required to support
"empty" string. So check am/pm elements and overwrite AMDesigner/
PMDesigner value even if they consist of empty string.
* (moved logs for supp/ content to supp/)
2004-05-25 Jackson Harper <jackson@ximian.com>
* Makefile.am: Extract xml files.
2004-05-24 Jackson Harper <jackson@ximian.com>
* Driver.cs: Filter on GetFiles so we only get the xml locale files.

View File

@@ -379,9 +379,13 @@ namespace Mono.Tools.LocaleBuilder
throw new NotImplementedException ();
}
var territories = entry.Attributes["territories"].Value.Split ();
var territories = entry.Attributes["territories"].Value.Split (new [] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries);
foreach (var t in territories) {
territory2dayofweek.Add (t, dow);
var tr = t.Trim ();
if (tr.Length == 0)
continue;
territory2dayofweek.Add (tr, dow);
}
}
@@ -619,27 +623,6 @@ namespace Mono.Tools.LocaleBuilder
break;
}
}
if (nfe.CurrencyDecimalDigits == null) {
var all_digits = new List<string> ();
GetAllChildrenValues (ci, all_digits, l => l.NumberFormatEntry.CurrencyDecimalDigits);
var children = all_digits.Where (l => l != null).Distinct ().ToList ();
if (children.Count == 1) {
nfe.CurrencyDecimalDigits = children[0];
} else if (children.Count == 0) {
if (!ci.HasMissingLocale)
Console.WriteLine ("No currency decimal digits data for `{0}'", ci.Name);
nfe.CurrencyDecimalDigits = "2";
} else if (ci.IsNeutral) {
nfe.CurrencyDecimalDigits = "2";
} else {
// .NET has weird concept of territory data available for neutral cultures (e.g. en, es, pt)
// We have to manually disambiguate the correct entry (which is artofficial anyway)
throw new ApplicationException (string.Format ("Ambiguous currency decimal digits data for `{0}'", ci.Name));
}
}
}
if (OutputCompare)
@@ -1164,30 +1147,6 @@ namespace Mono.Tools.LocaleBuilder
ni.PercentSymbol = el.InnerText;
}
string value = null;
// .net has incorrect separators for some countries and we want to be compatible
switch (ci.Name) {
case "es-ES":
case "es":
// es-ES does not have group separator but .net has '.'
value = ".";
break;
default:
if (node != null) {
el = node.SelectSingleNode ("group");
if (el != null) {
value = el.InnerText;
}
}
break;
}
if (value != null) {
ni.NumberGroupSeparator = ni.CurrencyGroupSeparator = value;
}
}
static void ToLower (string[] values)

View File

@@ -80,7 +80,7 @@ host_triplet = @host@
target_triplet = @target@
subdir = tools/locale-builder
DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
$(top_srcdir)/mkinstalldirs ChangeLog README
$(top_srcdir)/mkinstalldirs README
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/iconv.m4 \
$(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
@@ -211,8 +211,6 @@ NM = @NM@
NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
OPROFILE_CFLAGS = @OPROFILE_CFLAGS@
OPROFILE_LIBS = @OPROFILE_LIBS@
OTOOL = @OTOOL@
OTOOL64 = @OTOOL64@
PACKAGE = @PACKAGE@

View File

@@ -1 +1 @@
7127286033736426a6427b3c01db2e6f7bc69a2b
793c5f7579df20f29b2f83cbb8d3ab76a9069588

View File

@@ -1,115 +0,0 @@
Wed Feb 24 15:56:52 CET 2010 Paolo Molaro <lupus@ximian.com>
* Makefile.am, monograph.c: update to the new API/ABI.
2009-08-18 Christian Hergert <chris@dronelabs.com>
* monograph.c: Fix printf warnings.
Mon Sep 10 15:03:06 CEST 2007 Paolo Molaro <lupus@ximian.com>
* monograph.c: added --size option to collect size statistics
per-type (best used with a pipe to sort -n -k3).
2007-03-13 Jonathan Chambers <joncham@gmail.com>
* monograph.vcproj: Move to msvc directory.
2007-03-13 Jonathan Chambers <joncham@gmail.com>
* monograph.vcproj: Begin WIN64 port.
Fri Jan 26 12:37:14 CET 2007 Paolo Molaro <lupus@ximian.com>
* monograph.c: warning fixes.
Tue Mar 21 16:01:26 CET 2006 Paolo Molaro <lupus@ximian.com>
* monograph.c: fixes to be able to deal with 2.0 assemblies
and more stats.
Wed Feb 22 15:11:37 CET 2006 Paolo Molaro <lupus@ximian.com>
* monograph.c: update after MonoMethodHeader changes.
Tue Jan 24 18:57:46 CET 2006 Paolo Molaro <lupus@ximian.com>
* monograph.c: misc fixes and parent depth stats.
2005-05-26 Sebastien Pouliot <sebastien@ximian.com>
* monograph.vcproj: Project file for monograph.
2005-03-29 Sebastien Pouliot <sebastien@ximian.com>
* monograph.c: Add mono-compiler.h header to allow/ease compilation
with non-GCC compilers. Fix default loading of mscorlib.dll.
2005-02-09 Ben Maurer <bmaurer@ximian.com>
* monograph.c (print_method): Don't use method->info, as this will
be removed soon.
2005-02-03 Zoltan Varga <vargaz@freemail.hu>
* monograph.c: Fix warnings.
Mon May 24 13:36:53 CEST 2004 Paolo Molaro <lupus@ximian.com>
* monograph.c: default assembly name is "mscorlib" now.
2003-11-12 Jackson Harper <jackson@ximian.com>
* monograph.c: Change default assembly name to mscorlib.dll
Thu Feb 6 02:43:23 PST 2003 Piers Haken <piersh@friskit.com>
* monograph.c: more warning cleanups
Tue Jan 28 18:53:08 CET 2003 Paolo Molaro <lupus@ximian.com>
* monograph.c: more stats added.
Mon Oct 7 12:25:15 CEST 2002 Paolo Molaro <lupus@ximian.com>
* monograph.c: added a --stats command line option to gather
statistics about the assembly code.
2002-08-28 Dick Porter <dick@ximian.com>
* Makefile.am: Export HOST_CC for w32 builds
Fri Jul 19 14:23:46 CEST 2002 Paolo Molaro <lupus@ximian.com>
* monograph.c: simple stats on opcode size.
Thu Mar 28 15:18:50 CET 2002 Paolo Molaro <lupus@ximian.com>
* monograph.c: some warning cleanups.
Mon Mar 11 11:58:27 CET 2002 Paolo Molaro <lupus@ximian.com>
* monograph.c: update --help output, Make error messages less
intimidating and more informative.
Mon Mar 11 11:16:53 CET 2002 Paolo Molaro <lupus@ximian.com>
* monograph.c: removed method signature and searching helpers
that are now provided in libmetadata. Added --control-flow option to
create a control flow graph of a method, with basic blocks etc.
Wed Feb 20 17:53:59 CET 2002 Paolo Molaro <lupus@ximian.com>
* monograph.c: added -i option to create a graph of the types
implementing an interface.
Tue Feb 19 12:24:15 CET 2002 Paolo Molaro <lupus@ximian.com>
* monograph.c: fix typo. Update for changes in mono_init ().
Mon Feb 18 14:37:17 CET 2002 Paolo Molaro <lupus@ximian.com>
* monograph.c: First commit: program to generate call graphs
or type hierarchies from CIL programs.

View File

@@ -56,5 +56,4 @@ graphs: $(OUT)
./monograph -n -o $*.png corlib.dll $*
convert -geometry '480x360>' $*.png $*.jpeg
EXTRA_DIST = ChangeLog

View File

@@ -82,7 +82,7 @@ target_triplet = @target@
@DISABLE_EXECUTABLES_FALSE@@DISABLE_LIBRARIES_FALSE@@SUPPORT_BOEHM_TRUE@bin_PROGRAMS = monograph$(EXEEXT)
subdir = tools/monograph
DIST_COMMON = $(srcdir)/Makefile.in $(srcdir)/Makefile.am \
$(top_srcdir)/mkinstalldirs $(top_srcdir)/depcomp ChangeLog
$(top_srcdir)/mkinstalldirs $(top_srcdir)/depcomp
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/m4/iconv.m4 \
$(top_srcdir)/m4/lib-ld.m4 $(top_srcdir)/m4/lib-link.m4 \
@@ -274,8 +274,6 @@ NM = @NM@
NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
OPROFILE_CFLAGS = @OPROFILE_CFLAGS@
OPROFILE_LIBS = @OPROFILE_LIBS@
OTOOL = @OTOOL@
OTOOL64 = @OTOOL64@
PACKAGE = @PACKAGE@
@@ -408,7 +406,6 @@ monograph_LDADD = \
@PLATFORM_DARWIN_TRUE@monograph_LDFLAGS = -framework CoreFoundation
GRAPHS = System.Object System.Enum System.Attribute System.ValueType System.Reflection.MemberInfo
OUT = $(GRAPHS:=.jpeg)
EXTRA_DIST = ChangeLog
all: all-am
.SUFFIXES:

View File

@@ -2,8 +2,17 @@ bin_PROGRAMS = sgen-grep-binprot
AM_CPPFLAGS = $(GLIB_CFLAGS) -I$(top_srcdir)
noinst_LIBRARIES = libsgen-grep-binprot.a libsgen-grep-binprot32p.a libsgen-grep-binprot64p.a
libsgen_grep_binprot_a_SOURCES = sgen-grep-binprot.c
libsgen_grep_binprot_a_CPPFLAGS = $(GLIB_CFLAGS) -I$(top_srcdir)
libsgen_grep_binprot32p_a_SOURCES = sgen-grep-binprot.c
libsgen_grep_binprot32p_a_CPPFLAGS = $(GLIB_CFLAGS) -I$(top_srcdir) -DBINPROT_SIZEOF_VOID_P=4 -DBINPROT_HAS_HEADER
libsgen_grep_binprot64p_a_SOURCES = sgen-grep-binprot.c
libsgen_grep_binprot64p_a_CPPFLAGS = $(GLIB_CFLAGS) -I$(top_srcdir) -DBINPROT_SIZEOF_VOID_P=8 -DBINPROT_HAS_HEADER
sgen_grep_binprot_SOURCES = \
sgen-grep-binprot.c
sgen-grep-binprot-main.c \
sgen-entry-stream.c
sgen_grep_binprot_LDADD = \
$(GLIB_LIBS) $(LIBICONV)
$(GLIB_LIBS) $(LIBICONV) libsgen-grep-binprot.a libsgen-grep-binprot32p.a libsgen-grep-binprot64p.a

View File

@@ -14,6 +14,7 @@
@SET_MAKE@
VPATH = @srcdir@
am__is_gnu_make = test -n '$(MAKEFILE_LIST)' && test -n '$(MAKELEVEL)'
am__make_running_with_option = \
@@ -98,13 +99,38 @@ mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
LIBRARIES = $(noinst_LIBRARIES)
ARFLAGS = cru
AM_V_AR = $(am__v_AR_@AM_V@)
am__v_AR_ = $(am__v_AR_@AM_DEFAULT_V@)
am__v_AR_0 = @echo " AR " $@;
am__v_AR_1 =
libsgen_grep_binprot_a_AR = $(AR) $(ARFLAGS)
libsgen_grep_binprot_a_LIBADD =
am_libsgen_grep_binprot_a_OBJECTS = \
libsgen_grep_binprot_a-sgen-grep-binprot.$(OBJEXT)
libsgen_grep_binprot_a_OBJECTS = $(am_libsgen_grep_binprot_a_OBJECTS)
libsgen_grep_binprot32p_a_AR = $(AR) $(ARFLAGS)
libsgen_grep_binprot32p_a_LIBADD =
am_libsgen_grep_binprot32p_a_OBJECTS = \
libsgen_grep_binprot32p_a-sgen-grep-binprot.$(OBJEXT)
libsgen_grep_binprot32p_a_OBJECTS = \
$(am_libsgen_grep_binprot32p_a_OBJECTS)
libsgen_grep_binprot64p_a_AR = $(AR) $(ARFLAGS)
libsgen_grep_binprot64p_a_LIBADD =
am_libsgen_grep_binprot64p_a_OBJECTS = \
libsgen_grep_binprot64p_a-sgen-grep-binprot.$(OBJEXT)
libsgen_grep_binprot64p_a_OBJECTS = \
$(am_libsgen_grep_binprot64p_a_OBJECTS)
am__installdirs = "$(DESTDIR)$(bindir)"
PROGRAMS = $(bin_PROGRAMS)
am_sgen_grep_binprot_OBJECTS = sgen-grep-binprot.$(OBJEXT)
am_sgen_grep_binprot_OBJECTS = sgen-grep-binprot-main.$(OBJEXT) \
sgen-entry-stream.$(OBJEXT)
sgen_grep_binprot_OBJECTS = $(am_sgen_grep_binprot_OBJECTS)
am__DEPENDENCIES_1 =
sgen_grep_binprot_DEPENDENCIES = $(am__DEPENDENCIES_1) \
$(am__DEPENDENCIES_1)
$(am__DEPENDENCIES_1) libsgen-grep-binprot.a \
libsgen-grep-binprot32p.a libsgen-grep-binprot64p.a
AM_V_lt = $(am__v_lt_@AM_V@)
am__v_lt_ = $(am__v_lt_@AM_DEFAULT_V@)
am__v_lt_0 = --silent
@@ -139,8 +165,14 @@ AM_V_CCLD = $(am__v_CCLD_@AM_V@)
am__v_CCLD_ = $(am__v_CCLD_@AM_DEFAULT_V@)
am__v_CCLD_0 = @echo " CCLD " $@;
am__v_CCLD_1 =
SOURCES = $(sgen_grep_binprot_SOURCES)
DIST_SOURCES = $(sgen_grep_binprot_SOURCES)
SOURCES = $(libsgen_grep_binprot_a_SOURCES) \
$(libsgen_grep_binprot32p_a_SOURCES) \
$(libsgen_grep_binprot64p_a_SOURCES) \
$(sgen_grep_binprot_SOURCES)
DIST_SOURCES = $(libsgen_grep_binprot_a_SOURCES) \
$(libsgen_grep_binprot32p_a_SOURCES) \
$(libsgen_grep_binprot64p_a_SOURCES) \
$(sgen_grep_binprot_SOURCES)
am__can_run_installinfo = \
case $$AM_UPDATE_INFO_DIR in \
n|no|NO) false;; \
@@ -260,8 +292,6 @@ NM = @NM@
NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
OPROFILE_CFLAGS = @OPROFILE_CFLAGS@
OPROFILE_LIBS = @OPROFILE_LIBS@
OTOOL = @OTOOL@
OTOOL64 = @OTOOL64@
PACKAGE = @PACKAGE@
@@ -371,11 +401,19 @@ top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
AM_CPPFLAGS = $(GLIB_CFLAGS) -I$(top_srcdir)
noinst_LIBRARIES = libsgen-grep-binprot.a libsgen-grep-binprot32p.a libsgen-grep-binprot64p.a
libsgen_grep_binprot_a_SOURCES = sgen-grep-binprot.c
libsgen_grep_binprot_a_CPPFLAGS = $(GLIB_CFLAGS) -I$(top_srcdir)
libsgen_grep_binprot32p_a_SOURCES = sgen-grep-binprot.c
libsgen_grep_binprot32p_a_CPPFLAGS = $(GLIB_CFLAGS) -I$(top_srcdir) -DBINPROT_SIZEOF_VOID_P=4 -DBINPROT_HAS_HEADER
libsgen_grep_binprot64p_a_SOURCES = sgen-grep-binprot.c
libsgen_grep_binprot64p_a_CPPFLAGS = $(GLIB_CFLAGS) -I$(top_srcdir) -DBINPROT_SIZEOF_VOID_P=8 -DBINPROT_HAS_HEADER
sgen_grep_binprot_SOURCES = \
sgen-grep-binprot.c
sgen-grep-binprot-main.c \
sgen-entry-stream.c
sgen_grep_binprot_LDADD = \
$(GLIB_LIBS) $(LIBICONV)
$(GLIB_LIBS) $(LIBICONV) libsgen-grep-binprot.a libsgen-grep-binprot32p.a libsgen-grep-binprot64p.a
all: all-am
@@ -411,6 +449,24 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(am__aclocal_m4_deps):
clean-noinstLIBRARIES:
-test -z "$(noinst_LIBRARIES)" || rm -f $(noinst_LIBRARIES)
libsgen-grep-binprot.a: $(libsgen_grep_binprot_a_OBJECTS) $(libsgen_grep_binprot_a_DEPENDENCIES) $(EXTRA_libsgen_grep_binprot_a_DEPENDENCIES)
$(AM_V_at)-rm -f libsgen-grep-binprot.a
$(AM_V_AR)$(libsgen_grep_binprot_a_AR) libsgen-grep-binprot.a $(libsgen_grep_binprot_a_OBJECTS) $(libsgen_grep_binprot_a_LIBADD)
$(AM_V_at)$(RANLIB) libsgen-grep-binprot.a
libsgen-grep-binprot32p.a: $(libsgen_grep_binprot32p_a_OBJECTS) $(libsgen_grep_binprot32p_a_DEPENDENCIES) $(EXTRA_libsgen_grep_binprot32p_a_DEPENDENCIES)
$(AM_V_at)-rm -f libsgen-grep-binprot32p.a
$(AM_V_AR)$(libsgen_grep_binprot32p_a_AR) libsgen-grep-binprot32p.a $(libsgen_grep_binprot32p_a_OBJECTS) $(libsgen_grep_binprot32p_a_LIBADD)
$(AM_V_at)$(RANLIB) libsgen-grep-binprot32p.a
libsgen-grep-binprot64p.a: $(libsgen_grep_binprot64p_a_OBJECTS) $(libsgen_grep_binprot64p_a_DEPENDENCIES) $(EXTRA_libsgen_grep_binprot64p_a_DEPENDENCIES)
$(AM_V_at)-rm -f libsgen-grep-binprot64p.a
$(AM_V_AR)$(libsgen_grep_binprot64p_a_AR) libsgen-grep-binprot64p.a $(libsgen_grep_binprot64p_a_OBJECTS) $(libsgen_grep_binprot64p_a_LIBADD)
$(AM_V_at)$(RANLIB) libsgen-grep-binprot64p.a
install-binPROGRAMS: $(bin_PROGRAMS)
@$(NORMAL_INSTALL)
@list='$(bin_PROGRAMS)'; test -n "$(bindir)" || list=; \
@@ -471,7 +527,11 @@ mostlyclean-compile:
distclean-compile:
-rm -f *.tab.c
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sgen-grep-binprot.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsgen_grep_binprot32p_a-sgen-grep-binprot.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsgen_grep_binprot64p_a-sgen-grep-binprot.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/libsgen_grep_binprot_a-sgen-grep-binprot.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sgen-entry-stream.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/sgen-grep-binprot-main.Po@am__quote@
.c.o:
@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\
@@ -497,6 +557,48 @@ distclean-compile:
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(LTCOMPILE) -c -o $@ $<
libsgen_grep_binprot_a-sgen-grep-binprot.o: sgen-grep-binprot.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsgen_grep_binprot_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libsgen_grep_binprot_a-sgen-grep-binprot.o -MD -MP -MF $(DEPDIR)/libsgen_grep_binprot_a-sgen-grep-binprot.Tpo -c -o libsgen_grep_binprot_a-sgen-grep-binprot.o `test -f 'sgen-grep-binprot.c' || echo '$(srcdir)/'`sgen-grep-binprot.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsgen_grep_binprot_a-sgen-grep-binprot.Tpo $(DEPDIR)/libsgen_grep_binprot_a-sgen-grep-binprot.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='sgen-grep-binprot.c' object='libsgen_grep_binprot_a-sgen-grep-binprot.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsgen_grep_binprot_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libsgen_grep_binprot_a-sgen-grep-binprot.o `test -f 'sgen-grep-binprot.c' || echo '$(srcdir)/'`sgen-grep-binprot.c
libsgen_grep_binprot_a-sgen-grep-binprot.obj: sgen-grep-binprot.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsgen_grep_binprot_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libsgen_grep_binprot_a-sgen-grep-binprot.obj -MD -MP -MF $(DEPDIR)/libsgen_grep_binprot_a-sgen-grep-binprot.Tpo -c -o libsgen_grep_binprot_a-sgen-grep-binprot.obj `if test -f 'sgen-grep-binprot.c'; then $(CYGPATH_W) 'sgen-grep-binprot.c'; else $(CYGPATH_W) '$(srcdir)/sgen-grep-binprot.c'; fi`
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsgen_grep_binprot_a-sgen-grep-binprot.Tpo $(DEPDIR)/libsgen_grep_binprot_a-sgen-grep-binprot.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='sgen-grep-binprot.c' object='libsgen_grep_binprot_a-sgen-grep-binprot.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsgen_grep_binprot_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libsgen_grep_binprot_a-sgen-grep-binprot.obj `if test -f 'sgen-grep-binprot.c'; then $(CYGPATH_W) 'sgen-grep-binprot.c'; else $(CYGPATH_W) '$(srcdir)/sgen-grep-binprot.c'; fi`
libsgen_grep_binprot32p_a-sgen-grep-binprot.o: sgen-grep-binprot.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsgen_grep_binprot32p_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libsgen_grep_binprot32p_a-sgen-grep-binprot.o -MD -MP -MF $(DEPDIR)/libsgen_grep_binprot32p_a-sgen-grep-binprot.Tpo -c -o libsgen_grep_binprot32p_a-sgen-grep-binprot.o `test -f 'sgen-grep-binprot.c' || echo '$(srcdir)/'`sgen-grep-binprot.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsgen_grep_binprot32p_a-sgen-grep-binprot.Tpo $(DEPDIR)/libsgen_grep_binprot32p_a-sgen-grep-binprot.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='sgen-grep-binprot.c' object='libsgen_grep_binprot32p_a-sgen-grep-binprot.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsgen_grep_binprot32p_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libsgen_grep_binprot32p_a-sgen-grep-binprot.o `test -f 'sgen-grep-binprot.c' || echo '$(srcdir)/'`sgen-grep-binprot.c
libsgen_grep_binprot32p_a-sgen-grep-binprot.obj: sgen-grep-binprot.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsgen_grep_binprot32p_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libsgen_grep_binprot32p_a-sgen-grep-binprot.obj -MD -MP -MF $(DEPDIR)/libsgen_grep_binprot32p_a-sgen-grep-binprot.Tpo -c -o libsgen_grep_binprot32p_a-sgen-grep-binprot.obj `if test -f 'sgen-grep-binprot.c'; then $(CYGPATH_W) 'sgen-grep-binprot.c'; else $(CYGPATH_W) '$(srcdir)/sgen-grep-binprot.c'; fi`
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsgen_grep_binprot32p_a-sgen-grep-binprot.Tpo $(DEPDIR)/libsgen_grep_binprot32p_a-sgen-grep-binprot.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='sgen-grep-binprot.c' object='libsgen_grep_binprot32p_a-sgen-grep-binprot.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsgen_grep_binprot32p_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libsgen_grep_binprot32p_a-sgen-grep-binprot.obj `if test -f 'sgen-grep-binprot.c'; then $(CYGPATH_W) 'sgen-grep-binprot.c'; else $(CYGPATH_W) '$(srcdir)/sgen-grep-binprot.c'; fi`
libsgen_grep_binprot64p_a-sgen-grep-binprot.o: sgen-grep-binprot.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsgen_grep_binprot64p_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libsgen_grep_binprot64p_a-sgen-grep-binprot.o -MD -MP -MF $(DEPDIR)/libsgen_grep_binprot64p_a-sgen-grep-binprot.Tpo -c -o libsgen_grep_binprot64p_a-sgen-grep-binprot.o `test -f 'sgen-grep-binprot.c' || echo '$(srcdir)/'`sgen-grep-binprot.c
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsgen_grep_binprot64p_a-sgen-grep-binprot.Tpo $(DEPDIR)/libsgen_grep_binprot64p_a-sgen-grep-binprot.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='sgen-grep-binprot.c' object='libsgen_grep_binprot64p_a-sgen-grep-binprot.o' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsgen_grep_binprot64p_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libsgen_grep_binprot64p_a-sgen-grep-binprot.o `test -f 'sgen-grep-binprot.c' || echo '$(srcdir)/'`sgen-grep-binprot.c
libsgen_grep_binprot64p_a-sgen-grep-binprot.obj: sgen-grep-binprot.c
@am__fastdepCC_TRUE@ $(AM_V_CC)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsgen_grep_binprot64p_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT libsgen_grep_binprot64p_a-sgen-grep-binprot.obj -MD -MP -MF $(DEPDIR)/libsgen_grep_binprot64p_a-sgen-grep-binprot.Tpo -c -o libsgen_grep_binprot64p_a-sgen-grep-binprot.obj `if test -f 'sgen-grep-binprot.c'; then $(CYGPATH_W) 'sgen-grep-binprot.c'; else $(CYGPATH_W) '$(srcdir)/sgen-grep-binprot.c'; fi`
@am__fastdepCC_TRUE@ $(AM_V_at)$(am__mv) $(DEPDIR)/libsgen_grep_binprot64p_a-sgen-grep-binprot.Tpo $(DEPDIR)/libsgen_grep_binprot64p_a-sgen-grep-binprot.Po
@AMDEP_TRUE@@am__fastdepCC_FALSE@ $(AM_V_CC)source='sgen-grep-binprot.c' object='libsgen_grep_binprot64p_a-sgen-grep-binprot.obj' libtool=no @AMDEPBACKSLASH@
@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
@am__fastdepCC_FALSE@ $(AM_V_CC@am__nodep@)$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libsgen_grep_binprot64p_a_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o libsgen_grep_binprot64p_a-sgen-grep-binprot.obj `if test -f 'sgen-grep-binprot.c'; then $(CYGPATH_W) 'sgen-grep-binprot.c'; else $(CYGPATH_W) '$(srcdir)/sgen-grep-binprot.c'; fi`
mostlyclean-libtool:
-rm -f *.lo
@@ -587,7 +689,7 @@ distdir: $(DISTFILES)
done
check-am: all-am
check: check-am
all-am: Makefile $(PROGRAMS)
all-am: Makefile $(LIBRARIES) $(PROGRAMS)
installdirs:
for dir in "$(DESTDIR)$(bindir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
@@ -624,7 +726,8 @@ maintainer-clean-generic:
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
clean-am: clean-binPROGRAMS clean-generic clean-libtool mostlyclean-am
clean-am: clean-binPROGRAMS clean-generic clean-libtool \
clean-noinstLIBRARIES mostlyclean-am
distclean: distclean-am
-rm -rf ./$(DEPDIR)
@@ -695,15 +798,16 @@ uninstall-am: uninstall-binPROGRAMS
.MAKE: install-am install-strip
.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean \
clean-binPROGRAMS clean-generic clean-libtool cscopelist-am \
ctags ctags-am distclean distclean-compile distclean-generic \
distclean-libtool distclean-tags distdir dvi dvi-am html \
html-am info info-am install install-am install-binPROGRAMS \
install-data install-data-am install-dvi install-dvi-am \
install-exec install-exec-am install-html install-html-am \
install-info install-info-am install-man install-pdf \
install-pdf-am install-ps install-ps-am install-strip \
installcheck installcheck-am installdirs maintainer-clean \
clean-binPROGRAMS clean-generic clean-libtool \
clean-noinstLIBRARIES cscopelist-am ctags ctags-am distclean \
distclean-compile distclean-generic distclean-libtool \
distclean-tags distdir dvi dvi-am html html-am info info-am \
install install-am install-binPROGRAMS install-data \
install-data-am install-dvi install-dvi-am install-exec \
install-exec-am install-html install-html-am install-info \
install-info-am install-man install-pdf install-pdf-am \
install-ps install-ps-am install-strip installcheck \
installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-compile \
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
tags tags-am uninstall uninstall-am uninstall-binPROGRAMS

View File

@@ -0,0 +1,67 @@
/*
* sgen-entry-stream.c: EntryStream implementation
*
* Copyright (C) 2016 Xamarin Inc
*
* Licensed under the MIT license. See LICENSE file in the project root for full license information.
*/
#include <stdlib.h>
#include <unistd.h>
#include <glib.h>
#include "sgen-entry-stream.h"
#define BUFFER_SIZE (1 << 20)
void
init_stream (EntryStream *stream, int file)
{
stream->file = file;
stream->buffer = g_malloc0 (BUFFER_SIZE);
stream->end = stream->buffer + BUFFER_SIZE;
stream->pos = stream->end;
}
void
reset_stream (EntryStream *stream)
{
stream->end = stream->buffer + BUFFER_SIZE;
stream->pos = stream->end;
lseek (stream->file, 0, SEEK_SET);
}
void
close_stream (EntryStream *stream)
{
g_free (stream->buffer);
}
gboolean
refill_stream (EntryStream *in, size_t size)
{
size_t remainder = in->end - in->pos;
ssize_t refilled;
g_assert (size > 0);
g_assert (in->pos >= in->buffer);
if (in->pos + size <= in->end)
return TRUE;
memmove (in->buffer, in->pos, remainder);
in->pos = in->buffer;
refilled = read (in->file, in->buffer + remainder, BUFFER_SIZE - remainder);
if (refilled < 0)
return FALSE;
g_assert (refilled + remainder <= BUFFER_SIZE);
in->end = in->buffer + refilled + remainder;
return in->end - in->buffer >= size;
}
ssize_t
read_stream (EntryStream *stream, void *out, size_t size)
{
if (refill_stream (stream, size)) {
memcpy (out, stream->pos, size);
stream->pos += size;
return size;
}
return 0;
}

View File

@@ -0,0 +1,108 @@
/*
* sgen-grep-binprot-main.c: Binary protocol entries reader
*
* Copyright (C) 2016 Xamarin Inc
*
* Licensed under the MIT license. See LICENSE file in the project root for full license information.
*/
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <glib.h>
#include <unistd.h>
#include <fcntl.h>
#include "sgen-entry-stream.h"
#include "sgen-grep-binprot.h"
/* FIXME Add grepers for specific endianness */
GrepEntriesFunction grepers [] = {
sgen_binary_protocol_grep_entries32p, /* We have header, structures are packed, 32 bit word */
sgen_binary_protocol_grep_entries64p, /* We have header, structures are packed, 64 bit word */
sgen_binary_protocol_grep_entries /* No header, uses default word size and structure layout */
};
int
main (int argc, char *argv[])
{
int num_args = argc - 1;
int num_nums = 0;
int num_vtables = 0;
int i;
long nums [num_args];
long vtables [num_args];
gboolean dump_all = FALSE;
gboolean color_output = FALSE;
gboolean pause_times = FALSE;
const char *input_path = NULL;
int input_file;
EntryStream stream;
unsigned long long first_entry_to_consider = 0;
for (i = 0; i < num_args; ++i) {
char *arg = argv [i + 1];
char *next_arg = argv [i + 2];
if (!strcmp (arg, "--all")) {
dump_all = TRUE;
} else if (!strcmp (arg, "--pause-times")) {
pause_times = TRUE;
} else if (!strcmp (arg, "-v") || !strcmp (arg, "--vtable")) {
vtables [num_vtables++] = strtoul (next_arg, NULL, 16);
++i;
} else if (!strcmp (arg, "-s") || !strcmp (arg, "--start-at")) {
first_entry_to_consider = strtoull (next_arg, NULL, 10);
++i;
} else if (!strcmp (arg, "-c") || !strcmp (arg, "--color")) {
color_output = TRUE;
} else if (!strcmp (arg, "-i") || !strcmp (arg, "--input")) {
input_path = next_arg;
++i;
} else if (!strcmp (arg, "--help")) {
printf (
"\n"
"Usage:\n"
"\n"
"\tsgen-grep-binprot [options] [pointer...]\n"
"\n"
"Examples:\n"
"\n"
"\tsgen-grep-binprot --all </tmp/binprot\n"
"\tsgen-grep-binprot --input /tmp/binprot --color 0xdeadbeef\n"
"\n"
"Options:\n"
"\n"
"\t--all Print all entries.\n"
"\t--color, -c Highlight matches in color.\n"
"\t--help You're looking at it.\n"
"\t--input FILE, -i FILE Read input from FILE instead of standard input.\n"
"\t--pause-times Print GC pause times.\n"
"\t--start-at N, -s N Begin filtering at the Nth entry.\n"
"\t--vtable PTR, -v PTR Search for vtable pointer PTR.\n"
"\n");
return 0;
} else {
nums [num_nums++] = strtoul (arg, NULL, 16);
}
}
if (dump_all)
assert (!pause_times);
if (pause_times)
assert (!dump_all);
input_file = input_path ? open (input_path, O_RDONLY) : STDIN_FILENO;
init_stream (&stream, input_file);
for (i = 0; i < sizeof (grepers) / sizeof (GrepEntriesFunction); i++) {
if (grepers [i] (&stream, num_nums, nums, num_vtables, vtables, dump_all,
pause_times, color_output, first_entry_to_consider)) {
/* Success */
break;
}
reset_stream (&stream);
}
close_stream (&stream);
if (input_path)
close (input_file);
return 0;
}

View File

@@ -1,13 +1,52 @@
/*
* sgen-grep-binprot.c: Platform specific binary protocol entries reader
*
* Copyright (C) 2016 Xamarin Inc
*
* Licensed under the MIT license. See LICENSE file in the project root for full license information.
*/
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <glib.h>
#include <unistd.h>
#include <fcntl.h>
#include <stdint.h>
#include <inttypes.h>
#include <config.h>
#include "sgen-entry-stream.h"
#include "sgen-grep-binprot.h"
#define SGEN_BINARY_PROTOCOL
#define MONO_INTERNAL
#ifdef BINPROT_HAS_HEADER
#define PACKED_SUFFIX p
#else
#define PROTOCOL_STRUCT_ATTR
#define PACKED_SUFFIX
#endif
#ifndef BINPROT_SIZEOF_VOID_P
#define BINPROT_SIZEOF_VOID_P SIZEOF_VOID_P
#define ARCH_SUFFIX
#endif
#if BINPROT_SIZEOF_VOID_P == 4
typedef int32_t mword;
#define MWORD_FORMAT_SPEC_D PRId32
#define MWORD_FORMAT_SPEC_P PRIx32
#ifndef ARCH_SUFFIX
#define ARCH_SUFFIX 32
#endif
#else
typedef int64_t mword;
#define MWORD_FORMAT_SPEC_D PRId64
#define MWORD_FORMAT_SPEC_P PRIx64
#ifndef ARCH_SUFFIX
#define ARCH_SUFFIX 64
#endif
#endif
#define TYPE_SIZE mword
#define TYPE_POINTER mword
#include <mono/sgen/sgen-protocol.h>
#define SGEN_PROTOCOL_EOF 255
@@ -16,59 +55,6 @@
#define WORKER(t) ((t) & 0x80)
#define MAX_ENTRY_SIZE (1 << 10)
#define BUFFER_SIZE (1 << 20)
typedef struct {
int file;
char *buffer;
const char *end;
const char *pos;
} EntryStream;
static void
init_stream (EntryStream *stream, int file)
{
stream->file = file;
stream->buffer = g_malloc0 (BUFFER_SIZE);
stream->end = stream->buffer + BUFFER_SIZE;
stream->pos = stream->end;
}
static void
close_stream (EntryStream *stream)
{
g_free (stream->buffer);
}
static gboolean
refill_stream (EntryStream *in, size_t size)
{
size_t remainder = in->end - in->pos;
ssize_t refilled;
g_assert (size > 0);
g_assert (in->pos >= in->buffer);
if (in->pos + size <= in->end)
return TRUE;
memmove (in->buffer, in->pos, remainder);
in->pos = in->buffer;
refilled = read (in->file, in->buffer + remainder, BUFFER_SIZE - remainder);
if (refilled < 0)
return FALSE;
g_assert (refilled + remainder <= BUFFER_SIZE);
in->end = in->buffer + refilled + remainder;
return in->end - in->buffer >= size;
}
static ssize_t
read_stream (EntryStream *stream, void *out, size_t size)
{
if (refill_stream (stream, size)) {
memcpy (out, stream->pos, size);
stream->pos += size;
return size;
}
return 0;
}
static int
read_entry (EntryStream *stream, void *data)
@@ -224,10 +210,10 @@ print_entry_content (int entries_size, PrintEntry *entries, gboolean color_outpu
printf ("%lld", *(long long*) entries [i].data);
break;
case TYPE_SIZE:
printf ("%lu", *(size_t*) entries [i].data);
printf ("%"MWORD_FORMAT_SPEC_D, *(mword*) entries [i].data);
break;
case TYPE_POINTER:
printf ("%p", *(gpointer*) entries [i].data);
printf ("0x%"MWORD_FORMAT_SPEC_P, *(mword*) entries [i].data);
break;
case TYPE_BOOL:
printf ("%s", *(gboolean*) entries [i].data ? "true" : "false");
@@ -431,13 +417,13 @@ print_entry (int type, void *data, int num_nums, int *match_indices, gboolean co
#define TYPE_INT int
#define TYPE_LONGLONG long long
#define TYPE_SIZE size_t
#define TYPE_POINTER gpointer
#define TYPE_SIZE mword
#define TYPE_POINTER mword
static gboolean
matches_interval (gpointer ptr, gpointer start, int size)
matches_interval (mword ptr, mword start, int size)
{
return ptr >= start && (char*)ptr < (char*)start + size;
return ptr >= start && ptr < start + size;
}
/* Returns the index of the field where a match was found,
@@ -445,7 +431,7 @@ matches_interval (gpointer ptr, gpointer start, int size)
* BINARY_PROTOCOL_MATCH for a match with no index.
*/
static int
match_index (gpointer ptr, int type, void *data)
match_index (mword ptr, int type, void *data)
{
switch (TYPE (type)) {
@@ -508,7 +494,7 @@ match_index (gpointer ptr, int type, void *data)
}
static gboolean
is_vtable_match (gpointer ptr, int type, void *data)
is_vtable_match (mword ptr, int type, void *data)
{
switch (TYPE (type)) {
@@ -575,85 +561,53 @@ is_vtable_match (gpointer ptr, int type, void *data)
#undef TYPE_SIZE
#undef TYPE_POINTER
int
main (int argc, char *argv[])
static gboolean
sgen_binary_protocol_read_header (EntryStream *stream)
{
#ifdef BINPROT_HAS_HEADER
char data [MAX_ENTRY_SIZE];
int type = read_entry (stream, data);
if (type == SGEN_PROTOCOL_EOF)
return FALSE;
if (type == PROTOCOL_ID (binary_protocol_header)) {
PROTOCOL_STRUCT (binary_protocol_header) * str = (PROTOCOL_STRUCT (binary_protocol_header) *) data;
if (str->check == PROTOCOL_HEADER_CHECK && str->ptr_size == BINPROT_SIZEOF_VOID_P)
return TRUE;
}
return FALSE;
#else
/*
* This implementation doesn't account for the presence of a header,
* reading all the entries with the default configuration of the host
* machine. It has to be used only after all other implementations
* fail to identify a header, for backward compatibility.
*/
return TRUE;
#endif
}
#define CONC(A, B) CONC_(A, B)
#define CONC_(A, B) A##B
#define GREP_ENTRIES_FUNCTION_NAME CONC(sgen_binary_protocol_grep_entries, CONC(ARCH_SUFFIX,PACKED_SUFFIX))
gboolean
GREP_ENTRIES_FUNCTION_NAME (EntryStream *stream, int num_nums, long nums [], int num_vtables, long vtables [],
gboolean dump_all, gboolean pause_times, gboolean color_output, unsigned long long first_entry_to_consider)
{
int type;
void *data = g_malloc0 (MAX_ENTRY_SIZE);
int num_args = argc - 1;
int num_nums = 0;
int num_vtables = 0;
int i;
long nums [num_args];
long vtables [num_args];
gboolean dump_all = FALSE;
gboolean pause_times = FALSE;
gboolean pause_times_stopped = FALSE;
gboolean pause_times_concurrent = FALSE;
gboolean pause_times_finish = FALSE;
gboolean color_output = FALSE;
long long pause_times_ts = 0;
const char *input_path = NULL;
int input_file;
EntryStream stream;
unsigned long long entry_index;
unsigned long long first_entry_to_consider = 0;
for (i = 0; i < num_args; ++i) {
char *arg = argv [i + 1];
char *next_arg = argv [i + 2];
if (!strcmp (arg, "--all")) {
dump_all = TRUE;
} else if (!strcmp (arg, "--pause-times")) {
pause_times = TRUE;
} else if (!strcmp (arg, "-v") || !strcmp (arg, "--vtable")) {
vtables [num_vtables++] = strtoul (next_arg, NULL, 16);
++i;
} else if (!strcmp (arg, "-s") || !strcmp (arg, "--start-at")) {
first_entry_to_consider = strtoull (next_arg, NULL, 10);
++i;
} else if (!strcmp (arg, "-c") || !strcmp (arg, "--color")) {
color_output = TRUE;
} else if (!strcmp (arg, "-i") || !strcmp (arg, "--input")) {
input_path = next_arg;
++i;
} else if (!strcmp (arg, "--help")) {
printf (
"\n"
"Usage:\n"
"\n"
"\tsgen-grep-binprot [options] [pointer...]\n"
"\n"
"Examples:\n"
"\n"
"\tsgen-grep-binprot --all </tmp/binprot\n"
"\tsgen-grep-binprot --input /tmp/binprot --color 0xdeadbeef\n"
"\n"
"Options:\n"
"\n"
"\t--all Print all entries.\n"
"\t--color, -c Highlight matches in color.\n"
"\t--help You're looking at it.\n"
"\t--input FILE, -i FILE Read input from FILE instead of standard input.\n"
"\t--pause-times Print GC pause times.\n"
"\t--start-at N, -s N Begin filtering at the Nth entry.\n"
"\t--vtable PTR, -v PTR Search for vtable pointer PTR.\n"
"\n");
return 0;
} else {
nums [num_nums++] = strtoul (arg, NULL, 16);
}
}
if (!sgen_binary_protocol_read_header (stream))
return FALSE;
if (dump_all)
assert (!pause_times);
if (pause_times)
assert (!dump_all);
input_file = input_path ? open (input_path, O_RDONLY) : STDIN_FILENO;
init_stream (&stream, input_file);
entry_index = 0;
while ((type = read_entry (&stream, data)) != SGEN_PROTOCOL_EOF) {
while ((type = read_entry (stream, data)) != SGEN_PROTOCOL_EOF) {
if (entry_index < first_entry_to_consider)
goto next_entry;
if (pause_times) {
@@ -689,15 +643,15 @@ main (int argc, char *argv[])
} else {
int match_indices [num_nums + 1];
gboolean match = is_always_match (type);
match_indices [num_nums] = num_nums == 0 ? match_index (NULL, type, data) : BINARY_PROTOCOL_NO_MATCH;
match_indices [num_nums] = num_nums == 0 ? match_index (0, type, data) : BINARY_PROTOCOL_NO_MATCH;
match = match_indices [num_nums] != BINARY_PROTOCOL_NO_MATCH;
for (i = 0; i < num_nums; ++i) {
match_indices [i] = match_index ((gpointer) nums [i], type, data);
match_indices [i] = match_index ((mword) nums [i], type, data);
match = match || match_indices [i] != BINARY_PROTOCOL_NO_MATCH;
}
if (!match) {
for (i = 0; i < num_vtables; ++i) {
if (is_vtable_match ((gpointer) vtables [i], type, data)) {
if (is_vtable_match ((mword) vtables [i], type, data)) {
match = TRUE;
break;
}
@@ -713,10 +667,6 @@ main (int argc, char *argv[])
next_entry:
++entry_index;
}
close_stream (&stream);
if (input_path)
close (input_file);
g_free (data);
return 0;
return TRUE;
}