AM_CPPFLAGS = $(GLIB_CFLAGS) -I$(top_srcdir)
-noinst_LIBRARIES = libsgen-grep-binprot.a libsgen-grep-binprotp.a
+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_binprotp_a_SOURCES = sgen-grep-binprot.c
-libsgen_grep_binprotp_a_CPPFLAGS = $(GLIB_CFLAGS) -I$(top_srcdir) -DBINPROT_HAS_HEADER
+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-main.c \
- sgen-grep-binprot.c \
sgen-entry-stream.c
sgen_grep_binprot_LDADD = \
- $(GLIB_LIBS) $(LIBICONV) libsgen-grep-binprot.a libsgen-grep-binprotp.a
+ $(GLIB_LIBS) $(LIBICONV) libsgen-grep-binprot.a libsgen-grep-binprot32p.a libsgen-grep-binprot64p.a
#include "sgen-entry-stream.h"
#include "sgen-grep-binprot.h"
+/* FIXME Add grepers for specific endianness */
GrepEntriesFunction grepers [] = {
- sgen_binary_protocol_grep_entriesp,
- sgen_binary_protocol_grep_entries
+ 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
#define PACKED_SUFFIX
#endif
-#if SIZEOF_VOID_P == 4
+#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
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)
+ if (str->check == PROTOCOL_HEADER_CHECK && str->ptr_size == BINPROT_SIZEOF_VOID_P)
return TRUE;
}
return FALSE;
#define CONC(A, B) CONC_(A, B)
#define CONC_(A, B) A##B
-#define GREP_ENTRIES_FUNCTION_NAME CONC(sgen_binary_protocol_grep_entries, PACKED_SUFFIX)
+#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 [],
sgen_binary_protocol_grep_entries (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);
gboolean
-sgen_binary_protocol_grep_entriesp (EntryStream *stream, int num_nums, long nums [], int num_vtables, long vtables [],
+sgen_binary_protocol_grep_entries32p (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);
+gboolean
+sgen_binary_protocol_grep_entries64p (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);