Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove leftover PX4_BACKTRACE #12107

Merged
merged 4 commits into from
Jun 5, 2019
Merged

Remove leftover PX4_BACKTRACE #12107

merged 4 commits into from
Jun 5, 2019

Conversation

julianoes
Copy link
Contributor

Remove PX4_BACKTRACE. This follows up #12099.

@julianoes julianoes requested a review from bkueng May 29, 2019 13:09
@dagar
Copy link
Member

dagar commented May 29, 2019

Verify we actually get a core now?

In the tests we can save any core files + exact binary and run gdb in batch to dump the backtrace for all threads in the output.

@julianoes
Copy link
Contributor Author

Verify we actually get a core now?

Let me try.

@julianoes
Copy link
Contributor Author

I had to remove the segfault handler to actually get core dumps working. @bkueng does that make sense?

I triggered a segfault like this:

diff --git a/src/modules/commander/Commander.cpp b/src/modules/commander/Commander.cpp
index 15a7c199d6..f3c887c633 100644
--- a/src/modules/commander/Commander.cpp
+++ b/src/modules/commander/Commander.cpp
@@ -326,6 +326,13 @@ int commander_main(int argc, char *argv[])
                return 0;
        }
 
+       if (!strcmp(argv[1], "segfault")) {
+
+               PX4_INFO("try to read something silly: %d.", *argv[70]);
+
+               return 0;
+       }
+
        /* commands needing the app to run below */
        if (!thread_running) {
                PX4_ERR("not started");

And of course I had to enable core files:

ulimit -c unlimited

And was able to get:

gdb build/px4_sitl_default/bin/px4 /tmp/core-px4.5491.fractal.1559196660 
GNU gdb (GDB) 8.3
Copyright (C) 2019 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-pc-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 build/px4_sitl_default/bin/px4...
[New LWP 5491]
[New LWP 5501]
[New LWP 5495]
[New LWP 5545]
[New LWP 5497]
[New LWP 5492]
[New LWP 5761]
[New LWP 5717]
[New LWP 5848]
[New LWP 5760]
[New LWP 5742]
[New LWP 5808]
[New LWP 5802]
[New LWP 5756]
[New LWP 5798]
[New LWP 5493]
[New LWP 5752]
[New LWP 5847]
[New LWP 5783]
[New LWP 5809]
[New LWP 5794]
[New LWP 5499]
[New LWP 5765]
[New LWP 5831]
[New LWP 5558]
[New LWP 5832]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".
Core was generated by `/home/julianoes/src/Firmware/build/px4_sitl_default/bin/px4 /home/julianoes/src'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x00005572a742460b in commander_main (argc=2, argv=0x7fff1f1825f0) at /home/julianoes/src/Firmware/src/modules/commander/Commander.cpp:331
331			PX4_INFO("try to read something silly: %d.", *argv[70]);
[Current thread is 1 (Thread 0x7ff4f14ae780 (LWP 5491))]
(gdb) bt
#0  0x00005572a742460b in commander_main (argc=2, argv=0x7fff1f1825f0) at /home/julianoes/src/Firmware/src/modules/commander/Commander.cpp:331
#1  0x00005572a75abfe4 in px4_daemon::Pxh::process_line (line="commander segfault", silently_fail=silently_fail@entry=false)
    at /usr/include/c++/8.3.0/bits/basic_string.h:390
#2  0x00005572a75ac651 in px4_daemon::Pxh::process_line (silently_fail=false, line="commander segfault")
    at /usr/include/c++/8.3.0/bits/basic_string.h:1031
#3  px4_daemon::Pxh::run_pxh (this=0x7fff1f182bc0) at /home/julianoes/src/Firmware/platforms/posix/src/px4_daemon/pxh.cpp:170
#4  0x00005572a73fc42a in main (argc=<optimized out>, argv=<optimized out>) at /home/julianoes/src/Firmware/platforms/posix/src/main.cpp:285
(gdb) quit

@bkueng
Copy link
Member

bkueng commented Jun 3, 2019

Can you also remove the definition of px4_backtrace, I don't think it's used anymore?

julianoes added 4 commits June 4, 2019 13:34
This hasn't been used in a while and didn't quite work with the
backtraces produced anyway.
I could not get a core dump without removing the segfault handler, hence
this change.
@julianoes julianoes force-pushed the pr-remove-px4-backtrace branch from db9223e to e2244c6 Compare June 4, 2019 11:41
@julianoes
Copy link
Contributor Author

@bkueng thanks, done in e2244c6.

@bkueng bkueng merged commit bece638 into master Jun 5, 2019
@bkueng bkueng deleted the pr-remove-px4-backtrace branch June 5, 2019 06:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants