<p dir="ltr"><br>
On Sep 3, 2014 11:27 PM, "Frederic Riss" <<a href="mailto:friss@apple.com">friss@apple.com</a>> wrote:<br>
><br>
> Author: friss<br>
> Date: Thu Sep 4 01:14:28 2014<br>
> New Revision: 217128<br>
><br>
> URL: <a href="http://llvm.org/viewvc/llvm-project?rev=217128&view=rev">http://llvm.org/viewvc/llvm-project?rev=217128&view=rev</a><br>
> Log:<br>
> Add a DWARFContext& member in DWARFUnit.<br>
><br>
> The DWARFContext will be used to pass global 'context' down, like<br>
> pointers to related debug info sections or command line options.<br>
> The first use will be for the debug_info dumper to be able to access<br>
> other debug info section to dump eg. Location Expression inline<br>
> in the debug_info dump.</p>
<p dir="ltr">Hmm, how is this useful for location expression dumping? What extra info do you need there? I guess I'll see when you get to those patches, but just curious.</p>
<p dir="ltr">(I was expecting this to be used for stuff like low_pc rendering for example)</p>
<p dir="ltr">Hmm - and how did we do rendering of DW_form_strp without access to other sections via the unit? I guess we passed in the string table specifically? Can we remove that explicit passing notes that we have the whole unit?</p>
<p dir="ltr">><br>
> Modified:<br>
> llvm/trunk/lib/DebugInfo/DWARFCompileUnit.h<br>
> llvm/trunk/lib/DebugInfo/DWARFContext.cpp<br>
> llvm/trunk/lib/DebugInfo/DWARFTypeUnit.h<br>
> llvm/trunk/lib/DebugInfo/DWARFUnit.cpp<br>
> llvm/trunk/lib/DebugInfo/DWARFUnit.h<br>
><br>
> Modified: llvm/trunk/lib/DebugInfo/DWARFCompileUnit.h<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/DWARFCompileUnit.h?rev=217128&r1=217127&r2=217128&view=diff">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/DWARFCompileUnit.h?rev=217128&r1=217127&r2=217128&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/lib/DebugInfo/DWARFCompileUnit.h (original)<br>
> +++ llvm/trunk/lib/DebugInfo/DWARFCompileUnit.h Thu Sep 4 01:14:28 2014<br>
> @@ -16,10 +16,10 @@ namespace llvm {<br>
><br>
> class DWARFCompileUnit : public DWARFUnit {<br>
> public:<br>
> - DWARFCompileUnit(const DWARFDebugAbbrev *DA, StringRef IS, StringRef RS,<br>
> - StringRef SS, StringRef SOS, StringRef AOS,<br>
> - const RelocAddrMap *M, bool LE)<br>
> - : DWARFUnit(DA, IS, RS, SS, SOS, AOS, M, LE) {}<br>
> + DWARFCompileUnit(DWARFContext& Context, const DWARFDebugAbbrev *DA,<br>
> + StringRef IS, StringRef RS, StringRef SS, StringRef SOS,<br>
> + StringRef AOS, const RelocAddrMap *M, bool LE)<br>
> + : DWARFUnit(Context, DA, IS, RS, SS, SOS, AOS, M, LE) {}<br>
> void dump(raw_ostream &OS);<br>
> // VTable anchor.<br>
> ~DWARFCompileUnit() override;<br>
><br>
> Modified: llvm/trunk/lib/DebugInfo/DWARFContext.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/DWARFContext.cpp?rev=217128&r1=217127&r2=217128&view=diff">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/DWARFContext.cpp?rev=217128&r1=217127&r2=217128&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/lib/DebugInfo/DWARFContext.cpp (original)<br>
> +++ llvm/trunk/lib/DebugInfo/DWARFContext.cpp Thu Sep 4 01:14:28 2014<br>
> @@ -318,7 +318,7 @@ void DWARFContext::parseCompileUnits() {<br>
> const DataExtractor &DIData = DataExtractor(getInfoSection().Data,<br>
> isLittleEndian(), 0);<br>
> while (DIData.isValidOffset(offset)) {<br>
> - std::unique_ptr<DWARFCompileUnit> CU(new DWARFCompileUnit(<br>
> + std::unique_ptr<DWARFCompileUnit> CU(new DWARFCompileUnit(*this,<br>
> getDebugAbbrev(), getInfoSection().Data, getRangeSection(),<br>
> getStringSection(), StringRef(), getAddrSection(),<br>
> &getInfoSection().Relocs, isLittleEndian()));<br>
> @@ -338,10 +338,10 @@ void DWARFContext::parseTypeUnits() {<br>
> const DataExtractor &DIData =<br>
> DataExtractor(I.second.Data, isLittleEndian(), 0);<br>
> while (DIData.isValidOffset(offset)) {<br>
> - std::unique_ptr<DWARFTypeUnit> TU(<br>
> - new DWARFTypeUnit(getDebugAbbrev(), I.second.Data, getRangeSection(),<br>
> - getStringSection(), StringRef(), getAddrSection(),<br>
> - &I.second.Relocs, isLittleEndian()));<br>
> + std::unique_ptr<DWARFTypeUnit> TU(new DWARFTypeUnit(*this,<br>
> + getDebugAbbrev(), I.second.Data, getRangeSection(),<br>
> + getStringSection(), StringRef(), getAddrSection(),<br>
> + &I.second.Relocs, isLittleEndian()));<br>
> if (!TU->extract(DIData, &offset))<br>
> break;<br>
> TUs.push_back(std::move(TU));<br>
> @@ -357,7 +357,7 @@ void DWARFContext::parseDWOCompileUnits(<br>
> const DataExtractor &DIData =<br>
> DataExtractor(getInfoDWOSection().Data, isLittleEndian(), 0);<br>
> while (DIData.isValidOffset(offset)) {<br>
> - std::unique_ptr<DWARFCompileUnit> DWOCU(new DWARFCompileUnit(<br>
> + std::unique_ptr<DWARFCompileUnit> DWOCU(new DWARFCompileUnit(*this,<br>
> getDebugAbbrevDWO(), getInfoDWOSection().Data, getRangeDWOSection(),<br>
> getStringDWOSection(), getStringOffsetDWOSection(), getAddrSection(),<br>
> &getInfoDWOSection().Relocs, isLittleEndian()));<br>
> @@ -377,7 +377,7 @@ void DWARFContext::parseDWOTypeUnits() {<br>
> const DataExtractor &DIData =<br>
> DataExtractor(I.second.Data, isLittleEndian(), 0);<br>
> while (DIData.isValidOffset(offset)) {<br>
> - std::unique_ptr<DWARFTypeUnit> TU(new DWARFTypeUnit(<br>
> + std::unique_ptr<DWARFTypeUnit> TU(new DWARFTypeUnit(*this,<br>
> getDebugAbbrevDWO(), I.second.Data, getRangeDWOSection(),<br>
> getStringDWOSection(), getStringOffsetDWOSection(), getAddrSection(),<br>
> &I.second.Relocs, isLittleEndian()));<br>
><br>
> Modified: llvm/trunk/lib/DebugInfo/DWARFTypeUnit.h<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/DWARFTypeUnit.h?rev=217128&r1=217127&r2=217128&view=diff">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/DWARFTypeUnit.h?rev=217128&r1=217127&r2=217128&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/lib/DebugInfo/DWARFTypeUnit.h (original)<br>
> +++ llvm/trunk/lib/DebugInfo/DWARFTypeUnit.h Thu Sep 4 01:14:28 2014<br>
> @@ -19,10 +19,10 @@ private:<br>
> uint64_t TypeHash;<br>
> uint32_t TypeOffset;<br>
> public:<br>
> - DWARFTypeUnit(const DWARFDebugAbbrev *DA, StringRef IS, StringRef RS,<br>
> - StringRef SS, StringRef SOS, StringRef AOS,<br>
> - const RelocAddrMap *M, bool LE)<br>
> - : DWARFUnit(DA, IS, RS, SS, SOS, AOS, M, LE) {}<br>
> + DWARFTypeUnit(DWARFContext &Context, const DWARFDebugAbbrev *DA,<br>
> + StringRef IS, StringRef RS, StringRef SS, StringRef SOS,<br>
> + StringRef AOS, const RelocAddrMap *M, bool LE)<br>
> + : DWARFUnit(Context, DA, IS, RS, SS, SOS, AOS, M, LE) {}<br>
> uint32_t getHeaderSize() const override {<br>
> return DWARFUnit::getHeaderSize() + 12;<br>
> }<br>
><br>
> Modified: llvm/trunk/lib/DebugInfo/DWARFUnit.cpp<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/DWARFUnit.cpp?rev=217128&r1=217127&r2=217128&view=diff">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/DWARFUnit.cpp?rev=217128&r1=217127&r2=217128&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/lib/DebugInfo/DWARFUnit.cpp (original)<br>
> +++ llvm/trunk/lib/DebugInfo/DWARFUnit.cpp Thu Sep 4 01:14:28 2014<br>
> @@ -17,12 +17,12 @@<br>
> using namespace llvm;<br>
> using namespace dwarf;<br>
><br>
> -DWARFUnit::DWARFUnit(const DWARFDebugAbbrev *DA, StringRef IS, StringRef RS,<br>
> - StringRef SS, StringRef SOS, StringRef AOS,<br>
> - const RelocAddrMap *M, bool LE)<br>
> - : Abbrev(DA), InfoSection(IS), RangeSection(RS), StringSection(SS),<br>
> - StringOffsetSection(SOS), AddrOffsetSection(AOS), RelocMap(M),<br>
> - isLittleEndian(LE) {<br>
> +DWARFUnit::DWARFUnit(DWARFContext &DC, const DWARFDebugAbbrev *DA,<br>
> + StringRef IS, StringRef RS, StringRef SS, StringRef SOS,<br>
> + StringRef AOS, const RelocAddrMap *M, bool LE)<br>
> + : Context(DC), Abbrev(DA), InfoSection(IS), RangeSection(RS),<br>
> + StringSection(SS), StringOffsetSection(SOS), AddrOffsetSection(AOS),<br>
> + RelocMap(M), isLittleEndian(LE) {<br>
> clear();<br>
> }<br>
><br>
><br>
> Modified: llvm/trunk/lib/DebugInfo/DWARFUnit.h<br>
> URL: <a href="http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/DWARFUnit.h?rev=217128&r1=217127&r2=217128&view=diff">http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/DebugInfo/DWARFUnit.h?rev=217128&r1=217127&r2=217128&view=diff</a><br>
> ==============================================================================<br>
> --- llvm/trunk/lib/DebugInfo/DWARFUnit.h (original)<br>
> +++ llvm/trunk/lib/DebugInfo/DWARFUnit.h Thu Sep 4 01:14:28 2014<br>
> @@ -22,11 +22,14 @@ namespace object {<br>
> class ObjectFile;<br>
> }<br>
><br>
> +class DWARFContext;<br>
> class DWARFDebugAbbrev;<br>
> class StringRef;<br>
> class raw_ostream;<br>
><br>
> class DWARFUnit {<br>
> + DWARFContext &Context;<br>
> +<br>
> const DWARFDebugAbbrev *Abbrev;<br>
> StringRef InfoSection;<br>
> StringRef RangeSection;<br>
> @@ -63,12 +66,14 @@ protected:<br>
> virtual uint32_t getHeaderSize() const { return 11; }<br>
><br>
> public:<br>
> - DWARFUnit(const DWARFDebugAbbrev *DA, StringRef IS, StringRef RS,<br>
> - StringRef SS, StringRef SOS, StringRef AOS, const RelocAddrMap *M,<br>
> - bool LE);<br>
> + DWARFUnit(DWARFContext& Context, const DWARFDebugAbbrev *DA, StringRef IS,<br>
> + StringRef RS, StringRef SS, StringRef SOS, StringRef AOS,<br>
> + const RelocAddrMap *M, bool LE);<br>
><br>
> virtual ~DWARFUnit();<br>
><br>
> + DWARFContext& getContext() const { return Context; }<br>
> +<br>
> StringRef getStringSection() const { return StringSection; }<br>
> StringRef getStringOffsetSection() const { return StringOffsetSection; }<br>
> void setAddrOffsetSection(StringRef AOS, uint32_t Base) {<br>
><br>
><br>
> _______________________________________________<br>
> llvm-commits mailing list<br>
> <a href="mailto:llvm-commits@cs.uiuc.edu">llvm-commits@cs.uiuc.edu</a><br>
> <a href="http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits">http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits</a><br>
</p>