segmentation fault
-
@JonB said in segmentation fault:
qDebug() << *mosq
gives error :-
/home/tdp0009/Teq_Projects/Aug_2019/HMI/Firmware/QT/12_oct_hmi/qt-mosquitto-master/mainwindow.cpp:54: note: 'qtmosq' is not derived from 'const QFlags<T>'
@JonB said in segmentation fault:
qDebug() << mosq->something
i tried following things and it output are '0'.
- qDebug() << mosq->connect_async(host.data(), port);
- qDebug() << mosq->loop_start();
- qDebug() << mosq->subscribe(NULL, "sensors/temprature", 1);
the output of all above command are zero (0).
@JonB said in segmentation fault:
app from inside a debugge
i am not able to run the debugger because it gives following error.
The inferior stopped because it received a signal from the Operating System. Signal name : SIGILL Signal meaning : Illegal instruction
hope you got your answer.
-
@JonB said in segmentation fault:
@jsulm
Indeedy :) So now let's see how qDebug() << *mosq fares?sorry the error is as following not previous one.
/home/tdp0009/Teq_Projects/Aug_2019/HMI/Firmware/QT/12_oct_hmi/qt-mosquitto-master/mainwindow.cpp:54: error: no match for 'operator<<' in 'qDebug()() << *((MainWindow*)this)->MainWindow::mosq'
-
@Milav
First you wroteand i debug the application via qDebug(), the application are crash on following line of code.
mosq->subscribe(NULL, "sensors/temprature", 1); // Segmentation falutNow you write
qDebug() << mosq->subscribe(NULL, "sensors/temprature", 1);
the output of all above command are zero (0).This is a problem if you say sometimes it seg faults and sometimes it returns 0? Is that the case? You need to be very specific in your answers!
i am not able to run the debugger because it gives following error.
That is indeed a big problem. There is little for us to answer from what you have posted. Is a debugger supposed to work for your "Embedded Custom Board" (I don't know about this)? You really need one. Otherwise you are likely to have to try printing out all sorts of information in your code to try to diagnose what is going on....
-
Can you try to run the app directly with gdb?
I know this is not the place for a long explanation. But when OP says
I make a qt application for Embedded Custom Board
I thought (knowing nothing about this) it meant he is doing something like )cross-)compiling of whatever but the app runs "on the board", so he might not have/be able to use a debugger? Can you explain to me in one sentence what the OP's enthronement actually is, I'd like to have the vaguest understanding....
-
@jsulm said in segmentation fault:
Forget about
qDebug() << *mosq;okay thank you.
@jsulm said in segmentation fault:
Can you try to run the app directly with gdb?
yes i tried but , debugger give me error,
the error is shown in below image.
-
i enter the gdb command as following .
tdp0009@tdp0009-desktop:~/Teq_Projects/Aug_2019/HMI/Firmware/QT/Desktop_Application/11-oct/qt-mqtt-example/build-qt-mosquitto-Desktop-Release$ gdb qt-mosquitto GNU gdb (Ubuntu 7.11.1-0ubuntu1~16.5) 7.11.1 Copyright (C) 2016 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-linux-gnu". Type "show configuration" for configuration details. For bug reporting instructions, please see: <http://www.gnu.org/software/gdb/bugs/>. Find the GDB manual and other documentation resources online at: <http://www.gnu.org/software/gdb/documentation/>. For help, type "help". Type "apropos word" to search for commands related to "word"... Reading symbols from qt-mosquitto...(no debugging symbols found)...done. (gdb) bt No stack. (gdb) No stack. (gdb)
-
thank you for your help.
i run gdb from development host machine.
here i send the output of that.
tdp0009@tdp0009-desktop:~/Teq_Projects/Aug_2019/HMI/Phytec_Toolchain/arm-cortexa8-linux-gnueabihf/bin$ ./arm-cortexa8-linux-gnueabihf-gdb GNU gdb (GDB) 7.5 Copyright (C) 2012 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "--host=i686-host-linux-gnu --target=arm-cortexa8-linux-gnueabihf". For bug reporting instructions, please see: <http://www.gnu.org/software/gdb/bugs/>. (gdb) target extended 192.168.5.52:2345 Remote debugging using 192.168.5.52:2345 (gdb) set remote exec-file /opt/milav/qt-mosquitto (gdb) run Starting program: Program received signal SIGILL, Illegal instruction. 0x404df208 in ?? () (gdb) bt #0 0x404df208 in ?? () Cannot access memory at address 0x0 #1 0x404092c0 in ?? () Cannot access memory at address 0x0 #2 0x404092c0 in ?? () Cannot access memory at address 0x0 Backtrace stopped: previous frame identical to this frame (corrupt stack?) (gdb)
i think you got what you want.
looking forward hearing from you.
-
@Milav said in segmentation fault:
i think you got what you want
Not really.
Did you build the app in debug mode? -
@Milav said in segmentation fault:
Link :- Ref. Link
Could it be possible that you run such example AS IS, I mean just download/clone the code and try such example without any change.
If you manage to make it work, then you'll have the foundation to start adapting it to whatever you need/desire.In addition, is there any compelling reason not to use the Qt MQTT module?
Have you try any of the Qt MQTT examples? -
@Pablo-J-Rogina said in segmentation fault:
In addition, is there any compelling reason not to use the Qt MQTT module?
Have you try any of the Qt MQTT examples?I use actually qt4.8.7 source for development so QMqtt is not build for this qt version, so that i do not use qmqtt class.
if you have any idea how to run QMqtt in qt 4.8.7 source than please tell me it is so helpful to me.
@Pablo-J-Rogina said in segmentation fault:
Could it be possible that you run such example AS IS, I mean just download/clone the code and try such example without any change.
If you manage to make it work, then you'll have the foundation to start adapting it to whatever you need/desire.i actually tried same as is code for pc development and that is work fine.
but when i cross compiling the code for embedded target board than it gives segmentation error,
the difference between host pc and Embedded target board is only QT source.
Host pc => qmake (qt version 5.4.0 )
Embedded target => qmake (qt version 4.8.7)hope you got my point.
if you have any query please tell me.
and please guys help me to sort out the problem.
i am also try another code for the same , but in that i have also suffer same problem.
Another code link :- link text