File tree Expand file tree Collapse file tree 2 files changed +18
-1
lines changed Expand file tree Collapse file tree 2 files changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -471,6 +471,11 @@ class DebugStrOffsetsWriter {
471471 return std::move (StrOffsetsBuffer);
472472 }
473473
474+ StringRef bufferStr () {
475+ return StringRef (reinterpret_cast <const char *>(StrOffsetsBuffer->data ()),
476+ StrOffsetsBuffer->size ());
477+ }
478+
474479 // / Initializes Buffer and Stream.
475480 void initialize (DWARFUnit &Unit);
476481
@@ -507,6 +512,11 @@ class DebugStrWriter {
507512 return std::move (StrBuffer);
508513 }
509514
515+ StringRef bufferStr () {
516+ return StringRef (reinterpret_cast <const char *>(StrBuffer->data ()),
517+ StrBuffer->size ());
518+ }
519+
510520 // / Adds string to .debug_str.
511521 // / On first invocation it initializes internal data structures.
512522 uint32_t addString (StringRef Str);
Original file line number Diff line number Diff line change @@ -1833,6 +1833,8 @@ std::optional<StringRef> updateDebugData(
18331833 errs () << " BOLT-WARNING: unsupported debug section: " << SectionName
18341834 << " \n " ;
18351835 if (StrWriter.isInitialized ()) {
1836+ if (CUDWOEntry)
1837+ return StrWriter.bufferStr ();
18361838 OutputBuffer = StrWriter.releaseBuffer ();
18371839 return StringRef (reinterpret_cast <const char *>(OutputBuffer->data ()),
18381840 OutputBuffer->size ());
@@ -1847,6 +1849,8 @@ std::optional<StringRef> updateDebugData(
18471849 }
18481850 case DWARFSectionKind::DW_SECT_STR_OFFSETS: {
18491851 if (StrOffstsWriter.isFinalized ()) {
1852+ if (CUDWOEntry)
1853+ return StrOffstsWriter.bufferStr ();
18501854 OutputBuffer = StrOffstsWriter.releaseBuffer ();
18511855 return StringRef (reinterpret_cast <const char *>(OutputBuffer->data ()),
18521856 OutputBuffer->size ());
@@ -1961,7 +1965,10 @@ void DWARFRewriter::writeDWOFiles(
19611965 Expected<StringRef> ContentsExp = Section.getContents ();
19621966 assert (ContentsExp && " Invalid contents." );
19631967 if (IsDWP && SectionName == " debug_str.dwo" ) {
1964- StrDWOContent = *ContentsExp;
1968+ if (StrWriter.isInitialized ())
1969+ StrDWOContent = StrWriter.bufferStr ();
1970+ else
1971+ StrDWOContent = *ContentsExp;
19651972 continue ;
19661973 }
19671974 if (std::optional<StringRef> OutData = updateDebugData (
You can’t perform that action at this time.
0 commit comments