File tree Expand file tree Collapse file tree 2 files changed +20
-4
lines changed Expand file tree Collapse file tree 2 files changed +20
-4
lines changed Original file line number Diff line number Diff line change 9
9
#include " vm/elf.h"
10
10
#include " vm/image_snapshot.h"
11
11
#include " vm/object_store.h"
12
+ #include " vm/version.h"
12
13
13
14
namespace dart {
14
15
@@ -277,8 +278,9 @@ void Dwarf::WriteDebugInfo(DwarfWriteStream* stream) {
277
278
zone_, IsolateGroup::Current ()->object_store ()->root_library ());
278
279
const String& root_uri = String::Handle (zone_, root_library.url ());
279
280
stream->string (root_uri.ToCString ()); // DW_AT_name
280
- stream->string (" Dart VM" ); // DW_AT_producer
281
- stream->string (" " ); // DW_AT_comp_dir
281
+ const char * producer = zone_->PrintToString (" Dart %s\n " , Version::String ());
282
+ stream->string (producer); // DW_AT_producer
283
+ stream->string (" " ); // DW_AT_comp_dir
282
284
283
285
// DW_AT_low_pc
284
286
// The lowest instruction address in this object file that is part of our
Original file line number Diff line number Diff line change @@ -1029,8 +1029,22 @@ class DwarfAssemblyStream : public DwarfWriteStream {
1029
1029
void u8 (uint64_t value) {
1030
1030
stream_->Printf (" %s %" Pu64 " \n " , kSizeDirectives [kInt64SizeLog2 ], value);
1031
1031
}
1032
- void string (const char * cstr) { // NOLINT
1033
- stream_->Printf (" .string \" %s\"\n " , cstr); // NOLINT
1032
+ void string (const char * cstr) { // NOLINT
1033
+ stream_->WriteString (" .string \" " ); // NOLINT
1034
+ while (char c = *cstr++) {
1035
+ if (c == ' "' ) {
1036
+ stream_->WriteString (" \\\" " );
1037
+ } else if (c == ' \\ ' ) {
1038
+ stream_->WriteString (" \\\\ " );
1039
+ } else if (c == ' \n ' ) {
1040
+ stream_->WriteString (" \\ n" );
1041
+ } else if (c == ' \r ' ) {
1042
+ stream_->WriteString (" \\ r" );
1043
+ } else {
1044
+ stream_->WriteByte (c);
1045
+ }
1046
+ }
1047
+ stream_->WriteString (" \"\n " );
1034
1048
}
1035
1049
void WritePrefixedLength (const char * prefix, std::function<void ()> body) {
1036
1050
ASSERT (prefix != nullptr );
You can’t perform that action at this time.
0 commit comments