Initial cut
authorTed Mielczarek <ted@mielczarek.org>
Tue, 27 Nov 2012 14:49:45 -0500
changeset 0 bff8d0789d784bb1d9d2f7593844a27ac5e5f0c4
child 1 8b308832a6d38dac44a9f28a4c582be3ff926af9
push id1
push usertmielczarek@mozilla.com
push dateWed, 28 Nov 2012 01:11:36 +0000
Initial cut
.hgignore
Makefile
dumpmodules.cc
new file mode 100644
--- /dev/null
+++ b/.hgignore
@@ -0,0 +1,2 @@
+^dumpmodules$
+~$
new file mode 100644
--- /dev/null
+++ b/Makefile
@@ -0,0 +1,13 @@
+BREAKPAD_SRCDIR := ../google-breakpad
+BREAKPAD_OBJDIR := ../obj-breakpad
+BREAKPAD_LIBS := $(BREAKPAD_OBJDIR)/src/libbreakpad.a $(BREAKPAD_OBJDIR)/src/third_party/libdisasm/libdisasm.a
+
+BIN := dumpmodules
+all: $(BIN)
+
+$(BIN): $(BIN).cc $(BREAKPAD_LIBS)
+	$(CXX) $(CXXFLAGS) -o $@ $< $(BREAKPAD_LIBS) -I$(BREAKPAD_SRCDIR)/src
+
+clean:
+	$(RM) $(BIN)
+
new file mode 100644
--- /dev/null
+++ b/dumpmodules.cc
@@ -0,0 +1,81 @@
+// Copyright (c) 2012 The 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:
+//
+//     * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//     * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following disclaimer
+// in the documentation and/or other materials provided with the
+// distribution.
+//     * Neither the name of The Mozilla Foundation nor the names of its
+// contributors may be used to endorse or promote products derived from
+// this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER 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.
+
+#include <limits.h>
+#include <stdarg.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "google_breakpad/processor/basic_source_line_resolver.h"
+#include "google_breakpad/processor/minidump.h"
+#include "google_breakpad/processor/minidump_processor.h"
+#include "google_breakpad/processor/stack_frame_cpu.h"
+#include "google_breakpad/processor/system_info.h"
+#include "processor/pathname_stripper.h"
+#include "processor/simple_symbol_supplier.h"
+
+using namespace google_breakpad;
+
+void error(const char* fmt, ...)
+{
+  va_list args;
+  va_start(args, fmt);
+  vfprintf(stderr, fmt, args);
+  fprintf(stderr, "\n");
+  va_end(args);
+
+  exit(1);
+}
+
+int main(int argc, char** argv)
+{
+  if (argc != 2) {
+    error("Usage: %s <minidump>\n", argv[0]);
+  }
+
+  Minidump dump(argv[1]);
+  if (!dump.Read()) {
+    error("Couldn't read minidump %s", argv[1]);
+  }
+
+  MinidumpModuleList *modules = dump.GetModuleList();
+
+  if (!modules) {
+    error("Minidump %s is missing module list", argv[1]);
+  }
+
+  unsigned int module_count = modules->module_count();
+  for (unsigned int module_sequence = 0;
+       module_sequence < module_count;
+       ++module_sequence) {
+    const CodeModule *module = modules->GetModuleAtSequence(module_sequence);
+    printf("%s\n", module->code_file().c_str());
+  }
+  return 0;
+}