Commit 7bf19e80 authored by antonm@chromium.org's avatar antonm@chromium.org

Various improvements to oom_dump and instance type lists.

1) addresses various Mark's concern;
2) adds some missing instance types and rearranges existing ones to follow
  InstanceType order;
3) various minor cleanups.

Review URL: http://codereview.chromium.org/3119023

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@5286 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 71131631
......@@ -3959,8 +3959,8 @@ bool Heap::ConfigureHeapDefault() {
void Heap::RecordStats(HeapStats* stats, bool take_snapshot) {
*stats->start_marker = 0xDECADE00;
*stats->end_marker = 0xDECADE01;
*stats->start_marker = HeapStats::kStartMarker;
*stats->end_marker = HeapStats::kEndMarker;
*stats->new_space_size = new_space_.Size();
*stats->new_space_capacity = new_space_.Capacity();
*stats->old_pointer_space_size = old_pointer_space_->Size();
......
......@@ -1319,6 +1319,9 @@ class Heap : public AllStatic {
class HeapStats {
public:
static const int kStartMarker = 0xDECADE00;
static const int kEndMarker = 0xDECADE01;
int* start_marker; // 0
int* new_space_size; // 1
int* new_space_capacity; // 2
......
......@@ -230,19 +230,21 @@ enum PropertyNormalizationMode {
V(CONS_SYMBOL_TYPE) \
V(CONS_ASCII_SYMBOL_TYPE) \
V(EXTERNAL_SYMBOL_TYPE) \
V(EXTERNAL_SYMBOL_WITH_ASCII_DATA_TYPE) \
V(EXTERNAL_ASCII_SYMBOL_TYPE) \
V(STRING_TYPE) \
V(ASCII_STRING_TYPE) \
V(CONS_STRING_TYPE) \
V(CONS_ASCII_STRING_TYPE) \
V(EXTERNAL_STRING_TYPE) \
V(EXTERNAL_STRING_WITH_ASCII_DATA_TYPE) \
V(EXTERNAL_ASCII_STRING_TYPE) \
V(PRIVATE_EXTERNAL_ASCII_STRING_TYPE) \
\
V(MAP_TYPE) \
V(CODE_TYPE) \
V(JS_GLOBAL_PROPERTY_CELL_TYPE) \
V(ODDBALL_TYPE) \
V(JS_GLOBAL_PROPERTY_CELL_TYPE) \
\
V(HEAP_NUMBER_TYPE) \
V(PROXY_TYPE) \
......@@ -260,11 +262,9 @@ enum PropertyNormalizationMode {
V(EXTERNAL_FLOAT_ARRAY_TYPE) \
V(FILLER_TYPE) \
\
V(FIXED_ARRAY_TYPE) \
V(ACCESSOR_INFO_TYPE) \
V(ACCESS_CHECK_INFO_TYPE) \
V(INTERCEPTOR_INFO_TYPE) \
V(SHARED_FUNCTION_INFO_TYPE) \
V(CALL_HANDLER_INFO_TYPE) \
V(FUNCTION_TEMPLATE_INFO_TYPE) \
V(OBJECT_TEMPLATE_INFO_TYPE) \
......@@ -273,6 +273,9 @@ enum PropertyNormalizationMode {
V(SCRIPT_TYPE) \
V(CODE_CACHE_TYPE) \
\
V(FIXED_ARRAY_TYPE) \
V(SHARED_FUNCTION_INFO_TYPE) \
\
V(JS_VALUE_TYPE) \
V(JS_OBJECT_TYPE) \
V(JS_CONTEXT_EXTENSION_OBJECT_TYPE) \
......
oom_dump extracts useful information from Google Chrome OOM minidumps.
oom_dump extracts useful information from Google Chrome OOM minidumps.
To build one needs a google-breakpad checkout
(http://code.google.com/p/google-breakpad/).
......@@ -15,7 +15,7 @@ need some additional tweaking to make it discoverable, for example,
put a soft link into /usr/lib directory).
Next step is to build v8. Note: you should build x64 version of v8,
if you're on 64-bit platform, otherwise you would get link error when
if you're on 64-bit platform, otherwise you would get a link error when
building oom_dump.
The last step is to build oom_dump itself. The following command should work:
......@@ -23,8 +23,9 @@ The last step is to build oom_dump itself. The following command should work:
cd <v8 working copy>/tools/oom_dump
scons BREAKPAD_DIR=<path to google-breakpad working copy>
(Additionally you can control v8 working copy dir, but default---../..---
should work just fine).
(Additionally you can control v8 working copy dir, but the default should work.)
If everything goes fine, oom_dump <path to minidump> should print
some useful information about OOM crash.
some useful information about the OOM crash.
Note: currently only 32-bit Windows minidumps are supported.
......@@ -25,12 +25,12 @@
// (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 <algorithm>
#include <stdio.h>
#include <stdlib.h>
#include <algorithm>
#include <google_breakpad/processor/minidump.h>
#include <processor/logging.h>
#define ENABLE_DEBUGGER_SUPPORT
......@@ -128,6 +128,9 @@ void DumpHeapStats(const char *minidump_file) {
thread_list->GetThreadByID(exception_thread_id);
CHECK(exception_thread);
// Currently only 32-bit Windows minidumps are supported.
CHECK_EQ(MD_CONTEXT_X86, crash_context->GetContextCPU());
const MDRawContextX86* contextX86 = crash_context->GetContextX86();
CHECK(contextX86);
......@@ -145,7 +148,7 @@ void DumpHeapStats(const char *minidump_file) {
if (value >= esp && value < last) {
u_int32_t value2 = 0;
CHECK(memory_region->GetMemoryAtAddress(value, &value2));
if (value2 == 0xdecade00) {
if (value2 == v8::internal::HeapStats::kStartMarker) {
heap_stats_addr = addr;
break;
}
......@@ -158,8 +161,8 @@ void DumpHeapStats(const char *minidump_file) {
#define READ_FIELD(offset) \
ReadPointedValue(memory_region, heap_stats_addr, offset)
CHECK(READ_FIELD(0) == 0xdecade00);
CHECK(READ_FIELD(23) == 0xdecade01);
CHECK(READ_FIELD(0) == v8::internal::HeapStats::kStartMarker);
CHECK(READ_FIELD(23) == v8::internal::HeapStats::kEndMarker);
const int new_space_size = READ_FIELD(1);
const int new_space_capacity = READ_FIELD(2);
......@@ -213,9 +216,9 @@ void DumpHeapStats(const char *minidump_file) {
// Print heap stats.
printf("exception thread ID: %d (%x)\n",
printf("exception thread ID: %" PRIu32 " (%#" PRIx32 ")\n",
exception_thread_id, exception_thread_id);
printf("heap stats address: %p\n", (void*)heap_stats_addr);
printf("heap stats address: %#" PRIx64 "\n", heap_stats_addr);
#define PRINT_INT_STAT(stat) \
printf("\t%-25s\t% 10d\n", #stat ":", stat);
#define PRINT_MB_STAT(stat) \
......@@ -255,15 +258,15 @@ void DumpHeapStats(const char *minidump_file) {
const char* name = InstanceTypeToString(type);
if (name == NULL) {
// Unknown instance type. Check that there is no objects of that type.
CHECK(objects_per_type[type] == 0);
CHECK(size_per_type[type] == 0);
CHECK_EQ(0, objects_per_type[type]);
CHECK_EQ(0, size_per_type[type]);
continue;
}
int size = size_per_type[type];
running_size += size;
printf("\t%-37s% 9d% 11.3f MB% 10.3f%%% 10.3f%%\n",
name, objects_per_type[type], toM(size),
100.*size/total_size, 100.*running_size/total_size);
100. * size / total_size, 100. * running_size / total_size);
}
printf("\t%-37s% 9d% 11.3f MB% 10.3f%%% 10.3f%%\n",
"total", 0, toM(total_size), 100., 100.);
......@@ -272,8 +275,6 @@ void DumpHeapStats(const char *minidump_file) {
} // namespace
int main(int argc, char **argv) {
BPLOG_INIT(&argc, &argv);
if (argc != 2) {
fprintf(stderr, "usage: %s <minidump>\n", argv[0]);
return 1;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment