On some architectures gcc might introduce some "padding instructions"
at the end of the function (like on ppc64). So only assert we are at the
last instruction of backtracegen if on x86_64 native. In theory the assert
could even fail on that architectures, but in practice it doesn't and it
is a nice test to have.
Signed-off-by: Mark Wielaard <mjw@redhat.com>
+2013-12-21 Mark Wielaard <mjw@redhat.com>
+
+ * backtrace.c (callback_verify): Only assert that case 5 is the last
+ instruction of backtracegen on x86_64 native.
+
2013-12-18 Jan Kratochvil <jan.kratochvil@redhat.com>
Mark Wielaard <mjw@redhat.com>
mod = dwfl_addrmodule (dwfl, pc);
if (mod)
symname2 = dwfl_module_addrname (mod, pc);
- assert (symname2 == NULL || strcmp (symname2, "backtracegen") != 0);
+
+ // Note that the following assert might in theory even fail on x86_64,
+ // there is no guarantee that the compiler doesn't reorder the
+ // instructions or even inserts some padding instructions at the end
+ // (which apparently happens on ppc64).
+ if (is_x86_64_native)
+ assert (symname2 == NULL || strcmp (symname2, "backtracegen") != 0);
break;
}
}