Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset b2a1fd92 in mainline


Ignore:
Timestamp:
2017-12-11T09:42:42Z (4 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master
Children:
16f2dcc
Parents:
9b07fba
git-author:
Jiri Svoboda <jiri@…> (2017-12-10 22:41:37)
git-committer:
Jiri Svoboda <jiri@…> (2017-12-11 09:42:42)
Message:

Separate error code from output parameter in udebug_begin().

Location:
kernel/generic
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/include/udebug/udebug_ops.h

    r9b07fba rb2a1fd92  
    3737
    3838#include <ipc/ipc.h>
     39#include <proc/thread.h>
     40#include <stdbool.h>
     41#include <stddef.h>
    3942
    40 int udebug_begin(call_t *call);
     43int udebug_begin(call_t *call, bool *active);
    4144int udebug_end(void);
    4245int udebug_set_evmask(udebug_evmask_t mask);
  • kernel/generic/src/udebug/udebug_ipc.c

    r9b07fba rb2a1fd92  
    7272{
    7373        int rc;
    74 
    75         rc = udebug_begin(call);
    76         if (rc < 0) {
     74        bool active;
     75
     76        rc = udebug_begin(call, &active);
     77        if (rc != EOK) {
    7778                IPC_SET_RETVAL(call->data, rc);
    7879                ipc_answer(&TASK->kb.box, call);
     
    8485         * send a reply.
    8586         */
    86         if (rc != 0) {
    87                 IPC_SET_RETVAL(call->data, 0);
     87        if (active) {
     88                IPC_SET_RETVAL(call->data, EOK);
    8889                ipc_answer(&TASK->kb.box, call);
    8990        }
  • kernel/generic/src/udebug/udebug_ops.c

    r9b07fba rb2a1fd92  
    4646#include <errno.h>
    4747#include <print.h>
     48#include <stdbool.h>
    4849#include <str.h>
    4950#include <syscall/copy.h>
     
    157158 *
    158159 * Initiates a debugging session for the current task (and its threads).
    159  * When the debugging session has started a reply will be sent to the
     160 * When the debugging session has started a reply should be sent to the
    160161 * UDEBUG_BEGIN call. This may happen immediately in this function if
    161162 * all the threads in this task are stoppable at the moment and in this
    162  * case the function returns 1.
    163  *
    164  * Otherwise the function returns 0 and the reply will be sent as soon as
    165  * all the threads become stoppable (i.e. they can be considered stopped).
     163 * case the function sets @a *active to @c true.
     164 *
     165 * Otherwise the function sets @a *active to false and the resonse should
     166 * be sent as soon as all the threads become stoppable (i.e. they can be
     167 * considered stopped).
    166168 *
    167169 * @param call The BEGIN call we are servicing.
    168  *
    169  * @return 0 (OK, but not done yet), 1 (done) or negative error code.
    170  *
    171  */
    172 int udebug_begin(call_t *call)
     170 * @param active Place to store @c true iff we went directly to active state,
     171 *               @c false if we only went to beginning state
     172 *
     173 * @return EOK on success, EBUSY if the task is already has an active
     174 *         debugging session.
     175 */
     176int udebug_begin(call_t *call, bool *active)
    173177{
    174178        LOG("Debugging task %" PRIu64, TASK->taskid);
     
    185189        TASK->udebug.debugger = call->sender;
    186190       
    187         int reply;
    188        
    189191        if (TASK->udebug.not_stoppable_count == 0) {
    190192                TASK->udebug.dt_state = UDEBUG_TS_ACTIVE;
    191193                TASK->udebug.begin_call = NULL;
    192                 reply = 1;  /* immediate reply */
     194                *active = true;  /* directly to active state */
    193195        } else
    194                 reply = 0;  /* no reply */
     196                *active = false;  /* only in beginning state */
    195197       
    196198        /* Set udebug.active on all of the task's userspace threads. */
     
    207209       
    208210        mutex_unlock(&TASK->udebug.lock);
    209         return reply;
     211        return EOK;
    210212}
    211213
Note: See TracChangeset for help on using the changeset viewer.