Ich kompilierte die App, die boost :: asio-Bibliothek verwendet, und testete sie auf meinem Zielsystem. Es funktioniert einwandfrei. Aber wenn ich versuche, meine app mit gdb zu debuggen, erhalte ich diese Meldung in GDB-Konsole:Segmentierungsfehler nur während GDB-Debugging
Program received signal SIGSEGV, Segmentation fault.
_dl_debug_initialize (ldbase=4294967292, ns=1996288212) at dl-debug.c:55
55 if (r->r_map == NULL || ldbase != 0)
Das Ergebnis ist das gleiche für Remote- und nativen Debuggen und für einige andere Boost-Bibliotheken (aber nicht für alle) . Nach der Suche nach Informationen, die hilfreich sein könnten, fand ich ähnliche Problem in diesem Dokument (S.63): http://support.garz-fricke.com/products/Santaro/Linux-Yocto/Releases/Yocto-jethro-5.1-r6859-0/GUF-Yocto-jethro-5.1-r6859-0-IMX6GUF-Manual.pdf Wie im Dokument erwähnt kann das Problem durch "Statische Instanziierung in implizit implementierten C++ Methoden" verursacht werden und ist mit glibc verbunden . Also habe ich versucht mit Code diesen Fehler durch diesen Ansatz zu reproduzieren:
#include <iostream>
using namespace std;
class AClass
{
public:
void foo()
{
static int NmbOfInvokes = 0;
NmbOfInvokes++;
cout << NmbOfInvokes << endl;
}
};
int main(void)
{
cout << "Hello World" << endl;
AClass anInstance;
anInstance.foo();
anInstance.foo();
return 0;
}
Dieses Programm funktioniert, aber bei der Fehlersuche nicht mit dem gleichen SIGSEGV Fehler.
es zu beheben genug Klasse AClass auf diese Weise neu zu schreiben:
class AClass
{
public:
void foo();
};
void AClass::foo()
{
static int NmbOfInvokes = 0;
NmbOfInvokes++;
cout << NmbOfInvokes << endl;
}
Die Kompilation Fahnen:
arm-poky-linux-gnueabi-g++ -march=armv7-a -mfloat-abi=hard -mfpu=neon -mtune=cortex-a7 --sysroot=/opt/fsl-imx-x11/4.1.15-1.2.0/sysroots/cortexa7hf-vfp-neon-poky-linux-gnueabi -DHAVE_CONFIG_H -I. -I.. --sysroot=/opt/fsl-imx-x11/4.1.15-1.2.0/sysroots/cortexa7hf-vfp-neon-poky-linux-gnueabi -g -O0 --sysroot=/opt/fsl-imx-x11/4.1.15-1.2.0/sysroots/cortexa7hf-vfp-neon-poky-linux-gnueabi -MT SegFault_Reproduce.o -MD -MP -MF .deps/SegFault_Reproduce.Tpo -c -o SegFault_Reproduce.o SegFault_Reproduce.cpp mv -f .deps/SegFault_Reproduce.Tpo .deps/SegFault_Reproduce.Po
../arm-poky-linux-gnueabi-libtool --tag=CXX --mode=link arm-poky-linux-gnueabi-g++ -march=armv7-a -mfloat-abi=hard -mfpu=neon -mtune=cortex-a7 --sysroot=/opt/fsl-imx-x11/4.1.15-1.2.0/sysroots/cortexa7hf-vfp-neon-poky-linux-gnueabi -g -O0 --sysroot=/opt/fsl-imx-x11/4.1.15-1.2.0/sysroots/cortexa7hf-vfp-neon-poky-linux-gnueabi --sysroot=/opt/fsl-imx-x11/4.1.15-1.2.0/sysroots/cortexa7hf-vfp-neon-poky-linux-gnueabi -o SegFault_Reproduce SegFault_Reproduce.o
arm-poky-linux-gnueabi-libtool: link: arm-poky-linux-gnueabi-g++ -march=armv7-a -mfloat-abi=hard -mfpu=neon -mtune=cortex-a7 --sysroot=/opt/fsl-imx-x11/4.1.15-1.2.0/sysroots/cortexa7hf-vfp-neon-poky-linux-gnueabi -g -O0 --sysroot=/opt/fsl-imx-x11/4.1.15-1.2.0/sysroots/cortexa7hf-vfp-neon-poky-linux-gnueabi --sysroot=/opt/fsl-imx-x11/4.1.15-1.2.0/sysroots/cortexa7hf-vfp-neon-poky-linux-gnueabi -o SegFault_Reproduce SegFault_Reproduce.o
Ich nehme an, dass die Symptome in einigen boost Bibliotheken ähnliche statische Instanciation verwendet werden, weil sind genau gleich.
Was kann ich tun, um die Möglichkeit zu erhalten, Boost-Anwendungen zu debuggen?
Die Versionen der Pakete, die ich verwendet habe: yocto 2.0.1, gcc 5.2.0, gdb 7.9.1, Boost 1.58.
@Employed_Russian, danke für die Antwort! 'set disable-randomization off' hat mir nicht geholfen, also werde ich eine neuere Version von GDB ausprobieren und über Ergebnisse berichten. –
@Employed_Russian, du hattest extrem Recht! Nach der Aktualisierung von GDB auf 7.11.1 ist mein Problem verschwunden. Danke vielmals! –