From 87c564efb63ca79dff56aa60140e9e006b745336 Mon Sep 17 00:00:00 2001 From: "mstarzinger@chromium.org" Date: Tue, 9 Apr 2013 15:25:40 +0000 Subject: [PATCH] GDBJIT: Properly terminate sub program and compile unit Review URL: https://codereview.chromium.org/13781002 Patch from Haitao Feng . git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@14188 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/gdb-jit.cc | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/gdb-jit.cc b/src/gdb-jit.cc index bd663fb..32066ad 100644 --- a/src/gdb-jit.cc +++ b/src/gdb-jit.cc @@ -1213,8 +1213,11 @@ class DebugInfoSection : public DebugSection { w->WriteSLEB128(StandardFrameConstants::kContextOffset); block_size.set(static_cast(w->position() - block_start)); } + + w->WriteULEB128(0); // Terminate the sub program. } + w->WriteULEB128(0); // Terminate the compile unit. size.set(static_cast(w->position() - start)); return true; } @@ -1324,15 +1327,14 @@ class DebugAbbrevSection : public DebugSection { // The real slot ID is internal_slots + context_slot_id. int internal_slots = Context::MIN_CONTEXT_SLOTS; int locals = scope->StackLocalCount(); - int total_children = - params + slots + context_slots + internal_slots + locals + 2; + // Total children is params + slots + context_slots + internal_slots + + // locals + 2 (__function and __context). // The extra duplication below seems to be necessary to keep // gdb from getting upset on OSX. w->WriteULEB128(current_abbreviation++); // Abbreviation code. w->WriteULEB128(DW_TAG_SUBPROGRAM); - w->Write( - total_children != 0 ? DW_CHILDREN_YES : DW_CHILDREN_NO); + w->Write(DW_CHILDREN_YES); w->WriteULEB128(DW_AT_NAME); w->WriteULEB128(DW_FORM_STRING); w->WriteULEB128(DW_AT_LOW_PC); @@ -1384,9 +1386,7 @@ class DebugAbbrevSection : public DebugSection { // The context. WriteVariableAbbreviation(w, current_abbreviation++, true, false); - if (total_children != 0) { - w->WriteULEB128(0); // Terminate the sibling list. - } + w->WriteULEB128(0); // Terminate the sibling list. } w->WriteULEB128(0); // Terminate the table. -- 2.7.4