Re: [Lldb-commits] [PATCH] DWARF64 Fixes

2014-09-11 Thread Todd Fiala
:-)

On Thu, Sep 11, 2014 at 10:39 AM, Tong Shen  wrote:

> Thanks Todd!
>
> http://reviews.llvm.org/D5307
>
>
>


-- 
Todd Fiala | Software Engineer | tfi...@google.com | 650-943-3180
___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] DWARF64 Fixes

2014-09-11 Thread Todd Fiala
 svn commit
Sendingsource/Plugins/SymbolFile/DWARF/DWARFAbbreviationDeclaration.cpp
Sendingsource/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
Sendingsource/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h
Sendingsource/Plugins/SymbolFile/DWARF/DWARFDataExtractor.h
Sendingsource/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
Sendingsource/Plugins/SymbolFile/DWARF/DWARFDebugLine.cpp
Sendingsource/Plugins/SymbolFile/DWARF/DWARFDebugPubnames.cpp
Sendingsource/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp
Sendingsource/Plugins/SymbolFile/DWARF/DWARFFormValue.h
Sendingsource/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
Transmitting file data ..
Committed revision 217607.

http://reviews.llvm.org/D5307



___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] DWARF64 Fixes

2014-09-11 Thread Todd Fiala
Great!  I'll get those in, Tong.

On Thu, Sep 11, 2014 at 9:34 AM, Greg Clayton  wrote:

> Looks good.
>
> > On Sep 10, 2014, at 7:34 PM, Tong Shen  wrote:
> >
> > http://reviews.llvm.org/D5307
> >
> > Files:
> >  source/Plugins/SymbolFile/DWARF/DWARFAbbreviationDeclaration.cpp
> >  source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
> >  source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h
> >  source/Plugins/SymbolFile/DWARF/DWARFDataExtractor.h
> >  source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
> >  source/Plugins/SymbolFile/DWARF/DWARFDebugLine.cpp
> >  source/Plugins/SymbolFile/DWARF/DWARFDebugPubnames.cpp
> >  source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp
> >  source/Plugins/SymbolFile/DWARF/DWARFFormValue.h
> >  source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
> > ___
> > lldb-commits mailing list
> > lldb-commits@cs.uiuc.edu
> > http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits
>
>


-- 
Todd Fiala | Software Engineer | tfi...@google.com | 650-943-3180
___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] DWARF64 Fixes

2014-09-11 Thread Greg Clayton
Looks good.

> On Sep 10, 2014, at 7:34 PM, Tong Shen  wrote:
> 
> http://reviews.llvm.org/D5307
> 
> Files:
>  source/Plugins/SymbolFile/DWARF/DWARFAbbreviationDeclaration.cpp
>  source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
>  source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h
>  source/Plugins/SymbolFile/DWARF/DWARFDataExtractor.h
>  source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
>  source/Plugins/SymbolFile/DWARF/DWARFDebugLine.cpp
>  source/Plugins/SymbolFile/DWARF/DWARFDebugPubnames.cpp
>  source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp
>  source/Plugins/SymbolFile/DWARF/DWARFFormValue.h
>  source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
> ___
> lldb-commits mailing list
> lldb-commits@cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits

___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits


Re: [Lldb-commits] [PATCH] DWARF64 Fixes

2014-09-10 Thread Tong Shen
http://reviews.llvm.org/D5307

Files:
  source/Plugins/SymbolFile/DWARF/DWARFAbbreviationDeclaration.cpp
  source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
  source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h
  source/Plugins/SymbolFile/DWARF/DWARFDataExtractor.h
  source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
  source/Plugins/SymbolFile/DWARF/DWARFDebugLine.cpp
  source/Plugins/SymbolFile/DWARF/DWARFDebugPubnames.cpp
  source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp
  source/Plugins/SymbolFile/DWARF/DWARFFormValue.h
  source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
Index: source/Plugins/SymbolFile/DWARF/DWARFAbbreviationDeclaration.cpp
===
--- source/Plugins/SymbolFile/DWARF/DWARFAbbreviationDeclaration.cpp
+++ source/Plugins/SymbolFile/DWARF/DWARFAbbreviationDeclaration.cpp
@@ -73,14 +73,14 @@
 void
 DWARFAbbreviationDeclaration::Dump(Stream *s)  const
 {
-//  *ostrm_ptr << std::setfill(' ') << std::dec << '[' << std::setw(3) << std::right << m_code << ']' << ' ' << std::setw(30) << std::left << DW_TAG_value_to_name(m_tag) << DW_CHILDREN_value_to_name(m_has_children) << std::endl;
-//
-//  DWARFAttribute::const_iterator pos;
-//
-//  for (pos = m_attributes.begin(); pos != m_attributes.end(); ++pos)
-//  *ostrm_ptr << "  " << std::setw(29) << std::left << DW_AT_value_to_name(pos->attr()) << ' ' << DW_FORM_value_to_name(pos->form()) << std::endl;
-//
-//  *ostrm_ptr << std::endl;
+s->Printf("Debug Abbreviation Declaration: code = 0x%4.4x, tag = %s, has_children = %s\n", m_code, DW_TAG_value_to_name(m_tag), DW_CHILDREN_value_to_name(m_has_children));
+
+DWARFAttribute::const_iterator pos;
+
+for (pos = m_attributes.begin(); pos != m_attributes.end(); ++pos)
+s->Printf("attr = %s, form = %s\n", DW_AT_value_to_name(pos->get_attr()), DW_FORM_value_to_name(pos->get_form()));
+
+s->Printf("\n");
 }
 
 
Index: source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
===
--- source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
+++ source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
@@ -49,7 +49,8 @@
 m_producer  (eProducerInvalid),
 m_producer_version_major (0),
 m_producer_version_minor (0),
-m_producer_version_update (0)
+m_producer_version_update (0),
+m_is_dwarf64(false)
 {
 }
 
@@ -66,6 +67,7 @@
 m_func_aranges_ap.reset();
 m_user_data = NULL;
 m_producer  = eProducerInvalid;
+m_is_dwarf64= false;
 }
 
 bool
@@ -79,9 +81,10 @@
 {
 dw_offset_t abbr_offset;
 const DWARFDebugAbbrev *abbr = m_dwarf2Data->DebugAbbrev();
-m_length= debug_info.GetU32(offset_ptr);
+m_length= debug_info.GetDWARFInitialLength(offset_ptr);
+m_is_dwarf64= debug_info.IsDWARF64();
 m_version   = debug_info.GetU16(offset_ptr);
-abbr_offset = debug_info.GetU32(offset_ptr);
+abbr_offset = debug_info.GetDWARFOffset(offset_ptr);
 m_addr_size = debug_info.GetU8 (offset_ptr);
 
 bool length_OK = debug_info.ValidOffset(GetNextCompileUnitOffset()-1);
@@ -168,7 +171,7 @@
 die_index_stack.reserve(32);
 die_index_stack.push_back(0);
 bool prev_die_had_children = false;
-const uint8_t *fixed_form_sizes = DWARFFormValue::GetFixedFormSizesForAddressSize (GetAddressByteSize());
+const uint8_t *fixed_form_sizes = DWARFFormValue::GetFixedFormSizesForAddressSize (GetAddressByteSize(), m_is_dwarf64);
 while (offset < next_cu_offset &&
die.FastExtract (debug_info_data, this, fixed_form_sizes, &offset))
 {
@@ -347,6 +350,14 @@
 return DWARFCompileUnit::GetDefaultAddressSize();
 }
 
+bool
+DWARFCompileUnit::IsDWARF64(const DWARFCompileUnit* cu)
+{
+if (cu)
+return cu->IsDWARF64();
+return false;
+}
+
 uint8_t
 DWARFCompileUnit::GetDefaultAddressSize()
 {
@@ -619,7 +630,7 @@
 {
 const DWARFDataExtractor* debug_str = &m_dwarf2Data->get_debug_str_data();
 
-const uint8_t *fixed_form_sizes = DWARFFormValue::GetFixedFormSizesForAddressSize (GetAddressByteSize());
+const uint8_t *fixed_form_sizes = DWARFFormValue::GetFixedFormSizesForAddressSize (GetAddressByteSize(), m_is_dwarf64);
 
 Log *log (LogChannelDWARF::GetLogIfAll (DWARF_LOG_LOOKUPS));
 
@@ -1030,3 +1041,9 @@
 return m_producer_version_update;
 }
 
+bool
+DWARFCompileUnit::IsDWARF64() const
+{
+return m_is_dwarf64;
+}
+
Index: source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h
===
--- source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h
+++ source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h
@@ -41,11 +41,11 @@
 boolVerify(lldb_private::Stream *s) const;
 voidDump(lldb_private::Stream *s) const;
 dw_offset_t GetOffset() const { return m_offset; }
-uint32_tSize() cons

Re: [Lldb-commits] [PATCH] DWARF64 Fixes

2014-09-10 Thread Tong Shen
Address Jason's comments

http://reviews.llvm.org/D5307

Files:
  source/Plugins/SymbolFile/DWARF/DWARFAbbreviationDeclaration.cpp
  source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
  source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h
  source/Plugins/SymbolFile/DWARF/DWARFDataExtractor.h
  source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp
  source/Plugins/SymbolFile/DWARF/DWARFDebugLine.cpp
  source/Plugins/SymbolFile/DWARF/DWARFDebugPubnames.cpp
  source/Plugins/SymbolFile/DWARF/DWARFFormValue.cpp
  source/Plugins/SymbolFile/DWARF/DWARFFormValue.h
  source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp
Index: source/Plugins/SymbolFile/DWARF/DWARFAbbreviationDeclaration.cpp
===
--- source/Plugins/SymbolFile/DWARF/DWARFAbbreviationDeclaration.cpp
+++ source/Plugins/SymbolFile/DWARF/DWARFAbbreviationDeclaration.cpp
@@ -73,14 +73,14 @@
 void
 DWARFAbbreviationDeclaration::Dump(Stream *s)  const
 {
-//  *ostrm_ptr << std::setfill(' ') << std::dec << '[' << std::setw(3) << std::right << m_code << ']' << ' ' << std::setw(30) << std::left << DW_TAG_value_to_name(m_tag) << DW_CHILDREN_value_to_name(m_has_children) << std::endl;
-//
-//  DWARFAttribute::const_iterator pos;
-//
-//  for (pos = m_attributes.begin(); pos != m_attributes.end(); ++pos)
-//  *ostrm_ptr << "  " << std::setw(29) << std::left << DW_AT_value_to_name(pos->attr()) << ' ' << DW_FORM_value_to_name(pos->form()) << std::endl;
-//
-//  *ostrm_ptr << std::endl;
+s->Printf("Debug Abbreviation Declaration: code = 0x%4.4x, tag = %s, has_children = %s\n", m_code, DW_TAG_value_to_name(m_tag), DW_CHILDREN_value_to_name(m_has_children));
+
+DWARFAttribute::const_iterator pos;
+
+for (pos = m_attributes.begin(); pos != m_attributes.end(); ++pos)
+s->Printf("attr = %s, form = %s\n", DW_AT_value_to_name(pos->get_attr()), DW_FORM_value_to_name(pos->get_form()));
+
+s->Printf("\n");
 }
 
 
Index: source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
===
--- source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
+++ source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.cpp
@@ -49,7 +49,8 @@
 m_producer  (eProducerInvalid),
 m_producer_version_major (0),
 m_producer_version_minor (0),
-m_producer_version_update (0)
+m_producer_version_update (0),
+m_is_dwarf64(false)
 {
 }
 
@@ -66,6 +67,7 @@
 m_func_aranges_ap.reset();
 m_user_data = NULL;
 m_producer  = eProducerInvalid;
+m_is_dwarf64= false;
 }
 
 bool
@@ -79,9 +81,10 @@
 {
 dw_offset_t abbr_offset;
 const DWARFDebugAbbrev *abbr = m_dwarf2Data->DebugAbbrev();
-m_length= debug_info.GetU32(offset_ptr);
+m_length= debug_info.GetDWARFInitialLength(offset_ptr);
+m_is_dwarf64= debug_info.IsDWARF64();
 m_version   = debug_info.GetU16(offset_ptr);
-abbr_offset = debug_info.GetU32(offset_ptr);
+abbr_offset = debug_info.GetDWARFOffset(offset_ptr);
 m_addr_size = debug_info.GetU8 (offset_ptr);
 
 bool length_OK = debug_info.ValidOffset(GetNextCompileUnitOffset()-1);
@@ -168,7 +171,7 @@
 die_index_stack.reserve(32);
 die_index_stack.push_back(0);
 bool prev_die_had_children = false;
-const uint8_t *fixed_form_sizes = DWARFFormValue::GetFixedFormSizesForAddressSize (GetAddressByteSize());
+const uint8_t *fixed_form_sizes = DWARFFormValue::GetFixedFormSizesForAddressSize (GetAddressByteSize(), m_is_dwarf64);
 while (offset < next_cu_offset &&
die.FastExtract (debug_info_data, this, fixed_form_sizes, &offset))
 {
@@ -347,6 +350,14 @@
 return DWARFCompileUnit::GetDefaultAddressSize();
 }
 
+bool
+DWARFCompileUnit::IsDWARF64(const DWARFCompileUnit* cu)
+{
+if (cu)
+return cu->IsDWARF64();
+return false;
+}
+
 uint8_t
 DWARFCompileUnit::GetDefaultAddressSize()
 {
@@ -619,7 +630,7 @@
 {
 const DWARFDataExtractor* debug_str = &m_dwarf2Data->get_debug_str_data();
 
-const uint8_t *fixed_form_sizes = DWARFFormValue::GetFixedFormSizesForAddressSize (GetAddressByteSize());
+const uint8_t *fixed_form_sizes = DWARFFormValue::GetFixedFormSizesForAddressSize (GetAddressByteSize(), m_is_dwarf64);
 
 Log *log (LogChannelDWARF::GetLogIfAll (DWARF_LOG_LOOKUPS));
 
@@ -1030,3 +1041,9 @@
 return m_producer_version_update;
 }
 
+bool
+DWARFCompileUnit::IsDWARF64() const
+{
+return m_is_dwarf64;
+}
+
Index: source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h
===
--- source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h
+++ source/Plugins/SymbolFile/DWARF/DWARFCompileUnit.h
@@ -41,11 +41,11 @@
 boolVerify(lldb_private::Stream *s) const;
 voidDump(lldb_private::Stream *s) const;
 dw_offset_t GetOffset() const { return m_offset; }
- 

Re: [Lldb-commits] [PATCH] DWARF64 Fixes

2014-09-10 Thread Jason Molenda
Greg has done most of the DWARF parser work, he should comment.

In DWARFDebugInfoEntry.cpp DW_FORM_ref_addr you use cu->GetAddressByteSize() 
for the size (or cu_addr_size, used in a different part of the file) -- but if 
this is a 64-bit binary using DWARF32, that would be wrong - this is a 
reference to another part of the DWARF.  Or a 32-bit binary using DWARF64.  
Don't you want to do cu->IsDWARF64() (like you do for DW_FORM_strp / 
DW_FORM_sec_offset)? 

(or more accurately, for DWARF2, the DW_FORM_ref_addr is apparently the word 
size of the program; with DWARF3+, it's 4 for DWARF32, 8 for DWARF64)


I see what you're doing in DWARFFormValue::GetFixedFormSizesForAddressSize -- 
you assume that 32-bit-program + DWARF64 is not a possible combination.  That's 
fine, I don't really think any producer would generate it.


Greg might not want to see this change to DWARFAbbreviationDeclaration::Dump() 
;) but I don't have an opinion on that.

Otherwise it looks fine to me.

http://reviews.llvm.org/D5307



___
lldb-commits mailing list
lldb-commits@cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits