@@ -122,21 +122,22 @@ Utils::CStringUniquePtr EXEUtils::GetDirectoryPrefixFromExeName() {
122
122
}
123
123
124
124
#if !defined(DART_HOST_OS_WINDOWS)
125
- void EXEUtils::LoadDartProfilerSymbols (const char * exepath) {
126
- int len = strlen (exepath);
127
- char * sympath = reinterpret_cast <char *>(malloc (len + 5 ));
128
- memcpy (sympath, exepath, len); // NOLINT
129
- memcpy (sympath + len, " .sym" , 5 ); // NOLINT
130
- File* file = File::Open (nullptr , sympath, File::kRead );
131
- free (sympath);
132
- if (file != nullptr ) {
133
- int64_t size = file->Length ();
134
- MappedMemory* mapping = file->Map (File::kReadOnly , 0 , size);
135
- Dart_AddSymbols (exepath, mapping->address (), size);
136
- mapping->Leak (); // Let us delete the object but keep the mapping.
137
- delete mapping;
138
- file->Release ();
139
- }
125
+ void EXEUtils::LoadDartProfilerSymbols (const char * argv0) {
126
+ char * path = reinterpret_cast <char *>(malloc (PATH_MAX + 5 ));
127
+ if (Platform::ResolveExecutablePathInto (path, PATH_MAX) <= 0 ) return ;
128
+
129
+ int len = strlen (path);
130
+ memcpy (path + len, " .sym" , 5 ); // NOLINT
131
+ File* file = File::Open (nullptr , path, File::kRead );
132
+ free (path);
133
+ if (file == nullptr ) return ;
134
+
135
+ int64_t size = file->Length ();
136
+ MappedMemory* mapping = file->Map (File::kReadOnly , 0 , size);
137
+ Dart_AddSymbols (argv0, mapping->address (), size);
138
+ mapping->Leak (); // Let us delete the object but keep the mapping.
139
+ delete mapping;
140
+ file->Release ();
140
141
}
141
142
#endif // !defined(DART_HOST_OS_WINDOWS)
142
143
0 commit comments