You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by GitBox <gi...@apache.org> on 2022/03/08 10:48:56 UTC

[GitHub] [incubator-nuttx] pkarashchenko commented on a change in pull request #5689: segger/sysview: add syscall support

pkarashchenko commented on a change in pull request #5689:
URL: https://github.com/apache/incubator-nuttx/pull/5689#discussion_r821544929



##########
File path: drivers/segger/note_sysview.c
##########
@@ -490,4 +594,50 @@ void sched_note_filter_irq(struct note_filter_irq_s *oldf,
 }
 #endif
 
+/****************************************************************************
+ * Name: sched_note_filter_syscall
+ *
+ * Description:
+ *   Set and get syscall filter setting
+ *   (Same as NOTECTL_GETSYSCALLFILTER / NOTECTL_SETSYSCALLFILTER ioctls)
+ *
+ * Input Parameters:
+ *   oldf - A writable pointer to struct note_filter_syscall_s to get
+ *          current syscall filter setting
+ *          If 0, no data is written.
+ *   newf - A read-only pointer to struct note_filter_syscall_s of the
+ *          new syscall filter setting
+ *          If 0, the setting is not updated.
+ *
+ * Returned Value:
+ *   None
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_SCHED_INSTRUMENTATION_SYSCALL
+void sched_note_filter_syscall(struct note_filter_syscall_s *oldf,
+                               struct note_filter_syscall_s *newf)
+{
+  irqstate_t flags;
+
+  flags = spin_lock_irqsave(NULL);

Review comment:
       Should we introduce a separate `segger_spinlock` instance?

##########
File path: drivers/segger/note_sysview.c
##########
@@ -197,6 +214,45 @@ static bool sysview_isenabled_irq(int irq, bool enter)
 }
 #endif
 
+/****************************************************************************
+ * Name: sysview_isenabled_syscall
+ *
+ * Description:
+ *   Check whether the syscall instrumentation is enabled.
+ *
+ * Input Parameters:
+ *   nr - syscall number
+ *
+ * Returned Value:
+ *   True is returned if the instrumentation is enabled.
+ *
+ ****************************************************************************/
+
+#ifdef CONFIG_SCHED_INSTRUMENTATION_SYSCALL
+static inline int sysview_isenabled_syscall(int nr)
+{
+#ifdef CONFIG_SCHED_INSTRUMENTATION_FILTER
+  if (!sysview_isenabled())
+    {
+      return false;
+    }
+
+  /* If the syscall trace is disabled or the syscall number is masked,
+   * do nothing.
+   */
+
+  if (!(g_sysview.mode.flag & NOTE_FILTER_MODE_FLAG_SYSCALL) ||

Review comment:
       ```suggestion
     if ((g_sysview.mode.flag & NOTE_FILTER_MODE_FLAG_SYSCALL) == 0 ||
   ```




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@nuttx.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org