X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/2807fde4fd1f59c230d69a934634c5dfb77905f2..971c99d7a8f442d2690aa22b48bcda640f722113:/tools/generate-dwarf-functions diff --git a/tools/generate-dwarf-functions b/tools/generate-dwarf-functions index f47bec3c92..838d833f62 100755 --- a/tools/generate-dwarf-functions +++ b/tools/generate-dwarf-functions @@ -1,74 +1,69 @@ -#!/bin/sh +#!/usr/bin/env sh # Generate files from a given dwarf.h # Usage: tools/generate-dwarf-functions /usr/include/dwarf.h HEADER="\ -/* Copyright (c) 2014-$(date +%Y). The SimGrid Team. - * All rights reserved. */ +/* Copyright (c) 2014-$(date +%Y). The SimGrid Team. All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ /* Warning: autogenerated, do not edit! */ -#include -#include +#include \"src/mc/inspect/mc_dwarf.hpp\" -#include \"src/mc/mc_dwarf.hpp\"" +#include +#include " -cat - > src/mc/mc_dwarf_tagnames.cpp < src/mc/inspect/mc_dwarf_tagnames.cpp < tagname_map = { {0x00, "DW_TAG_invalid"}, -$(cat "$1" | grep DW_TAG_ | sed 's/.*\(DW_TAG_[^ ]*\) = \(0x[0-9a-f]*\).*/ {\2, "\1"},/') +$(sed -n 's/.*\(DW_TAG_[^ ]*\) = \(0x[0-9a-f]*\).*/ {\2, "\1"},/p' -- "$1") }; } -namespace simgrid { -namespace dwarf { +namespace simgrid::dwarf { -/** \brief Get the name of a dwarf tag (DW_TAG_*) from its code +/** @brief Get the name of a dwarf tag (DW_TAG_*) from its code * - * \param tag tag code (see the DWARF specification) - * \return name of the tag + * @param tag tag code (see the DWARF specification) + * @return name of the tag */ XBT_PRIVATE -const char *tagname(int tag) +const char* tagname(int tag) { auto name = tagname_map.find(tag); return name == tagname_map.end() ? "DW_TAG_unknown" : name->second; } -} -} +} // namespace simgrid::dwarf EOF -cat - > src/mc/mc_dwarf_attrnames.cpp << EOF +cat - > src/mc/inspect/mc_dwarf_attrnames.cpp << EOF $HEADER namespace { const std::unordered_map attrname_map = { -$(cat "$1" | grep DW_AT_ | sed 's/.*\(DW_AT_[^ ]*\) = \(0x[0-9a-f]*\).*/ {\2, "\1"},/') +$(sed -n 's/.*\(DW_AT_[^ ]*\) = \(0x[0-9a-f]*\).*/ {\2, "\1"},/p' -- "$1") }; } -namespace simgrid { -namespace dwarf { +namespace simgrid::dwarf { -/** \brief Get the name of an attribute (DW_AT_*) from its code +/** @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 + * @param attr attribute code (see the DWARF specification) + * @return name of the attribute */ XBT_PRIVATE -const char *attrname(int attr) +const char* attrname(int attr) { auto name = attrname_map.find(attr); return name == attrname_map.end() ? "DW_AT_unknown" : name->second; } -} -} +} // namespace simgrid::dwarf EOF