µOS++ IIIe Reference 7.0.0
The third edition of µOS++, a POSIX inspired open source framework, written in C++
Loading...
Searching...
No Matches
µOS++ Diagnostics & Trace

µOS++ Diagnostic & Trace summary page. More...

Namespaces

namespace  os::trace
 Tracing support namespace.
 

Functions

void os::trace::dump_args (int argc, char *argv[])
 Write the argv[] array to the trace device.
 
int os::trace::printf (const char *format,...)
 Write a formatted string to the trace device.
 
int os::trace::putchar (int c)
 Write the single character to the trace device.
 
int os::trace::puts (const char *s)
 Write the string and a line terminator to the trace device.
 
int os::trace::vprintf (const char *format, std::va_list args)
 Write a formatted variable arguments list to the trace device.
 

Detailed Description

This page groups the main classes providing support for diagnostics. For example the trace::printf() functions are defined here.

Function Documentation

◆ dump_args()

void os::trace::dump_args ( int  argc,
char *  argv[] 
)
Parameters
argcThe number of argv[] strings.
argvAn array of pointer to args.

Definition at line 139 of file trace.cpp.

140 {
141 printf ("main(argc=%d, argv=[", argc);
142 for (int i = 0; i < argc; ++i)
143 {
144 if (i != 0)
145 {
146 printf (", ");
147 }
148 printf ("\"%s\"", argv[i]);
149 }
150 printf ("]);\n");
151 }
int printf(const char *format,...)
Write a formatted string to the trace device.
Definition trace.cpp:59

References os::trace::printf().

◆ printf()

int os::trace::printf ( const char *  format,
  ... 
)
Parameters
[in]formatA null terminate string with the format.
Returns
A nonnegative number for success.

Definition at line 59 of file trace.cpp.

60 {
61 std::va_list args;
62 va_start (args, format);
63
64 int ret = vprintf (format, args);
65
66 va_end (args);
67 return ret;
68 }
int vprintf(const char *format, std::va_list args)
Write a formatted variable arguments list to the trace device.
Definition trace.cpp:76

References os::trace::vprintf().

Referenced by os::posix::block_device::block_device(), os::posix::block_device_impl::block_device_impl(), os::posix::block_device_implementable< T >::block_device_implementable(), os::posix::block_device_lockable< T, L >::block_device_lockable(), os::posix::block_device_partition::block_device_partition(), os::posix::block_device_partition_impl::block_device_partition_impl(), os::posix::block_device_partition_implementable< T >::block_device_partition_implementable(), os::posix::block_device_partition_lockable< T, L >::block_device_partition_lockable(), os::memory::block_pool::block_pool(), os::memory::block_pool_typed_allocated< T, A >::block_pool_typed_allocated(), os::memory::block_pool_typed_inclusive< T, N >::block_pool_typed_inclusive(), os::posix::char_device::char_device(), os::posix::char_device_impl::char_device_impl(), os::posix::char_device_implementable< T >::char_device_implementable(), os::posix::circular_buffer< T >::circular_buffer(), os::rtos::scheduler::critical_section::critical_section(), os::driver::usb::Device::Device(), os::posix::device::device(), os::posix::device_impl::device_impl(), os::posix::device_serial_buffered< CS >::device_serial_buffered(), os::posix::directory::directory(), os::posix::directory_impl::directory_impl(), os::posix::directory_implementable< T >::directory_implementable(), os::posix::directory_lockable< T, L >::directory_lockable(), os::utils::double_list::double_list(), os::rtos::event_flags::event_flags(), os::posix::file::file(), os::posix::file_descriptors_manager::file_descriptors_manager(), os::posix::file_impl::file_impl(), os::posix::file_implementable< T >::file_implementable(), os::posix::file_lockable< T, L >::file_lockable(), os::posix::file_system::file_system(), os::posix::file_system_impl::file_system_impl(), os::posix::file_system_implementable< T >::file_system_implementable(), os::posix::file_system_lockable< T, L >::file_system_lockable(), os::memory::first_fit_top::first_fit_top(), os::memory::first_fit_top_allocated< A >::first_fit_top_allocated(), os::memory::first_fit_top_inclusive< N >::first_fit_top_inclusive(), os::driver::usb::Host::Host(), os::posix::io::io(), os::posix::io_impl::io_impl(), os::memory::lifo::lifo(), os::memory::lifo::lifo(), os::memory::lifo_allocated< A >::lifo_allocated(), os::memory::lifo_inclusive< N >::lifo_inclusive(), os::memory::malloc_memory_resource::malloc_memory_resource(), os::memory::malloc_memory_resource::malloc_memory_resource(), os::rtos::memory_pool::memory_pool(), os::rtos::memory_pool_allocated< Allocator >::memory_pool_allocated(), os::rtos::message_queue::message_queue(), os::rtos::message_queue_allocated< Allocator >::message_queue_allocated(), os::rtos::mutex::mutex(), os::posix::net_stack::net_stack(), os::posix::net_stack_impl::net_stack_impl(), os::posix::net_stack_implementable< T >::net_stack_implementable(), os::posix::net_stack_lockable< T, L >::net_stack_lockable(), os::driver::Serial::Serial(), os::posix::socket::socket(), os::posix::socket_impl::socket_impl(), os::posix::socket_implementable< T >::socket_implementable(), os::posix::socket_lockable< T, L >::socket_lockable(), os::rtos::thread::thread(), os::rtos::thread_allocated< Allocator >::thread_allocated(), os::rtos::thread_inclusive< N >::thread_inclusive(), os::rtos::internal::timeout_thread_node::timeout_thread_node(), os::rtos::timer::timer(), os::rtos::internal::timer_node::timer_node(), os::rtos::internal::timestamp_node::timestamp_node(), os::posix::tty::tty(), os::posix::tty_impl::tty_impl(), os::posix::tty_implementable< T >::tty_implementable(), os::rtos::scheduler::uncritical_section::uncritical_section(), os::driver::usart_wrapper::usart_wrapper(), os::driver::usbd_wrapper::usbd_wrapper(), os::driver::usbh_wrapper::usbh_wrapper(), os::posix::block_device::~block_device(), os::posix::block_device_impl::~block_device_impl(), os::posix::block_device_implementable< T >::~block_device_implementable(), os::posix::block_device_lockable< T, L >::~block_device_lockable(), os::posix::block_device_partition::~block_device_partition(), os::posix::block_device_partition_impl::~block_device_partition_impl(), os::posix::block_device_partition_implementable< T >::~block_device_partition_implementable(), os::posix::block_device_partition_lockable< T, L >::~block_device_partition_lockable(), os::memory::block_pool::~block_pool(), os::memory::block_pool_typed_allocated< T, A >::~block_pool_typed_allocated(), os::memory::block_pool_typed_inclusive< T, N >::~block_pool_typed_inclusive(), os::posix::char_device::~char_device(), os::posix::char_device_impl::~char_device_impl(), os::posix::char_device_implementable< T >::~char_device_implementable(), os::posix::circular_buffer< T >::~circular_buffer(), os::rtos::scheduler::critical_section::~critical_section(), os::driver::usb::Device::~Device(), os::posix::device::~device(), os::posix::device_impl::~device_impl(), os::posix::device_serial_buffered< CS >::~device_serial_buffered(), os::posix::directory::~directory(), os::posix::directory_impl::~directory_impl(), os::posix::directory_implementable< T >::~directory_implementable(), os::posix::directory_lockable< T, L >::~directory_lockable(), os::utils::double_list::~double_list(), os::rtos::event_flags::~event_flags(), os::posix::file::~file(), os::posix::file_descriptors_manager::~file_descriptors_manager(), os::posix::file_impl::~file_impl(), os::posix::file_implementable< T >::~file_implementable(), os::posix::file_lockable< T, L >::~file_lockable(), os::posix::file_system::~file_system(), os::posix::file_system_impl::~file_system_impl(), os::posix::file_system_implementable< T >::~file_system_implementable(), os::posix::file_system_lockable< T, L >::~file_system_lockable(), os::memory::first_fit_top::~first_fit_top(), os::memory::first_fit_top_allocated< A >::~first_fit_top_allocated(), os::memory::first_fit_top_inclusive< N >::~first_fit_top_inclusive(), os::driver::usb::Host::~Host(), os::posix::io::~io(), os::posix::io_impl::~io_impl(), os::memory::lifo::~lifo(), os::memory::lifo_allocated< A >::~lifo_allocated(), os::memory::lifo_inclusive< N >::~lifo_inclusive(), os::memory::malloc_memory_resource::~malloc_memory_resource(), os::rtos::memory_pool::~memory_pool(), os::rtos::memory_pool_allocated< Allocator >::~memory_pool_allocated(), os::rtos::message_queue::~message_queue(), os::rtos::message_queue_allocated< Allocator >::~message_queue_allocated(), os::rtos::mutex::~mutex(), os::posix::net_stack::~net_stack(), os::posix::net_stack_impl::~net_stack_impl(), os::posix::net_stack_implementable< T >::~net_stack_implementable(), os::posix::net_stack_lockable< T, L >::~net_stack_lockable(), os::rtos::semaphore::~semaphore(), os::driver::Serial::~Serial(), os::posix::socket::~socket(), os::posix::socket_impl::~socket_impl(), os::posix::socket_implementable< T >::~socket_implementable(), os::posix::socket_lockable< T, L >::~socket_lockable(), thread::~thread(), os::rtos::thread::~thread(), os::rtos::thread_allocated< Allocator >::~thread_allocated(), os::rtos::thread_inclusive< N >::~thread_inclusive(), os::rtos::internal::timeout_thread_node::~timeout_thread_node(), os::rtos::timer::~timer(), os::rtos::internal::timer_node::~timer_node(), os::rtos::internal::timestamp_node::~timestamp_node(), os::posix::tty::~tty(), os::posix::tty_impl::~tty_impl(), os::posix::tty_implementable< T >::~tty_implementable(), os::rtos::scheduler::uncritical_section::~uncritical_section(), os::driver::usart_wrapper::~usart_wrapper(), os::driver::usbd_wrapper::~usbd_wrapper(), os::driver::usbh_wrapper::~usbh_wrapper(), os::estd::__throw_bad_alloc(), os::rtos::memory_pool::alloc(), os::posix::io::alloc_file_descriptor(), os::posix::file_descriptors_manager::allocate(), calloc(), os::rtos::thread::cancel(), os::rtos::internal::clock_timestamps_list::check_timestamp(), os::posix::file_system::chmod(), os::posix::chmod(), os::rtos::event_flags::clear(), os::posix::directory::close(), os::posix::io::close(), os::posix::block_device_lockable< T, L >::close(), os::posix::device::close(), os::posix::directory_lockable< T, L >::close(), os::posix::file::close(), os::posix::block_device_partition::configure(), os::posix::block_device_partition_impl::configure(), os::rtos::mutex::consistent(), os::posix::file_descriptors_manager::deallocate(), thread::detach(), os::rtos::thread::detach(), os::memory::new_delete_memory_resource::do_allocate(), os::memory::block_pool::do_allocate(), os::memory::first_fit_top::do_allocate(), os::memory::lifo::do_allocate(), os::memory::malloc_memory_resource::do_allocate(), os::posix::block_device_partition_impl::do_close(), os::memory::new_delete_memory_resource::do_deallocate(), os::memory::block_pool::do_deallocate(), os::memory::first_fit_top::do_deallocate(), os::memory::malloc_memory_resource::do_deallocate(), os::posix::block_device_impl::do_lseek(), os::posix::block_device_impl::do_read(), os::posix::block_device_partition_impl::do_read_block(), os::memory::block_pool::do_reset(), os::memory::first_fit_top::do_reset(), os::posix::block_device_partition_impl::do_sync(), os::posix::block_device_partition_impl::do_vopen(), os::posix::block_device_impl::do_write(), os::posix::block_device_partition_impl::do_write_block(), os::posix::circular_buffer< T >::dump(), os::trace::dump_args(), os::rtos::thread::flags_raise(), os::rtos::memory_pool::free(), free(), os::posix::io::fstat(), os::posix::file::fstatvfs(), os::posix::file::fsync(), os::posix::file::ftruncate(), os::rtos::event_flags::get(), os::rtos::scheduler::initialize(), os::utils::static_double_list::insert_after(), os::rtos::thread::interrupt(), os::rtos::thread::join(), thread::join(), os::rtos::thread::kill(), os::rtos::internal::clock_timestamps_list::link(), os::posix::device_registry< T >::link(), os::rtos::internal::ready_threads_list::link(), os::rtos::internal::waiting_threads_list::link(), os::rtos::internal::terminated_threads_list::link(), os::rtos::mutex::lock(), os::posix::io::lseek(), os::posix::block_device_lockable< T, L >::lseek(), main(), malloc(), os::posix::file_system::mkdir(), os::posix::mkdir(), os::posix::opendir(), os::posix::file_system::opendir(), operator new(), thread::operator=(), os_startup_initialize_free_store(), os_systick_handler(), os_terminate_goodbye(), os::rtos::memory::memory_resource::out_of_memory_handler(), os::rtos::semaphore::post(), os::rtos::scheduler::preemptive(), os::rtos::mutex::prio_ceiling(), os::rtos::mutex::prio_ceiling(), os::rtos::thread::priority(), os::rtos::thread::priority_inherited(), os::rtos::event_flags::raise(), os::posix::io::read(), os::posix::block_device_lockable< T, L >::read(), os::posix::directory::read(), os::posix::directory_lockable< T, L >::read(), os::posix::block_device::read_block(), os::posix::block_device_partition_lockable< T, L >::read_block(), os::posix::block_device_lockable< T, L >::read_block(), realloc(), os::rtos::message_queue::receive(), os::posix::file_system::rename(), os::posix::rename(), os::rtos::memory_pool::reset(), os::rtos::message_queue::reset(), os::rtos::mutex::reset(), os::rtos::semaphore::reset(), os::rtos::thread::resume(), os::rtos::internal::waiting_threads_list::resume_one(), os::posix::directory::rewind(), os::posix::directory_lockable< T, L >::rewind(), os::posix::file_system::rmdir(), os::posix::rmdir(), os::rtos::message_queue::send(), os::estd::pmr::set_default_resource(), os::rtos::memory::set_default_resource(), std::set_new_handler(), os::rtos::memory::set_resource_typed< condition_variable >(), os::rtos::memory::set_resource_typed< event_flags >(), os::rtos::memory::set_resource_typed< memory_pool >(), os::rtos::memory::set_resource_typed< message_queue >(), os::rtos::memory::set_resource_typed< mutex >(), os::rtos::memory::set_resource_typed< semaphore >(), os::rtos::memory::set_resource_typed< thread >(), os::rtos::memory::set_resource_typed< timer >(), os::rtos::clock::sleep_for(), os::rtos::clock::sleep_until(), os::rtos::timer::start(), os::rtos::scheduler::start(), os::posix::file_system::stat(), os::posix::stat(), os::posix::statvfs(), os::posix::file_system::statvfs(), os::rtos::timer::stop(), os::posix::device::sync(), os::posix::file_system::sync(), os::posix::sync(), os::posix::block_device_lockable< T, L >::sync(), os::rtos::memory_pool::timed_alloc(), os::rtos::mutex::timed_lock(), os::rtos::message_queue::timed_receive(), os::rtos::message_queue::timed_send(), os::rtos::semaphore::timed_wait(), os::rtos::event_flags::timed_wait(), os::rtos::memory::memory_resource::trace_print_statistics(), os::posix::file_system::truncate(), os::posix::truncate(), os::rtos::memory_pool::try_alloc(), os::rtos::mutex::try_lock(), os::rtos::message_queue::try_receive(), os::rtos::message_queue::try_send(), os::rtos::event_flags::try_wait(), os::rtos::semaphore::try_wait(), os::posix::file_system::umount(), os::posix::file_system::unlink(), os::posix::unlink(), os::utils::static_double_list_links::unlink(), os::rtos::internal::ready_threads_list::unlink_head(), os::rtos::mutex::unlock(), os::posix::file_system::utime(), os::posix::utime(), os::posix::io::vfcntl(), os::posix::block_device_lockable< T, L >::vfcntl(), os::posix::device::vioctl(), os::posix::block_device_partition_lockable< T, L >::vioctl(), os::posix::block_device::vioctl(), os::posix::block_device_lockable< T, L >::vioctl(), os::posix::file_system::vmkfs(), os::posix::file_system::vmount(), os::posix::device::vopen(), os::posix::file_system::vopen(), os::posix::vopen(), os::rtos::event_flags::wait(), os::rtos::semaphore::wait(), os::rtos::clock::wait_for(), os::rtos::event_flags::waiting(), os::posix::io::write(), os::posix::block_device_lockable< T, L >::write(), os::posix::block_device::write_block(), os::posix::block_device_partition_lockable< T, L >::write_block(), os::posix::block_device_lockable< T, L >::write_block(), os::posix::io::writev(), os::posix::block_device_lockable< T, L >::writev(), and os::rtos::this_thread::yield().

◆ putchar()

int os::trace::putchar ( int  c)
Parameters
cA single byte character.
Returns
The written character.

Definition at line 120 of file trace.cpp.

121 {
122 int ret
123 = static_cast<int> (write (reinterpret_cast<const char*> (&c), 1));
124 if (ret > 0)
125 {
126 return c;
127 }
128 else
129 {
130 return EOF;
131 }
132 }
ssize_t write(int fildes, const void *buf, size_t nbyte)

References os::trace::write().

Referenced by os_systick_handler().

◆ puts()

int os::trace::puts ( const char *  s)
Parameters
sA null terminated string.
Returns
A nonnegative number for success.

Definition at line 102 of file trace.cpp.

103 {
104 int ret = static_cast<int> (write (s, strlen (s)));
105 if (ret >= 0)
106 {
107 ret = static_cast<int> (write ("\n", 1)); // Add a line terminator
108 }
109 if (ret > 0)
110 {
111 return ret;
112 }
113 else
114 {
115 return EOF;
116 }
117 }

References os::trace::write().

Referenced by os::posix::device_registry< T >::link(), and main().

◆ vprintf()

int os::trace::vprintf ( const char *  format,
std::va_list  args 
)
Parameters
[in]formatA null terminate string with the format.
[in]argsA variable arguments list.
Returns
A nonnegative number for success.

Definition at line 76 of file trace.cpp.

77 {
78 // Caution: allocated on the stack!
80
81 // TODO: possibly rewrite it to no longer use newlib,
82 // (although the nano version is no longer very heavy).
83
84 // Print to the local buffer
85#pragma GCC diagnostic push
86#if defined(__clang__)
87#pragma clang diagnostic ignored "-Wformat-nonliteral"
88#elif defined(__GNUC__)
89#pragma GCC diagnostic ignored "-Wformat-nonliteral"
90#endif
91 int ret = ::vsnprintf (buf, sizeof (buf), format, args);
92#pragma GCC diagnostic pop
93 if (ret > 0)
94 {
95 // Transfer the buffer to the device.
96 ret = static_cast<int> (write (buf, static_cast<size_t> (ret)));
97 }
98 return ret;
99 }
#define OS_INTEGER_TRACE_PRINTF_TMP_ARRAY_SIZE
Definition trace.cpp:25

References OS_INTEGER_TRACE_PRINTF_TMP_ARRAY_SIZE, and os::trace::write().

Referenced by os::trace::printf().