#include "mc_object_info.h"
#include "mc_private.h"
+#include "mc_dwarf.hpp"
#include "mc/Process.hpp"
#include "mc/ObjectInformation.hpp"
RangeListPtr
};
-namespace {
-
+XBT_PRIVATE
TagClass classify_tag(int tag)
{
switch (tag) {
* \param form The form (values taken from the DWARF spec)
* \return An internal representation for the corresponding class
* */
+XBT_PRIVATE
FormClass classify_form(int form)
{
switch (form) {
}
}
-}
-}
-}
-
/** \brief Get the name of the tag of a given DIE
*
* \param die DIE
* \return name of the tag of this DIE
*/
-static inline const char *MC_dwarf_die_tagname(Dwarf_Die * die)
+inline XBT_PRIVATE
+const char *tagname(Dwarf_Die * die)
{
- return MC_dwarf_tagname(dwarf_tag(die));
+ return simgrid::dwarf::tagname(dwarf_tag(die));
+}
+
+}
}
// ***** Attributes
bool result;
if (dwarf_formflag(&attr, &result))
- xbt_die("Unexpected form for attribute %s", MC_dwarf_attrname(attribute));
+ xbt_die("Unexpected form for attribute %s",
+ simgrid::dwarf::attrname(attribute));
return result;
}
xbt_assert(dwarf_tag(die) == DW_TAG_enumeration_type
|| dwarf_tag(die) == DW_TAG_subrange_type,
"MC_dwarf_subrange_element_count called with DIE of type %s",
- MC_dwarf_die_tagname(die));
+ simgrid::dwarf::tagname(die));
// Use DW_TAG_count if present:
if (dwarf_hasattr_integrate(die, DW_AT_count))
{
xbt_assert(dwarf_tag(die) == DW_TAG_array_type,
"MC_dwarf_array_element_count called with DIE of type %s",
- MC_dwarf_die_tagname(die));
+ simgrid::dwarf::tagname(die));
int result = 1;
Dwarf_Die child;
#include "mc/Variable.hpp"
#include "mc/mc_memory_map.h"
+namespace simgrid {
+namespace dwarf {
+
+XBT_PRIVATE const char* attrname(int attr);
+XBT_PRIVATE const char* tagname(int tag);
+
+}
+}
+
XBT_PRIVATE std::shared_ptr<simgrid::mc::ObjectInformation> MC_find_object_info(
std::vector<simgrid::mc::VmMap> const& maps, const char* name, int executable);
XBT_PRIVATE void MC_post_process_object_info(simgrid::mc::Process* process, simgrid::mc::ObjectInformation* info);
XBT_PRIVATE void MC_dwarf_get_variables(simgrid::mc::ObjectInformation* info);
XBT_PRIVATE void MC_dwarf_get_variables_libdw(simgrid::mc::ObjectInformation* info);
-XBT_PRIVATE const char* MC_dwarf_attrname(int attr);
-XBT_PRIVATE const char* MC_dwarf_tagname(int tag);
-
XBT_PRIVATE void* mc_member_resolve(
const void* base, simgrid::mc::Type* type, simgrid::mc::Member* member,
simgrid::mc::AddressSpace* snapshot, int process_index);
/* Warning: autogenerated, do not edit! */
-#include <xbt/base.h>
#include <dwarf.h>
-#include "mc_object_info.h"
+#include <xbt/base.h>
+
+namespace simgrid {
+namespace dwarf {
/** \brief Get the name of an attribute (DW_AT_*) from its code
*
* \param attr attribute code (see the DWARF specification)
* \return name of the attribute
*/
-const char *MC_dwarf_attrname(int attr)
+XBT_PRIVATE
+const char *attrname(int attr)
{
switch (attr) {
case 0x01: return "DW_AT_sibling";
return "DW_AT_unknown";
}
}
+
+}
+}
#include <elfutils/libdw.h>
#include <xbt/base.h>
-#include "mc_object_info.h"
+
+namespace simgrid {
+namespace dwarf {
/** \brief Get the name of a dwarf tag (DW_TAG_*) from its code
*
* \return name of the tag
*/
XBT_PRIVATE
-const char *MC_dwarf_tagname(int tag)
+const char *tagname(int tag)
{
switch (tag) {
case 0x01: return "DW_TAG_array_type";
return "DW_TAG_unknown";
}
}
+
+}
+}
XBT_PRIVATE void MC_dwarf_get_variables(simgrid::mc::ObjectInformation* info);
XBT_PRIVATE void MC_dwarf_get_variables_libdw(simgrid::mc::ObjectInformation* info);
-XBT_PRIVATE const char* MC_dwarf_attrname(int attr);
-XBT_PRIVATE const char* MC_dwarf_tagname(int tag);
-
#endif
# Usage: tools/generate-dwarf-functions /usr/include/dwarf.h
cat - > src/mc/mc_dwarf_tagnames.cpp <<EOF
-/* Copyright (c) 2014. The SimGrid Team.
+/* Copyright (c) 2014-2015. The SimGrid Team.
* All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
#include <elfutils/libdw.h>
#include <xbt/base.h>
-#include "mc_object_info.h"
+
+namespace simgrid {
+namespace dwarf {
/** \brief Get the name of a dwarf tag (DW_TAG_*) from its code
*
* \return name of the tag
*/
XBT_PRIVATE
-const char *MC_dwarf_tagname(int tag)
+const char *tagname(int tag)
{
switch (tag) {
$(cat "$1" | grep DW_TAG_ | sed 's/.*\(DW_TAG_[^ ]*\) = \(0x[0-9a-f]*\).*/ case \2: return "\1";/')
return "DW_TAG_unknown";
}
}
+
+}
+}
EOF
cat - > src/mc/mc_dwarf_attrnames.cpp << EOF
-/* Copyright (c) 2014. The SimGrid Team.
+/* Copyright (c) 2014-2015. The SimGrid Team.
* All rights reserved. */
/* This program is free software; you can redistribute it and/or modify it
/* Warning: autogenerated, do not edit! */
-#include <xbt/base.h>
#include <dwarf.h>
-#include "mc_object_info.h"
+#include <xbt/base.h>
+
+namespace simgrid {
+namespace dwarf {
/** \brief Get the name of an attribute (DW_AT_*) from its code
*
* \param attr attribute code (see the DWARF specification)
* \return name of the attribute
*/
-const char *MC_dwarf_attrname(int attr)
+XBT_PRIVATE
+const char *attrname(int attr)
{
switch (attr) {
$(cat "$1" | grep DW_AT_ | sed 's/.*\(DW_AT_[^ ]*\) = \(0x[0-9a-f]*\).*/ case \2: return "\1";/')
return "DW_AT_unknown";
}
}
+
+}
+}
EOF