Changeset cefb126 in mainline for kernel/generic/src/debug/debug.c
- Timestamp:
- 2010-07-02T14:19:30Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 89c57b6
- Parents:
- fe7abd0 (diff), e3ee9b9 (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. - File:
-
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/debug/debug.c
rfe7abd0 rcefb126 1 1 /* 2 * Copyright (c) 20 01-2004 Jakub Jermar2 * Copyright (c) 2010 Martin Decky 3 3 * All rights reserved. 4 4 * … … 27 27 */ 28 28 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> 32 43 #include <print.h> 33 #include <proc/thread.h>34 44 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) 45 void __cyg_profile_func_enter(void *fn, void *call_site) 43 46 { 44 TPRINTF("Trying to lock rwlock for writing....\n");47 const char *fn_sym = symtab_fmt_name_lookup((uintptr_t) fn); 45 48 46 rwlock_write_lock(&rwlock);47 rwlock_write_unlock(&rwlock);49 const char *call_site_sym; 50 uintptr_t call_site_off; 48 51 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); 53 58 } 54 59 55 const char *test_rwlock2(void)60 void __cyg_profile_func_exit(void *fn, void *call_site) 56 61 { 57 thread_t *thrd;62 const char *fn_sym = symtab_fmt_name_lookup((uintptr_t) fn); 58 63 59 rwlock_initialize(&rwlock); 64 const char *call_site_sym; 65 uintptr_t call_site_off; 60 66 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); 69 71 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); 83 73 } 74 75 #endif /* CONFIG_TRACE */ 76 77 /** @} 78 */
Note:
See TracChangeset
for help on using the changeset viewer.