From 8ae0f44a75b4c75d4090144d460b6a55d7b01720 Mon Sep 17 00:00:00 2001 From: Mateusz Daniluk <121170681+VeithMetro@users.noreply.github.com> Date: Thu, 16 Nov 2023 12:24:14 +0100 Subject: [PATCH 1/4] Adding a missing Closing of the new messaging redirect feature (#1452) --- Source/WPEFramework/PluginHost.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Source/WPEFramework/PluginHost.cpp b/Source/WPEFramework/PluginHost.cpp index cb191984a..0fb5421b6 100644 --- a/Source/WPEFramework/PluginHost.cpp +++ b/Source/WPEFramework/PluginHost.cpp @@ -227,6 +227,10 @@ POP_WARNING() #endif Messaging::MessageUnit::Instance().Close(); + Messaging::ConsoleStandardError::Instance().Close(); + if (_background == true) { + Messaging::ConsoleStandardOut::Instance().Close(); + } #ifndef __WINDOWS__ if (_background) { From 1b16edcd085c1d0c743aa629323e169e03f759ec Mon Sep 17 00:00:00 2001 From: Bram Oosterhuis Date: Fri, 17 Nov 2023 15:09:38 +0100 Subject: [PATCH 2/4] Update vscode configs (#1451) Co-authored-by: Pierre Wielders --- .vscode/launch.json | 90 +++++++++++++++++++++++++++++++++++-------- .vscode/settings.json | 1 + .vscode/tasks.json | 32 +++++++++++++++ 3 files changed, 106 insertions(+), 17 deletions(-) diff --git a/.vscode/launch.json b/.vscode/launch.json index 156004570..642743fb0 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -21,10 +21,7 @@ }, "externalConsole": false, "linux": { - "name": "Local Debug WPEFramework on Linux", "program": "${config:thunder.installPath}/usr/bin/WPEFramework", - "type":"cppdbg", - "request": "launch", "MIMode": "gdb", "miDebuggerPath": "gdb", "setupCommands": [ @@ -34,11 +31,16 @@ "ignoreFailures": true } ], - "sourceFileMap": { - }, + "sourceFileMap": {}, "environment": [ - { "name": "LD_LIBRARY_PATH", "value": "${config:thunder.installPath}/usr/lib" }, - { "name": "PATH", "value": "${config:thunder.installPath}/usr/bin"}, + { + "name": "LD_LIBRARY_PATH", + "value": "${config:thunder.installPath}/usr/lib" + }, + { + "name": "PATH", + "value": "${config:thunder.installPath}/usr/bin" + }, ], "additionalSOLibSearchPath": "${config:thunder.installPath}/usr/lib;/usr/local/lib;/usr/lib;/lib", }, @@ -55,21 +57,17 @@ "trace": false, "traceResponse": false, "engineLogging": false, - }, + }, "linux": { - "name": "Remote Debug WPEFramework on Linux", "program": "${config:thunder.installPath}/usr/bin/WPEFramework", - "type":"cppdbg", - "request": "launch", "MIMode": "gdb", "miDebuggerServerAddress": "${config:thunder.remoteTargetHost}:${config:thunder.remoteTargetDebugPort}", "miDebuggerPath": "${config:thunder.crossToolsPath}/${config:thunder.crossToolsPrefix}gdb", "miDebuggerArgs": "", "setupCommands": [ - {"text": "-enable-pretty-printing"}, - // commands if gdbserver is started with --multi - // {"text": "target extended-remote ${config:thunder.remoteTargetHost}:${config:thunder.remoteTargetDebugPort}"}, - // {"text": "set remote exec-file WPEFramework"} + { + "text": "-enable-pretty-printing" + }, ], "sourceFileMap": { // "remote": "local" @@ -80,6 +78,64 @@ "preLaunchTask": "Prepare WPEFramework for remote gdb debugging", "postDebugTask": "Clean debugging run" } - } + }, + // Start GBD on target with: + // sshpass -v -p ssh -t :
"killall -9 gdbserver; gdbserver --multi :55550" + // or with a certificate: + // ssh -i -t :
"killall -9 gdbserver; gdbserver --multi :55550" + { + "name": "Remote GDB (multi) Launch", + "type": "cppdbg", + "request": "launch", + "program": "${config:thunder.installPath}/usr/bin/WPEFramework-1.0.0", + "cwd": "${workspaceFolder}", + "environment": [], + "externalConsole": false, + "stopAtEntry": false, + "targetArchitecture": "arm", + "MIMode": "gdb", + "miDebuggerPath": "${config:thunder.crossToolsPath}/${config:thunder.crossToolsPrefix}gdb", + "miDebuggerServerAddress": "${config:thunder.remoteTargetHost}:${config:thunder.remoteTargetDebugPort}", + "setupCommands": [ + { + "description": "Enable pretty-printing for gdb", + "text": "-enable-pretty-printing", + "ignoreFailures": true + }, + ], + "customLaunchSetupCommands": [ + { + "text": "file ${config:thunder.installPath}/usr/bin/WPEFramework-1.0.0", + "description": "Load symbols", + "ignoreFailures": false + }, + { + "text": "target extended-remote ${config:thunder.remoteTargetHost}:${config:thunder.remoteTargetDebugPort}", + "description": "Connect to gdbserver", + "ignoreFailures": false + }, + { + "text": "remote put ${config:thunder.installPath}/usr/bin/WPEFramework-1.0.0 /usr/bin/WPEFramework-1.0.0", + "description": "Copy the locally cross-compiled executable to the target", + "ignoreFailures": false + }, + { + "text": "set remote exec-file /usr/bin/WPEFramework-1.0.0", + "description": "Set the executable to be debugged", + "ignoreFailures": false + }, + { + "text": "set args -c/etc/WPEFramework/config.json", + "description": "Set Arguments for the executable", + "ignoreFailures": false + }, + { + "text": "tbreak main", + "description": "Set temporary breakpoint @main()", + "ignoreFailures": false + } + ], + "launchCompleteCommand": "exec-run" + }, ] -} +} \ No newline at end of file diff --git a/.vscode/settings.json b/.vscode/settings.json index cbc4fb43a..3eeb0d10c 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -4,5 +4,6 @@ "PORT":"55555", "BINDING":"127.0.0.1", "IDLE_TIME":"180", + "BUILD_SHARED_LIBS" : "ON" } } \ No newline at end of file diff --git a/.vscode/tasks.json b/.vscode/tasks.json index 76f58d55b..feaf439dc 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -93,6 +93,38 @@ "focus": true, "close": true } + }, + { + "label": "Start multi gdbserver", + "type": "process", + "command": "ssh", + "args": [ + "-i", + "${config:thunder.remoteTargetID}", + "${config:thunder.remoteTargetUser}@${config:thunder.remoteTargetHost}", + "killall -9 gdbserver; gdbserver --multi :55550" + ], + "isBackground": true, + "problemMatcher": { + "pattern": { + "regexp": ".*", + "file": 1, + "line": 1, + "message": 1 + }, + "background": { + "activeOnStart": true, + "beginsPattern": "^.*Listening on port*", + "endsPattern": "^.*" + } + }, + "presentation": { + "reveal": "always", + "panel": "dedicated", + "clear": true, + "focus": true, + "close": true + } } ], } \ No newline at end of file From df3a4a1c45f19c5304c03b75d4b959aeac2c3293 Mon Sep 17 00:00:00 2001 From: msieben <4319079+msieben@users.noreply.github.com> Date: Wed, 22 Nov 2023 11:57:16 +0100 Subject: [PATCH 3/4] [docs]: Add 'Time' documentation. (#1432) * [docs]: Add 'Time' documentation. METROL-847 * [docs]: Update 'Time' documentation. METROL-847 and PR-1432 --------- Co-authored-by: Pierre Wielders Co-authored-by: Wouter Meek Co-authored-by: MFransen69 <39826971+MFransen69@users.noreply.github.com> --- docs/utils/time.md | 60 ++++++++++++++++++++++++++++++++++++++++++++++ mkdocs.yml | 1 + 2 files changed, 61 insertions(+) create mode 100644 docs/utils/time.md diff --git a/docs/utils/time.md b/docs/utils/time.md new file mode 100644 index 000000000..aeef6f798 --- /dev/null +++ b/docs/utils/time.md @@ -0,0 +1,60 @@ +# Time + +Time as a non-constant continues to progress while existence of various events is being linked to each instance of time irrespective of the nature of such an event. Thunder has many types of events in which instances of time play a role. Their nature may be in the field of (process) communication by exchanging various messages, it may be related to the scheduling of (future) tasks or it may play some other role. The list of options is non-exhaustive. + +## (Internal) representation + +Thunder models time with instances described by elements of the [Gregorian calendar](https://en.wikipedia.org/wiki/Gregorian_calendar) with its epoch defined by [Unix time](https://en.wikipedia.org/wiki/Unix_time). That is, it models time as (strictly) monotomic increasing integer values. The elements year, month, day, hour, second, and millisecond allow for unique descriptions of Gregorian calendar time instances. + +Set values can be individually retrieved. Time instances can be used in calculations and these instances can also be adjusted in millisecond decrements and increments. + +Values are depicted with respect to the [UTC timezone](https://en.wikipedia.org/wiki/Coordinated_Universal_Time) unless otherwise specified. Alternatively, a derived convenience model incorporates local time and date offset by the timezone configured for the platform. The user conveniently can ignore any (underlying) offset. + +```c++ +// Local time instead of UTC +Core::Time past(/*year*/ 2023, /*month*/ 10, /*day*/ 13, /*hours*/ 18, /*minutes*/ 02, /*seconds*/ 0 ,/* milliseconds*/ 0, /*local time*/ true); +// Implicitly UTC +const Core::Time now(Core::Time::Now()); + +if (past.Add(1000) < now()) { + std::cout << "More than second has elapsed since " + << past.WeekDayName() << ", " + << past.MonthName() << " " + << past.Day() << ", " + << past.Hours() << ":" + << past.Minutes() << ":" + << past.Seconds() << "." + << std::endl; +} + +// Internally represent the past with our local timezone instead of UTC +TimeAsLocal local(past); +``` + +In the given example a time object is intialized to October 10 of the year 2023 at 18:02h and a second time object is initialized to the value of the system time. Note that the second object does not specify local time and hence it is silently set to reflect values for the UTC timezone. A final check is executed to test if past time is more than a second ago. For completeness a local time object is created from the object representing the past. + +## Date and time conversion options + +The external representation of time is a string formatted in a predefined pattern unless a single integer valued element is represented. Such patterns are intrinsically applied for the various conversions methods made available. It allows users to conveniently convert 'From' one representation 'To' another by using correspondingly named methods. Among such conversions are the [RFC2311](https://www.rfc-editor.org/rfc/rfc2311) time and date specification, [RFC1036](https://www.rfc-editor.org/rfc/rfc1036) date specification, the [ISO8601]() date and time formats, and, [ANSI](https://webstore.ansi.org/standards/incits/ansiincits301997) date representation. + +Users that are interested in a format other than any provided by the Gregorian calendar representations may use *clock ticks*. Ticks are merely a conversion unit given from the multiplication of a constant value and the milliseconds value. Historically, it was a measure of runtime code execution on a CPU. Thunder has defined the multiplier constant equal to 1000. + +Although most people typically work with a Gregorian scheme time values can be easily converted to [Julian calendar](https://en.wikipedia.org/wiki/Julian_calendar) representation, and, back. With its corresponding [Julian days](https://en.wikipedia.org/wiki/Julian_day) being analogous to elapsed seconds since the epoch of Unix time. + +Finally, NTP conversions allows for incorporation of a different epoch. NTP epoch equals to 25567 seconds offset from its Unix time equivalent. + +```c++ +if (past.ToISO8601() == past.ToRFC1123()) { + std::cout << "It is very surprising to get here." << std::endl; +} else { + std::cout << "This is more likley to happen." << std::endl; +} + +past.FromString("Sun Nov 6 08:49:00 1994"); + +if (past.JulianDate()) == 94310) { + std::cout << "The Julian date is equivalent to " << past.Ticks() / Core::Time::TicksPerMilliSecond / Core::Time::MilliSecondsPerSecond << " seconds from the epoch of Unix Time." << std::endl;" +} + +``` +The depicted example continues the previous example. Here, the different strings from the conversion methods typically have different patterns and do not equate equal. In addition, the past time object is re-inialized using the ANSI pattern to November 6 of the year 1994 at 08:49h which is equivalent to 94310 Julian days. diff --git a/mkdocs.yml b/mkdocs.yml index 2a725a3a7..783debab7 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -46,6 +46,7 @@ nav: - Threading: - Worker Pool: utils/threading/worker-pool.md - Mutexes: utils/threading/mutex.md + - Time: utils/time.md - Timers: utils/timers.md - Web Requests: utils/web.md - Sockets: utils/sockets.md From 0d2047a4cd3337a0f9697fd791f53074cef863ca Mon Sep 17 00:00:00 2001 From: sebaszm <45654185+sebaszm@users.noreply.github.com> Date: Fri, 1 Dec 2023 10:33:32 +0100 Subject: [PATCH 4/4] Terminate after signal (#1459) --- Source/WPEFramework/PluginHost.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Source/WPEFramework/PluginHost.cpp b/Source/WPEFramework/PluginHost.cpp index 0fb5421b6..a52940406 100644 --- a/Source/WPEFramework/PluginHost.cpp +++ b/Source/WPEFramework/PluginHost.cpp @@ -255,7 +255,10 @@ POP_WARNING() fprintf(stdout, EXPAND_AND_QUOTE(APPLICATION_NAME) " completely stopped.\n"); fflush(stderr); } + _atExitActive = false; + + exit(0); } private: @@ -330,7 +333,6 @@ POP_WARNING() sigaction(SIGSEGV, &_originalSegmentationHandler, nullptr); sigaction(SIGABRT, &_originalAbortHandler, nullptr); - ExitHandler::DumpMetadata(); if (_background) { @@ -340,7 +342,7 @@ POP_WARNING() fflush(stderr); } - ExitHandler::StartShutdown(); + raise(signo); } else if (signo == SIGUSR1) { ExitHandler::DumpMetadata();