From 1703041074e5e70bb4a61d8a99355509759a673d Mon Sep 17 00:00:00 2001 From: Chris Johns Date: Tue, 24 Mar 2015 14:37:35 +1100 Subject: rtems-tld: Add lock and buffer allocator support to generators. Generators can control a lock and buffer allocation so a single alloc can happen and a lock released. --- linkers/rtems-tld.cpp | 157 +++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 144 insertions(+), 13 deletions(-) diff --git a/linkers/rtems-tld.cpp b/linkers/rtems-tld.cpp index a3bd0cf..5638317 100644 --- a/linkers/rtems-tld.cpp +++ b/linkers/rtems-tld.cpp @@ -171,6 +171,11 @@ namespace rld struct generator { std::string name; /**< The name of this wrapper. */ + std::string lock_local; /**< Code template to declare a local lock variable. */ + std::string lock_acquire; /**< The lock acquire if provided. */ + std::string lock_release; /**< The lock release if provided. */ + std::string buffer_local; /**< Code template to declare a local buffer variable. */ + std::string buffer_alloc; /**< Code template to perform a buffer allocation. */ rld::strings headers; /**< Include statements. */ rld::strings defines; /**< Define statements. */ std::string entry_trace; /**< Code template to trace the function entry. */ @@ -551,12 +556,75 @@ namespace rld /* * A generator section optionally contain one or more records of: * - * # headers A list of sections containing headers or header records. - * # header A list of include string that are single or double quoted. - * # defines A list of sections containing defines or define record. - * # define A list of define string that are single or double quoted. - * # code-blocks A list of section names of code blocks. - * # includes A list of files to include. + * # headers A list of sections containing headers or header records. + * # header A list of include string that are single or double quoted. + * # defines A list of sections containing defines or define record. + * # define A list of define string that are single or double quoted. + * # entry-trace The wrapper call made on a function's entry. Returns `bool + * where `true` is the function is being traced. This call is made + * without the lock being held if a lock is defined. + * # arg-trace The wrapper call made for each argment to the trace function if + * the function is being traced. This call is made without the + * lock being held if a lock is defined. + * # exit-trace The wrapper call made after a function's exit. Returns `bool + * where `true` is the function is being traced. This call is made + * without the lock being held if a lock is defined. + * # ret-trace The wrapper call made to log the return value if the funciton + * is being traced. This call is made without the lock being held + * if a lock is defined. + * # lock-local The wrapper code to declare a local lock variable. + * # lock-acquire The wrapper code to acquire the lock. + * # lock-release The wrapper code to release the lock. + * # buffer-local The wrapper code to declare a buffer index local variable. + * # buffer-alloc The wrapper call made with a lock held if defined to allocate + * buffer space to hold the trace data. A suitable 32bit buffer + * index is returned. If there is no space an invalid index is + * returned. The generator must handle any overhead space needed. + * the generator needs to make sure the space is available before + * making the alloc all. + * # code-blocks A list of code blcok section names. + * # code A code block in `<