@@ -35,6 +35,8 @@ const char* DWP = "dwp";
3535// / Prints JSON containing
3636// / "relevant_binaries": an array of strings, trace-relative binary file names (or build-ids, for explicit-sources).
3737// / These are ELF files in the trace that our collected data is relevant to.
38+ // / "loaded_elf_binaries": an array of strings of absolute paths.
39+ // / These are the paths to all the loaded ELF objects mapped at any point in the trace, including both shared libraries and executables.
3840// / "external_debug_info": an array of objects, {"path":<path>, "build_id":<build-id>, "type":<type>}
3941// / These are ELF files in the filesystem that contain separate debuginfo. "build-id" is the
4042// / build-id of the file from whence it originated, as a string. "type" is the type of
@@ -1055,6 +1057,7 @@ static int sources(const iterable& binary_file_names,
10551057 unique_ptr<DebugDirManager>& debug_dirs,
10561058 bool is_explicit) {
10571059 vector<string> relevant_binary_names;
1060+ set<string> original_loaded_elf_names;
10581061 // Must be absolute.
10591062 set<string> file_names;
10601063 set<ExternalDebugInfo> external_debug_info;
@@ -1080,9 +1083,11 @@ static int sources(const iterable& binary_file_names,
10801083 LOG (info) << " Probably not an ELF file, skipping" ;
10811084 continue ;
10821085 }
1086+
10831087 if (!is_explicit) {
10841088 base_name (trace_relative_name);
10851089 }
1090+ original_loaded_elf_names.insert (original_name);
10861091 base_name (original_name);
10871092 Debugaltlink debugaltlink = reader.read_debugaltlink ();
10881093
@@ -1205,6 +1210,15 @@ static int sources(const iterable& binary_file_names,
12051210 i == relevant_binary_names.size () - 1 ? " " : " ," );
12061211 }
12071212 printf (" ],\n " );
1213+
1214+ printf (" \" loaded_elf_binaries\" : [\n " );
1215+ for (auto it = original_loaded_elf_names.begin (); it != original_loaded_elf_names.end (); ++it) {
1216+ printf (" \" %s\" %s\n " ,
1217+ json_escape (*it).c_str (),
1218+ std::next (it) == original_loaded_elf_names.end () ? " " : " ," );
1219+ }
1220+ printf (" ],\n " );
1221+
12081222 printf (" \" comp_dir_substitutions\" :{\n " );
12091223 for (size_t i = 0 ; i < output_comp_dir_substitutions.size (); ++i) {
12101224 auto & sub = output_comp_dir_substitutions[i];
0 commit comments