From: Gabriel Corona Date: Fri, 7 Feb 2014 14:44:15 +0000 (+0100) Subject: [mc] Fix sefault where a variable has no name X-Git-Tag: v3_11~199^2~2^2~26^2~2 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/57d96d2cf3a593395ef6657f07c06b57dcdac400?ds=sidebyside [mc] Fix sefault where a variable has no name This happen when optimisation is enabled. As the current code needs a name for the variable, we generate a fake one. We might want to remove this assumption. --- diff --git a/src/mc/mc_dwarf.c b/src/mc/mc_dwarf.c index 84e42607ce..5839708020 100644 --- a/src/mc/mc_dwarf.c +++ b/src/mc/mc_dwarf.c @@ -795,6 +795,8 @@ static dw_location_t MC_dwarf_get_expression(Dwarf_Op* expr, size_t len) { return loc; } +static int mc_anonymous_variable_index = 0; + static dw_variable_t MC_die_to_variable(mc_object_info_t info, Dwarf_Die* die, Dwarf_Die* unit, dw_frame_t frame) { // Drop declaration: if (MC_dwarf_attr_flag(die, DW_AT_declaration, false)) @@ -848,6 +850,12 @@ static dw_variable_t MC_die_to_variable(mc_object_info_t info, Dwarf_Die* die, D klass, klass, (void*) variable->dwarf_offset, variable->name); } + // The current code needs a variable name, + // generate a fake one: + if(!variable->name) { + variable->name = bprintf("@anonymous#%i", mc_anonymous_variable_index++); + } + return variable; }