[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] Re: [Minios-devel] [UNIKRAFT PATCH 4/8] lib/ukdebug: key-value static storage for tracing
And another thing I forgot, please see inline. On 5/29/19 8:27 AM, Costin Lupu wrote: > Hi Yuri, > > It's not obvious why we need this key-value thing. Can you please extend > the commit message or the comment or both with some use cases where this > would be useful? > > Thanks, > Costin > > On 5/10/19 9:29 PM, Yuri Volchkov wrote: >> One more 'special' stripable section. Will contain strings in format >> key = value. Currently only tracebuffer format version is stored there. >> >> Signed-off-by: Yuri Volchkov <yuri.volchkov@xxxxxxxxx> >> --- >> lib/ukdebug/extra.ld | 3 +++ >> lib/ukdebug/trace.c | 18 ++++++++++++++++++ >> 2 files changed, 21 insertions(+) >> >> diff --git a/lib/ukdebug/extra.ld b/lib/ukdebug/extra.ld >> index 43154f9d..bb0b36b8 100644 >> --- a/lib/ukdebug/extra.ld >> +++ b/lib/ukdebug/extra.ld >> @@ -5,6 +5,9 @@ SECTIONS >> KEEP (*(.uk_tracepoints_list)); >> uk_tracepoints_end = .; >> } >> + .uk_trace_keyvals : { >> + KEEP (*(.uk_trace_keyvals)); >> + } >> } >> >> /* We do not want these section to be in the final image, they are >> diff --git a/lib/ukdebug/trace.c b/lib/ukdebug/trace.c >> index f3318557..91cc2387 100644 >> --- a/lib/ukdebug/trace.c >> +++ b/lib/ukdebug/trace.c >> @@ -43,3 +43,21 @@ char uk_trace_buffer[UK_TRACE_BUFFER_SIZE]; >> >> size_t uk_trace_buffer_free = UK_TRACE_BUFFER_SIZE; >> char *uk_trace_buffer_writep = uk_trace_buffer; >> + >> + >> +/* Store a string in format "key = value" in the section >> + * .uk_trace_keyvals. This can be anything what you want trace.py >> + * script to know about, and what you do not want to consume any space >> + * in runtime memory. >> + * >> + * This section will be stripped at the final states of building, but >> + * the key-value data can be easily extracted by: >> + * >> + * $ readelf -p .uk_trace_keyvals <your_image.gdb> In my case it's not in 'image.gdb', it's in 'image'. Maybe because 'build: always produce 2 images: w/ and w/o debug syms' wasn't upstreamed? >> + */ >> +#define TRACE_DEFINE_KEY(key, val) \ >> + __attribute((__section__(".uk_trace_keyvals"))) \ >> + static const char key[] __used = \ >> + #key " = " #val >> + >> +TRACE_DEFINE_KEY(format_version, 1); >> > > _______________________________________________ > Minios-devel mailing list > Minios-devel@xxxxxxxxxxxxxxxxxxxx > https://lists.xenproject.org/mailman/listinfo/minios-devel > _______________________________________________ Minios-devel mailing list Minios-devel@xxxxxxxxxxxxxxxxxxxx https://lists.xenproject.org/mailman/listinfo/minios-devel
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |