Commit Graph

187 Commits

Author SHA1 Message Date
Peter Barker
ca4af94833 AP_Logger: prevent potential infinite recursion in log-open codepath
If anything in start_new_log did logging (for example, by sending a
statustext), we end up infinitely recursing.

With the patch:

diff --git a/libraries/AP_Logger/AP_Logger_File.cpp b/libraries/AP_Logger/AP_Logger_File.cpp
index 69b8ef0431..eb422d10f8 100644
--- a/libraries/AP_Logger/AP_Logger_File.cpp
+++ b/libraries/AP_Logger/AP_Logger_File.cpp
@@ -778,6 +778,7 @@ void AP_Logger_File::PrepForArming()
  */
 void AP_Logger_File::start_new_log(void)
 {
+    gcs().send_text(MAV_SEVERITY_WARNING, "Starting new log");
     stop_logging();

     start_new_log_reset_variables();
pbarker@bluebottle:~/rc/ardupilot(master)$

We see:

    at ../../libraries/AP_Logger/AP_Logger_File.cpp:781
    this=0x555555ad9d30, pBuffer=0x7fffff8209d0, size=75, is_critical=true)
    at ../../libraries/AP_Logger/AP_Logger_Backend.cpp:372
    this=0x555555ad9d30, pBuffer=0x7fffff8209d0, size=75)
    at ../../libraries/AP_Logger/AP_Logger_Backend.h:32
    this=0x555555ad9d30, message=0x7fffff820b10 "Starting new log")
    at ../../libraries/AP_Logger/LogFile.cpp:466
    this=0x555555a6d758 <copter+11384>,
    message=0x7fffff820b10 "Starting new log")
    at ../../libraries/AP_Logger/AP_Logger.cpp:752
    this=0x555555a6e708 <copter+15400>, severity=MAV_SEVERITY_WARNING,
    fmt=0x5555557d64d0 "Starting new log", arg_list=0x7fffff820be0,
    dest_bitmask=1 '\001') at ../../libraries/GCS_MAVLink/GCS_Common.cpp:1847
    this=0x555555a6e708 <copter+15400>, severity=MAV_SEVERITY_WARNING,
    fmt=0x5555557d64d0 "Starting new log", arg_list=0x7fffff820be0)
    at ../../libraries/GCS_MAVLink/GCS.cpp:53
    this=0x555555a6e708 <copter+15400>, severity=MAV_SEVERITY_WARNING,
    fmt=0x5555557d64d0 "Starting new log")
    at ../../libraries/GCS_MAVLink/GCS.cpp:60
    at ../../libraries/AP_Logger/AP_Logger_File.cpp:781
    this=0x555555ad9d30, pBuffer=0x7fffff820dc0, size=75, is_critical=true)
    at ../../libraries/AP_Logger/AP_Logger_Backend.cpp:372

I'm not aware of any instances in the code where this will actually
happen - but it could easily sneak in.
2020-05-11 15:12:36 +10:00
Peter Barker
7befe84f0c AP_Logger: create and use INTERNAL_ERROR macro so we get line numbers 2020-04-30 13:21:36 +10:00
Peter Barker
ad9493caca AP_Logger: use logger Write method for logging Solo gimbal
Also document the messages
2020-04-28 09:56:09 +10:00
Peter Barker
830176f2f4 AP_Logger: remove unused SBFE 2020-04-27 16:16:50 +10:00
Peter Barker
f882bd0c3e AP_Logger: remove unused UBY1/UBY2 messages
These appear to have been replaced with instance fields on the UBX1 and
UBX2 messages.

Also mark the Instance field on UBX1, UBX2 as an instance field.
2020-04-26 11:35:04 +10:00
Peter Barker
7e3c9c209e AP_Logger: document GPSB and GPAB 2020-04-26 09:02:39 +10:00
Peter Barker
eee0f028ba AP_Logger: fix examples
Having a valid AP_Scheduler is now a requirement
2020-04-23 11:33:41 +09:00
Peter Barker
a83c25cfa7 AP_Logger: add documentation for EKF messages
NKF0, NKF1, NKF2, NKF3, NKF4, NKF5, NKQ

XKF0, XKF1, XKF2, XKF3, XKF4, XKF5, XKFD, XKQ, XKV1, XKV2
2020-04-21 09:48:43 +10:00
Mark Whitehorn
874c293911 AP_Logger: expand description of GPS.spd 2020-04-18 15:33:43 +10:00
Peter Barker
870159c14f AP_Logger: add times-full to MAV log structure 2020-04-17 22:21:14 +10:00
Peter Barker
908dfa58f3 AP_Logger: remove unused FORMATS stage in DFLogStart messagewriter 2020-04-17 21:42:15 +10:00
Peter Barker
678d6f43c5 AP_Logger: use existing LoggerMessageWriter to log uploaded missions
Instead of creating a MessageWriter explicitly to log uploaded missions
we fiddle the state of the one stored in the startup message writer.

This has the advantage of being much more likely to log the entire
mission (as the buffer constraint is removed), and with the addition of
a time-remaining check much less likely to cause a timing glitch.
2020-04-15 16:24:40 +10:00
Peter Barker
d8582d864a AP_Logger: convert Solo gimbal messages to TimeUS from TimeMS
Also remove unused gimbal3 message entirely
2020-04-15 16:11:04 +10:00
Peter Barker
acba2a78f6 AP_Logger: add message validation check against duplicate labels 2020-04-14 12:30:58 +10:00
Randy Mackay
4f639481c1 AP_Logger: VISP msg adds reset_counter 2020-04-14 10:28:03 +10:00
Peter Barker
767c010332 AP_Logger: add documentation for WENC, CESC, PRX, ADSB, BCN, BCL, OABR, OADF 2020-04-14 07:34:59 +10:00
Peter Barker
c3b8db95b8 AP_Logger: add DSTL log message documentation 2020-04-12 08:36:48 +10:00
Randy Mackay
c0187fe05f AP_Logger: add log message description for VISO 2020-04-09 19:41:08 +09:00
Randy Mackay
f18be824ea AP_Logger: add VISP message 2020-04-09 19:41:08 +09:00
chobits
63320f140a AP_Logger: constraints time spend in header writing, more complete 2020-04-09 19:17:17 +10:00
chobits
b829384fdf AP_Logger: constraints time spended in header writing 2020-04-09 19:17:17 +10:00
murata
f83f6c71e4 AP_Logger: const extern hal reference 2020-04-07 20:45:51 +09:00
murata
264a90bb45 AP_Logger: Change to coding style (NFC)
AP_Logger: Change to coding style (NFC)
2020-04-07 20:37:33 +09:00
Rishabh
76b4e42bca AP_Logger: Logger documentation TimeUS and typo fix 2020-04-07 18:57:01 +10:00
Peter Barker
2ed550966d AP_Logger: correct units for velocity on OF log message 2020-04-06 10:46:45 +10:00
Peter Barker
33f17d7739 AP_Logger: document ARSP,ASP2,CAM,TRIG,POWR,TERR,CSV,CMD,OF,AHR2 2020-04-06 10:46:45 +10:00
Peter Barker
3fb61c4cf0 AP_Logger: add documentation for more log messages
ERR,DSF,EV,SIM,ORGN,POS,LGR,MON,TSYN,IMU,IMUT
2020-04-05 12:49:19 +10:00
Peter Barker
09152cd254 AP_Logger: correct time field name on DMS 2020-04-05 12:49:19 +10:00
Peter Barker
50c60aa8f2 AP_Logger: add documentation for ACC1,ACC2,ACC3,DMS,GPA,GPA2,GPS2,GYR1,GYR2,GYR3,MAVC,PM 2020-04-05 10:12:03 +10:00
Peter Barker
a92206d090 AP_Logger: log dataflash-over-mavlink timestamp in micros rather than millis
... like the vast majority of our dataflash messages
2020-04-05 10:10:49 +10:00
Peter Barker
e41ea5a273 AP_Logger: add docco for BAR2,BAR3,MSG,RAD,RALY,RFND,RPM,RSSI 2020-04-04 10:05:15 +11:00
Peter Barker
1770199c41 AP_Logger: add documentation for MAV and PARM 2020-04-01 10:13:03 +11:00
Peter Barker
be6ed0be9f AP_Logger: add stream_slowdown to MAV message 2020-03-31 11:13:11 +11:00
Peter Barker
8a28fa2244 AP_Logger: rename struct log_NKF2a to log_XKF2 2020-03-31 10:25:59 +11:00
Peter Barker
aeb45bf146 AP_Logger: fix extremely unlikely nullptr dereference in SITL sanity checks 2020-03-29 08:07:29 +11:00
Andrew Tridgell
b5cc1f236a AP_Logger: use new DirHandle for directory listings 2020-03-28 15:28:03 +11:00
Peter Barker
7f0e722a33 AP_Logger: add onboard LogMessage documentation 2020-03-27 08:05:53 +11:00
Henry Wurzburg
c34c857123 AP_Logger: update logger meta-data, add to gitignore 2020-03-25 14:20:53 +11:00
Peter Barker
35ad582440 AP_Logger: correct various onboard log message documentation 2020-03-22 18:35:14 +11:00
Henry Wurzburg
7bb5d92dcc AP_Logger: fix typos in logger message meta-data 2020-03-22 10:04:53 +11:00
Peter Barker
fa50b5f76d AP_Logger: add more metadata for logged messages
LogStructure: add MAG log information

LogStructure: add MODE log information

LogStructure: add PID log information

AP_Logger: add ATT information

AP_Logger: add documentation for BAT log message

LogStructure: add RCIN and RCOU messages

AP_Logger: add VIBE message information
2020-03-21 09:34:43 +11:00
Peter Barker
de36b6a16a AP_Logger: add LoggerMessage metadata for GPS message 2020-03-20 13:05:46 +11:00
Peter Barker
55ee3362b9 AP_Logger: add example of documentation for a log structure 2020-03-20 13:05:46 +11:00
Peter Barker
8679e95fca AP_Logger: add comments about message_writer being leaked
These are really "shouldn't happen", and only happen at startup, so
impact of the memory leak is quite limited.

Fixing this requires putting in a virtual destructor on the
MessageWriter class - this and the calls add up to several hundred bytes
of flash.
2020-03-12 15:10:42 +11:00
Andrew Tridgell
ed37ebede8 AP_Logger: convert to new get_rpm() API 2020-03-12 08:36:40 +11:00
Randy Mackay
2ee5f9dcc5 AP_Logger: ARM msg logs ArmChecks as uint32_t 2020-02-25 19:55:54 +09:00
Peter Barker
10c9bc3659 AP_Logger: add flags to MAV dataflash log
holds various pieces of simple information about a link
2020-02-25 10:59:22 +11:00
Peter Hall
7bef426531 AP_Logger: EKF4 change flags state from uint16_t to uint32_t 2020-02-19 06:45:07 +11:00
murata
f6595a41ae AP_Logger: Change the type of a method 2020-01-22 12:45:27 +11:00
Andrew Tridgell
71a0645a59 AP_Logger: make all semaphores recursive
the cost is very similar and this prevents an easy coding error which
can occur on less used code paths
2020-01-19 20:19:30 +11:00