*
* The default for a given language is defined in the DWARF spec.
*
- * \param language consant as defined by the DWARf spec
+ * \param language constant as defined by the DWARf spec
*/
static uint64_t MC_dwarf_default_lower_bound(int lang);
* \param info the resulting object fot the library/binary file (output)
* \param die the current DIE
* \param unit the DIE of the compile unit of the current DIE
- * \param frame containg frame if any
+ * \param frame containing frame if any
*/
static void MC_dwarf_handle_die(simgrid::mc::ObjectInformation* info, Dwarf_Die * die,
Dwarf_Die * unit, simgrid::mc::Frame* frame,
Dwarf_Die * unit, simgrid::mc::Frame* frame,
const char *ns);
-/** \brief Calls MC_dwarf_handle_die on all childrend of the given die
+/** \brief Calls MC_dwarf_handle_die on all children of the given die
*
* \param info the resulting object fot the library/binary file (output)
* \param die the current DIE
* \param unit the DIE of the compile unit of the current DIE
- * \param frame containg frame if any
+ * \param frame containing frame if any
*/
static void MC_dwarf_handle_children(simgrid::mc::ObjectInformation* info, Dwarf_Die * die,
Dwarf_Die * unit, simgrid::mc::Frame* frame,
* \param info the resulting object fot the library/binary file (output)
* \param die the current DIE
* \param unit the DIE of the compile unit of the current DIE
- * \param frame containg frame if any
+ * \param frame containing frame if any
*/
static void MC_dwarf_handle_variable_die(simgrid::mc::ObjectInformation* info, Dwarf_Die * die,
Dwarf_Die * unit, simgrid::mc::Frame* frame,
if (boost::algorithm::starts_with(member.name, "__vptr$") ||
boost::algorithm::starts_with(member.name, "__vptr."))
member.flags |= simgrid::mc::Member::VIRTUAL_POINTER_FLAG;
- // A cleaner stolution would be to check against the type:
+ // A cleaner solution would be to check against the type:
// ---
// tag: DW_TAG_member
// name: "_vptr$Foo"
static
std::vector<char> get_build_id(Elf* elf)
{
+ // Summary: the GNU build ID is stored in a ("GNU, NT_GNU_BUILD_ID) note
+ // found in a PT_NOTE entry in the program header table.
+
size_t phnum;
if (elf_getphdrnum (elf, &phnum) != 0)
xbt_die("Could not read program headers");
* lists of types, variables, functions.
*/
static
-void MC_dwarf_get_variables(simgrid::mc::ObjectInformation* info)
+void MC_load_dwarf(simgrid::mc::ObjectInformation* info)
{
if (elf_version(EV_CURRENT) == EV_NONE)
xbt_die("libelf initialization error");
xbt_die("Could not open file %s", info->file_name.c_str());
Elf* elf = elf_begin(fd, ELF_C_READ, nullptr);
if (elf == nullptr)
- xbt_die("Not an ELF file 1");
+ xbt_die("Not an ELF file");
Elf_Kind kind = elf_kind(elf);
if (kind != ELF_K_ELF)
- xbt_die("Not an ELF file 2");
+ xbt_die("Not an ELF file");
- // Remember if this is a `ET_EXEC` (fixed location) or `ET_DYN` (relocatable):
+ // Remember if this is a `ET_EXEC` (fixed location) or `ET_DYN`:
Elf64_Half type = get_type(elf);
if (type == ET_EXEC)
info->flags |= simgrid::mc::ObjectInformation::Executable;
// TODO, try to find DWARF info using debug-link.
// Is this method really used anywhere?
+ elf_end(elf);
+ close(fd);
xbt_die("Debugging information not found for %s\n"
"Try recompiling with -g\n",
info->file_name.c_str());
std::make_shared<simgrid::mc::ObjectInformation>();
result->file_name = name;
simgrid::mc::find_object_address(maps, result.get());
- MC_dwarf_get_variables(result.get());
+ MC_load_dwarf(result.get());
MC_post_process_variables(result.get());
MC_post_process_types(result.get());
for (auto& entry : result.get()->subprograms)
*
* DWARF and libunwind does not use the same convention for numbering the
* registers on some architectures. The function makes the necessary
- * convertion.
+ * conversion.
*/
int dwarf_register_to_libunwind(int dwarf_register)
{
// It seems for this arch, DWARF and libunwind agree in the numbering:
return dwarf_register;
#elif defined(__i386__)
- // Could't find the authoritative source of information for this.
+ // Couldn't find the authoritative source of information for this.
// This is inspired from http://source.winehq.org/source/dlls/dbghelp/cpu_i386.c#L517.
switch (dwarf_register) {
case 0: