Changeset bd48f4c in mainline for kernel/generic/src/debug/debug.c


Ignore:
Timestamp:
2010-07-12T10:53:30Z (14 years ago)
Author:
Jiri Svoboda <jiri@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
bd11d3e
Parents:
c40e6ef (diff), bee2d4c (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge mainline changes.

File:
1 moved

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/debug/debug.c

    rc40e6ef rbd48f4c  
    11/*
    2  * Copyright (c) 2001-2004 Jakub Jermar
     2 * Copyright (c) 2010 Martin Decky
    33 * All rights reserved.
    44 *
     
    2727 */
    2828
    29 #include <test.h>
    30 #include <arch.h>
    31 #include <atomic.h>
     29/** @addtogroup genericdebug
     30 * @{
     31 */
     32
     33/**
     34 * @file
     35 * @brief Kernel instrumentation functions.
     36 */
     37
     38#ifdef CONFIG_TRACE
     39
     40#include <debug.h>
     41#include <symtab.h>
     42#include <errno.h>
    3243#include <print.h>
    33 #include <proc/thread.h>
    3444
    35 #include <synch/rwlock.h>
    36 
    37 #define READERS  50
    38 #define WRITERS  50
    39 
    40 static rwlock_t rwlock;
    41 
    42 static void writer(void *arg)
     45void __cyg_profile_func_enter(void *fn, void *call_site)
    4346{
    44         TPRINTF("Trying to lock rwlock for writing....\n");
     47        const char *fn_sym = symtab_fmt_name_lookup((uintptr_t) fn);
    4548       
    46         rwlock_write_lock(&rwlock);
    47         rwlock_write_unlock(&rwlock);
     49        const char *call_site_sym;
     50        uintptr_t call_site_off;
    4851       
    49         TPRINTF("Trying to lock rwlock for reading....\n");
    50        
    51         rwlock_read_lock(&rwlock);
    52         rwlock_read_unlock(&rwlock);
     52        if (symtab_name_lookup((uintptr_t) call_site, &call_site_sym,
     53            &call_site_off) == EOK)
     54                printf("%s+%" PRIp "->%s\n", call_site_sym, call_site_off,
     55                    fn_sym);
     56        else
     57                printf("->%s\n", fn_sym);
    5358}
    5459
    55 const char *test_rwlock2(void)
     60void __cyg_profile_func_exit(void *fn, void *call_site)
    5661{
    57         thread_t *thrd;
     62        const char *fn_sym = symtab_fmt_name_lookup((uintptr_t) fn);
    5863       
    59         rwlock_initialize(&rwlock);
     64        const char *call_site_sym;
     65        uintptr_t call_site_off;
    6066       
    61         rwlock_read_lock(&rwlock);
    62         rwlock_read_lock(&rwlock);
    63         rwlock_read_lock(&rwlock);
    64         rwlock_read_lock(&rwlock);
    65        
    66         thrd = thread_create(writer, NULL, TASK, 0, "writer", false);
    67         if (thrd)
    68                 thread_ready(thrd);
     67        if (symtab_name_lookup((uintptr_t) call_site, &call_site_sym,
     68            &call_site_off) == EOK)
     69                printf("%s+%" PRIp "<-%s\n", call_site_sym, call_site_off,
     70                    fn_sym);
    6971        else
    70                 return "Could not create thread";
    71        
    72         thread_sleep(1);
    73        
    74         rwlock_read_unlock(&rwlock);
    75         rwlock_read_unlock(&rwlock);
    76         rwlock_read_unlock(&rwlock);
    77         rwlock_read_unlock(&rwlock);
    78        
    79         thread_join(thrd);
    80         thread_detach(thrd);
    81        
    82         return NULL;
     72                printf("<-%s\n", fn_sym);
    8373}
     74
     75#endif /* CONFIG_TRACE */
     76
     77/** @}
     78 */
Note: See TracChangeset for help on using the changeset viewer.