From 08b912f1ed29520ea75a3e472a80aec08318c067 Mon Sep 17 00:00:00 2001 From: jimblandy Date: Wed, 1 Feb 2012 15:00:43 +0000 Subject: [PATCH] Breakpad DWARF support: Remove extraneous breaks following returns in dwarf2reader.cc. a=jimb, r=ted.mielczarek Review URL: http://breakpad.appspot.com/343002/ git-svn-id: http://google-breakpad.googlecode.com/svn/trunk@911 4c0a9323-5329-0410-9bdc-e9ce6186880e --- src/common/dwarf/dwarf2reader.cc | 50 ++++---------------------------- 1 file changed, 6 insertions(+), 44 deletions(-) diff --git a/src/common/dwarf/dwarf2reader.cc b/src/common/dwarf/dwarf2reader.cc index b927b3fe..2d2edf45 100644 --- a/src/common/dwarf/dwarf2reader.cc +++ b/src/common/dwarf/dwarf2reader.cc @@ -150,41 +150,32 @@ const char* CompilationUnit::SkipAttribute(const char* start, &len)); start += len; return SkipAttribute(start, form); - break; case DW_FORM_data1: case DW_FORM_flag: case DW_FORM_ref1: return start + 1; - break; case DW_FORM_ref2: case DW_FORM_data2: return start + 2; - break; case DW_FORM_ref4: case DW_FORM_data4: return start + 4; - break; case DW_FORM_ref8: case DW_FORM_data8: return start + 8; - break; case DW_FORM_string: return start + strlen(start) + 1; - break; case DW_FORM_udata: case DW_FORM_ref_udata: reader_->ReadUnsignedLEB128(start, &len); return start + len; - break; case DW_FORM_sdata: reader_->ReadSignedLEB128(start, &len); return start + len; - break; case DW_FORM_addr: return start + reader_->AddressSize(); - break; case DW_FORM_ref_addr: // DWARF2 and 3 differ on whether ref_addr is address size or // offset size. @@ -194,27 +185,19 @@ const char* CompilationUnit::SkipAttribute(const char* start, } else if (header_.version == 3) { return start + reader_->OffsetSize(); } - break; case DW_FORM_block1: return start + 1 + reader_->ReadOneByte(start); - break; case DW_FORM_block2: return start + 2 + reader_->ReadTwoBytes(start); - break; case DW_FORM_block4: return start + 4 + reader_->ReadFourBytes(start); - break; case DW_FORM_block: { uint64 size = reader_->ReadUnsignedLEB128(start, &len); return start + size + len; } - break; case DW_FORM_strp: - return start + reader_->OffsetSize(); - break; - default: - fprintf(stderr,"Unhandled form type"); + return start + reader_->OffsetSize(); } fprintf(stderr,"Unhandled form type"); return NULL; @@ -326,85 +309,71 @@ const char* CompilationUnit::ProcessAttribute( &len)); start += len; return ProcessAttribute(dieoffset, start, attr, form); - break; case DW_FORM_data1: case DW_FORM_flag: handler_->ProcessAttributeUnsigned(dieoffset, attr, form, reader_->ReadOneByte(start)); return start + 1; - break; case DW_FORM_data2: handler_->ProcessAttributeUnsigned(dieoffset, attr, form, reader_->ReadTwoBytes(start)); return start + 2; - break; case DW_FORM_data4: handler_->ProcessAttributeUnsigned(dieoffset, attr, form, reader_->ReadFourBytes(start)); return start + 4; - break; case DW_FORM_data8: handler_->ProcessAttributeUnsigned(dieoffset, attr, form, reader_->ReadEightBytes(start)); return start + 8; - break; case DW_FORM_string: { const char* str = start; handler_->ProcessAttributeString(dieoffset, attr, form, str); return start + strlen(str) + 1; } - break; case DW_FORM_udata: handler_->ProcessAttributeUnsigned(dieoffset, attr, form, reader_->ReadUnsignedLEB128(start, &len)); return start + len; - break; case DW_FORM_sdata: handler_->ProcessAttributeSigned(dieoffset, attr, form, reader_->ReadSignedLEB128(start, &len)); return start + len; - break; case DW_FORM_addr: handler_->ProcessAttributeUnsigned(dieoffset, attr, form, reader_->ReadAddress(start)); return start + reader_->AddressSize(); - break; case DW_FORM_ref1: handler_->ProcessAttributeReference(dieoffset, attr, form, reader_->ReadOneByte(start) + offset_from_section_start_); return start + 1; - break; case DW_FORM_ref2: handler_->ProcessAttributeReference(dieoffset, attr, form, reader_->ReadTwoBytes(start) + offset_from_section_start_); return start + 2; - break; case DW_FORM_ref4: handler_->ProcessAttributeReference(dieoffset, attr, form, reader_->ReadFourBytes(start) + offset_from_section_start_); return start + 4; - break; case DW_FORM_ref8: handler_->ProcessAttributeReference(dieoffset, attr, form, reader_->ReadEightBytes(start) + offset_from_section_start_); return start + 8; - break; case DW_FORM_ref_udata: handler_->ProcessAttributeReference(dieoffset, attr, form, reader_->ReadUnsignedLEB128(start, &len) + offset_from_section_start_); return start + len; - break; case DW_FORM_ref_addr: // DWARF2 and 3 differ on whether ref_addr is address size or // offset size. @@ -423,31 +392,27 @@ const char* CompilationUnit::ProcessAttribute( case DW_FORM_block1: { uint64 datalen = reader_->ReadOneByte(start); handler_->ProcessAttributeBuffer(dieoffset, attr, form, start + 1, - datalen); + datalen); return start + 1 + datalen; } - break; case DW_FORM_block2: { uint64 datalen = reader_->ReadTwoBytes(start); handler_->ProcessAttributeBuffer(dieoffset, attr, form, start + 2, - datalen); + datalen); return start + 2 + datalen; } - break; case DW_FORM_block4: { uint64 datalen = reader_->ReadFourBytes(start); handler_->ProcessAttributeBuffer(dieoffset, attr, form, start + 4, - datalen); + datalen); return start + 4 + datalen; } - break; case DW_FORM_block: { uint64 datalen = reader_->ReadUnsignedLEB128(start, &len); handler_->ProcessAttributeBuffer(dieoffset, attr, form, start + len, - datalen); + datalen); return start + datalen + len; } - break; case DW_FORM_strp: { assert(string_buffer_ != NULL); @@ -459,11 +424,8 @@ const char* CompilationUnit::ProcessAttribute( str); return start + reader_->OffsetSize(); } - break; - default: - fprintf(stderr, "Unhandled form type"); } - fprintf(stderr, "Unhandled form type"); + fprintf(stderr, "Unhandled form type\n"); return NULL; }