[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Minios-devel] outreachy task - adding information to debug prints


  • To: minios-devel@xxxxxxxxxxxxx
  • From: Dafna Hirschfeld <dafna3@xxxxxxxxx>
  • Date: Tue, 13 Mar 2018 19:17:25 +0200
  • Delivery-date: Tue, 13 Mar 2018 17:17:52 +0000
  • List-id: Mini-os development list <minios-devel.lists.xenproject.org>

There is a function uk_thread_current of the uksched library that returns the current thread.
It gets the current stack pointer by calling ukplat_thread_ctx_current and then calls __containerof to get the thread from it.
The problem is that there is no checking if the current thread was created by the library.
If the current thread was not created with uksched (the initial thread for example) then this pointer is invalid.

Dafna


On Mon, Mar 12, 2018 at 9:04 PM, Dafna Hirschfeld <dafna3@xxxxxxxxx> wrote:
Hi,
I was given a task for applying outreachy internship. 

The ukdebug library supplies a  macro uk_printd, for debugging, it receives a debug level and a formatted string. (it should be enabled in the menuconfig).

My task is to add to the debug:
1. timestemp. The timestemp should be in seconds, with up to 3 digits precision.
2. name/pointer of the thread that issued the debug.

Each information will be added only if configured in menuconfig.

I think the new information can be added in the function _vprintd.

So two functions will be added to print.c:

static char* _get_timestamp() - returns a string of the current time or NULL according to configuration.

static char* _get_thread_name() - returns the name of the running thread or NULL if either this information is not enabled in the menuconfig or the sched library is not enabled.

static void* _get_thread_pointer() same as _get_thread_name() but returns a pointer to the thread.

issues:
1. currently there is no support for float "%f" format in vsnprintf, it should be added since the timestemp should be printed as a floating point, or workaround it with printing it in format something like "%d.%d" where the first %d is seconds and the second %d is miliseconds.

2. two functions:
char* get_thread_name()
char* get_thread_pointer()
should be added to the uksched library api.

3. "thread pointer", does it mean a pointer to the stack of the thread? maybe it's better to have other identifier, so a pointer to the stack won't be available outside of the library.

Dafna


_______________________________________________
Minios-devel mailing list
Minios-devel@xxxxxxxxxxxxxxxxxxxx
https://lists.xenproject.org/mailman/listinfo/minios-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.