Back to home page

LXR

 
 

    


File indexing completed on 2025-05-11 08:24:18

0001 /* SPDX-License-Identifier: BSD-2-Clause */
0002 
0003 /**
0004  * @file
0005  *
0006  * @brief RTEMS Monitor extension support
0007  */
0008 
0009 /*
0010  * COPYRIGHT (c) 1989-2022. On-Line Applications Research Corporation (OAR).
0011  *
0012  * Redistribution and use in source and binary forms, with or without
0013  * modification, are permitted provided that the following conditions
0014  * are met:
0015  * 1. Redistributions of source code must retain the above copyright
0016  *    notice, this list of conditions and the following disclaimer.
0017  * 2. Redistributions in binary form must reproduce the above copyright
0018  *    notice, this list of conditions and the following disclaimer in the
0019  *    documentation and/or other materials provided with the distribution.
0020  *
0021  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
0022  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
0023  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
0024  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
0025  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
0026  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
0027  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
0028  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
0029  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
0030  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
0031  * POSSIBILITY OF SUCH DAMAGE.
0032  */
0033 
0034 #ifdef HAVE_CONFIG_H
0035 #include "config.h"
0036 #endif
0037 
0038 #include <rtems.h>
0039 #include <rtems/extensiondata.h>
0040 #include <rtems/monitor.h>
0041 
0042 #include <stdio.h>
0043 
0044 void
0045 rtems_monitor_extension_canonical(
0046     rtems_monitor_extension_t *canonical_extension,
0047     const void                *extension_void
0048 )
0049 {
0050     const Extension_Control *rtems_extension = (const Extension_Control *) extension_void;
0051     const rtems_extensions_table *e = &rtems_extension->Extension.Callouts;
0052 
0053     rtems_monitor_symbol_canonical_by_value(&canonical_extension->e_create,
0054                                             (void *) e->thread_create);
0055 
0056     rtems_monitor_symbol_canonical_by_value(&canonical_extension->e_start,
0057                                             (void *) e->thread_start);
0058     rtems_monitor_symbol_canonical_by_value(&canonical_extension->e_restart,
0059                                             (void *) e->thread_restart);
0060     rtems_monitor_symbol_canonical_by_value(&canonical_extension->e_delete,
0061                                             (void *) e->thread_delete);
0062     rtems_monitor_symbol_canonical_by_value(&canonical_extension->e_tswitch,
0063                                             (void *) e->thread_switch);
0064     rtems_monitor_symbol_canonical_by_value(&canonical_extension->e_begin,
0065                                             (void *) e->thread_begin);
0066     rtems_monitor_symbol_canonical_by_value(&canonical_extension->e_exitted,
0067                                             (void *) e->thread_exitted);
0068     rtems_monitor_symbol_canonical_by_value(&canonical_extension->e_fatal,
0069                                             (void *) e->fatal);
0070 }
0071 
0072 void
0073 rtems_monitor_extension_dump_header(
0074     bool verbose RTEMS_UNUSED
0075 )
0076 {
0077     fprintf(stdout,"\
0078   ID       NAME\n");
0079 /*23456789 123456789 123456789 123456789 123456789 123456789 123456789 123456789
0080 0         1         2         3         4         5         6         7       */
0081 
0082     rtems_monitor_separator();
0083 }
0084 
0085 
0086 /*
0087  * Dump out the canonical form
0088  */
0089 
0090 void
0091 rtems_monitor_extension_dump(
0092     rtems_monitor_extension_t *monitor_extension,
0093     bool                       verbose
0094 )
0095 {
0096     uint32_t             length = 0;
0097 
0098     length += rtems_monitor_dump_id(monitor_extension->id);
0099     length += rtems_monitor_pad(11, length);
0100     length += rtems_monitor_dump_name(monitor_extension->id);
0101 
0102     length += rtems_monitor_pad(18, length);
0103     length += fprintf(stdout,"create: ");
0104     length += rtems_monitor_symbol_dump(&monitor_extension->e_create, verbose);
0105     length += fprintf(stdout,";  start: ");
0106     length += rtems_monitor_symbol_dump(&monitor_extension->e_start, verbose);
0107     length += fprintf(stdout,";  restart: ");
0108     length += rtems_monitor_symbol_dump(&monitor_extension->e_restart, verbose);
0109     length += fprintf(stdout,"\n");
0110     length = 0;
0111 
0112     length += rtems_monitor_pad(18, length);
0113     length += fprintf(stdout,"delete: ");
0114     length += rtems_monitor_symbol_dump(&monitor_extension->e_delete, verbose);
0115     length += fprintf(stdout,";  switch: ");
0116     length += rtems_monitor_symbol_dump(&monitor_extension->e_tswitch, verbose);
0117     length += fprintf(stdout,";  begin: ");
0118     length += rtems_monitor_symbol_dump(&monitor_extension->e_begin, verbose);
0119     length += fprintf(stdout,"\n");
0120     length = 0;
0121 
0122     length += rtems_monitor_pad(18, length);
0123     length += fprintf(stdout,"exitted: ");
0124     length += rtems_monitor_symbol_dump(&monitor_extension->e_exitted, verbose);
0125     length += fprintf(stdout,";  fatal: ");
0126     length += rtems_monitor_symbol_dump(&monitor_extension->e_fatal, verbose);
0127     length += fprintf(stdout,"\n");
0128     length = 0;
0129     fprintf(stdout,"\n");
0130 }