From 8389628c1be0f40fb94c1d2859138a09616acf06 Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Mon, 22 Apr 1996 16:53:46 +0000 Subject: updates from Tony Bennett --- c/src/lib/libmisc/assoc/assoc.c | 3 - c/src/lib/libmisc/assoc/assoc.h | 2 - c/src/lib/libmisc/error/error.c | 3 - c/src/lib/libmisc/error/error.h | 9 +- c/src/lib/libmisc/monitor/mon-command.c | 3 - c/src/lib/libmisc/monitor/mon-config.c | 3 - c/src/lib/libmisc/monitor/mon-dname.c | 3 - c/src/lib/libmisc/monitor/mon-driver.c | 3 - c/src/lib/libmisc/monitor/mon-extension.c | 3 - c/src/lib/libmisc/monitor/mon-itask.c | 5 +- c/src/lib/libmisc/monitor/mon-manager.c | 7 +- c/src/lib/libmisc/monitor/mon-monitor.c | 41 ++++----- c/src/lib/libmisc/monitor/mon-mpci.c | 3 - c/src/lib/libmisc/monitor/mon-object.c | 5 +- c/src/lib/libmisc/monitor/mon-prmisc.c | 3 - c/src/lib/libmisc/monitor/mon-queue.c | 2 - c/src/lib/libmisc/monitor/mon-server.c | 5 +- c/src/lib/libmisc/monitor/mon-symbols.c | 144 ++++++++++++++---------------- c/src/lib/libmisc/monitor/mon-task.c | 3 - c/src/lib/libmisc/monitor/monitor.h | 14 ++- c/src/lib/libmisc/monitor/symbols.h | 11 --- c/src/lib/libmisc/stackchk/check.c | 36 ++++++-- 22 files changed, 130 insertions(+), 181 deletions(-) (limited to 'c/src/lib/libmisc') diff --git a/c/src/lib/libmisc/assoc/assoc.c b/c/src/lib/libmisc/assoc/assoc.c index a3eabdb3b5..74387a8c5b 100644 --- a/c/src/lib/libmisc/assoc/assoc.c +++ b/c/src/lib/libmisc/assoc/assoc.c @@ -1,7 +1,4 @@ /* - * @(#)assoc.c 1.6 - 95/10/25 - * - * * assoc.c * rtems assoc routines * diff --git a/c/src/lib/libmisc/assoc/assoc.h b/c/src/lib/libmisc/assoc/assoc.h index f9a444374c..1982d654ac 100644 --- a/c/src/lib/libmisc/assoc/assoc.h +++ b/c/src/lib/libmisc/assoc/assoc.h @@ -1,6 +1,4 @@ /* - * @(#)assoc.h 1.4 - 95/10/25 - * * * Rtems associativity routines. Mainly used to convert a value from * one space to another (eg: our errno's to host errno's and v.v) diff --git a/c/src/lib/libmisc/error/error.c b/c/src/lib/libmisc/error/error.c index 715635072a..5bd481c3e6 100644 --- a/c/src/lib/libmisc/error/error.c +++ b/c/src/lib/libmisc/error/error.c @@ -1,7 +1,4 @@ /* - * @(#)error.c 1.6 - 95/12/12 - * - * * report errors and panics to RTEMS' stderr. * Currently just used by RTEMS monitor. * diff --git a/c/src/lib/libmisc/error/error.h b/c/src/lib/libmisc/error/error.h index 621ee16f65..e4d8c77200 100644 --- a/c/src/lib/libmisc/error/error.h +++ b/c/src/lib/libmisc/error/error.h @@ -1,8 +1,4 @@ - /* - * @(#)error.h 1.3 - 95/10/25 - * - * * Defines and externs for rtems error reporting * * $Id$ @@ -24,7 +20,12 @@ const char *rtems_status_text(rtems_status_code); int rtems_error(int error_code, const char *printf_format, ...); +#ifdef __GNUC__ +void rtems_panic(const char *printf_format, ...) + __attribute__ ((__noreturn__)); +#else void rtems_panic(const char *printf_format, ...); +#endif extern int rtems_panic_in_progress; diff --git a/c/src/lib/libmisc/monitor/mon-command.c b/c/src/lib/libmisc/monitor/mon-command.c index d231b3197a..87d31dfa2a 100644 --- a/c/src/lib/libmisc/monitor/mon-command.c +++ b/c/src/lib/libmisc/monitor/mon-command.c @@ -1,7 +1,4 @@ /* - * @(#)command.c 1.5 - 95/08/02 - * - * * Command parsing routines for RTEMS monitor * * TODO: diff --git a/c/src/lib/libmisc/monitor/mon-config.c b/c/src/lib/libmisc/monitor/mon-config.c index 13d41cae1a..f5c9f6f093 100644 --- a/c/src/lib/libmisc/monitor/mon-config.c +++ b/c/src/lib/libmisc/monitor/mon-config.c @@ -1,7 +1,4 @@ /* - * @(#)config.c 1.5 - 95/08/02 - * - * * RTEMS Config display support * * TODO diff --git a/c/src/lib/libmisc/monitor/mon-dname.c b/c/src/lib/libmisc/monitor/mon-dname.c index ad029f2400..e6993e18f7 100644 --- a/c/src/lib/libmisc/monitor/mon-dname.c +++ b/c/src/lib/libmisc/monitor/mon-dname.c @@ -1,7 +1,4 @@ /* - * @(#)dname.c 1.5 - 96/01/03 - * - * * RTEMS monitor driver names support. * * There are 2 "driver" things the monitor knows about. diff --git a/c/src/lib/libmisc/monitor/mon-driver.c b/c/src/lib/libmisc/monitor/mon-driver.c index c12ac778ec..d5cff24a19 100644 --- a/c/src/lib/libmisc/monitor/mon-driver.c +++ b/c/src/lib/libmisc/monitor/mon-driver.c @@ -1,7 +1,4 @@ /* - * @(#)driver.c 1.4 - 95/08/02 - * - * * RTEMS monitor IO (device drivers) support * * There are 2 "driver" things the monitor knows about. diff --git a/c/src/lib/libmisc/monitor/mon-extension.c b/c/src/lib/libmisc/monitor/mon-extension.c index 481a21e7dd..4afecaa617 100644 --- a/c/src/lib/libmisc/monitor/mon-extension.c +++ b/c/src/lib/libmisc/monitor/mon-extension.c @@ -1,7 +1,4 @@ /* - * @(#)extension.c 1.6 - 95/09/25 - * - * * RTEMS Monitor extension support * * $Id$ diff --git a/c/src/lib/libmisc/monitor/mon-itask.c b/c/src/lib/libmisc/monitor/mon-itask.c index 31cccce2b5..5ce4b55270 100644 --- a/c/src/lib/libmisc/monitor/mon-itask.c +++ b/c/src/lib/libmisc/monitor/mon-itask.c @@ -1,8 +1,5 @@ /* - * @(#)itask.c 1.6 - 96/01/03 - * - * - * RTEMS Monitor init task support + * RTEMS Monitor init task support * * $Id$ */ diff --git a/c/src/lib/libmisc/monitor/mon-manager.c b/c/src/lib/libmisc/monitor/mon-manager.c index d36ec926b6..af8d530d3b 100644 --- a/c/src/lib/libmisc/monitor/mon-manager.c +++ b/c/src/lib/libmisc/monitor/mon-manager.c @@ -1,9 +1,6 @@ /* - * @(#)manager.c 1.4 - 96/01/03 - * - * - * RTEMS Monitor "manager" support. - * Used to traverse object (chain) lists and print them out. + * RTEMS Monitor "manager" support. + * Used to traverse object (chain) lists and print them out. * * $Id$ */ diff --git a/c/src/lib/libmisc/monitor/mon-monitor.c b/c/src/lib/libmisc/monitor/mon-monitor.c index 7cf666f78e..a5a3fab131 100644 --- a/c/src/lib/libmisc/monitor/mon-monitor.c +++ b/c/src/lib/libmisc/monitor/mon-monitor.c @@ -1,8 +1,4 @@ /* - * @(#)monitor.c 1.23 - 96/01/03 - * - * - * * RTEMS monitor main body * * TODO: @@ -18,7 +14,7 @@ * should have a separate monitor FILE stream (ala the debugger) * remote request/response stuff should be cleaned up * maybe we can use real rpc?? - * 'info' commadn to print out: + * 'info' command to print out: * interrupt stack location, direction and size * floating point config stuff * interrupt config stuff @@ -262,6 +258,18 @@ rtems_monitor_wakeup(void) status = rtems_event_send(rtems_monitor_task_id, MONITOR_WAKEUP_EVENT); } +void +rtems_monitor_debugger_cmd( + int argc, + char **argv, + unsigned32 command_arg, + boolean verbose +) +{ +#ifdef CPU_INVOKE_DEBUGGER + CPU_INVOKE_DEBUGGER; +#endif +} void rtems_monitor_pause_cmd( @@ -302,19 +310,6 @@ rtems_monitor_continue_cmd( rtems_monitor_suspend(RTEMS_NO_TIMEOUT); } -void -rtems_monitor_debugger_cmd( - int argc, - char **argv, - unsigned32 command_arg, - boolean verbose -) -{ -#ifdef CPU_INVOKE_DEBUGGER - CPU_INVOKE_DEBUGGER; -#endif -} - void rtems_monitor_node_cmd( int argc, @@ -340,8 +335,10 @@ rtems_monitor_node_cmd( break; } - if ((new_node >= 1) && (new_node <= _Configuration_MP_table->maximum_nodes)) - rtems_monitor_default_node = new_node; + if ((new_node >= 1) && + _Configuration_MP_table && + (new_node <= _Configuration_MP_table->maximum_nodes)) + rtems_monitor_default_node = new_node; } @@ -383,11 +380,7 @@ rtems_monitor_symbols_loadup(void) if (rtems_monitor_symbols == 0) return; -#ifdef SIMHPPA - fp = fdopen(8, "r"); /* don't ask; don't tell */ -#else fp = fopen("symbols", "r"); -#endif if (fp == 0) return; diff --git a/c/src/lib/libmisc/monitor/mon-mpci.c b/c/src/lib/libmisc/monitor/mon-mpci.c index f8e50d0b85..5c4d2c2cb3 100644 --- a/c/src/lib/libmisc/monitor/mon-mpci.c +++ b/c/src/lib/libmisc/monitor/mon-mpci.c @@ -1,7 +1,4 @@ /* - * @(#)mpci.c 1.6 - 95/08/02 - * - * * RTEMS MPCI Config display support * * TODO diff --git a/c/src/lib/libmisc/monitor/mon-object.c b/c/src/lib/libmisc/monitor/mon-object.c index eb590470d8..0dfc6513d2 100644 --- a/c/src/lib/libmisc/monitor/mon-object.c +++ b/c/src/lib/libmisc/monitor/mon-object.c @@ -1,7 +1,4 @@ /* - * @(#)object.c 1.9 - 96/01/03 - * - * * RTEMS Monitor "object" support. * * Used to traverse object lists and print them out. @@ -341,7 +338,7 @@ rtems_monitor_object_cmd( for (arg=1; argv[arg]; arg++) { - id = (rtems_id) strtoul(argv[arg], 0, 0); + id = (rtems_id) strtoul(argv[arg], 0, 16); id = rtems_monitor_id_fixup(id, default_node, type); type = (rtems_monitor_object_type_t) rtems_get_class(id); diff --git a/c/src/lib/libmisc/monitor/mon-prmisc.c b/c/src/lib/libmisc/monitor/mon-prmisc.c index 6003695195..030bd020da 100644 --- a/c/src/lib/libmisc/monitor/mon-prmisc.c +++ b/c/src/lib/libmisc/monitor/mon-prmisc.c @@ -1,7 +1,4 @@ /* - * @(#)prmisc.c 1.9 - 95/08/02 - * - * * Print misc stuff for the monitor dump routines * Each routine returns the number of characters it output. * diff --git a/c/src/lib/libmisc/monitor/mon-queue.c b/c/src/lib/libmisc/monitor/mon-queue.c index a72a371bff..08c1d9474e 100644 --- a/c/src/lib/libmisc/monitor/mon-queue.c +++ b/c/src/lib/libmisc/monitor/mon-queue.c @@ -1,6 +1,4 @@ /* - * @(#)queue.c 1.5 - 95/07/31 - * * $Id$ */ diff --git a/c/src/lib/libmisc/monitor/mon-server.c b/c/src/lib/libmisc/monitor/mon-server.c index d492c5e9a2..cc26718c27 100644 --- a/c/src/lib/libmisc/monitor/mon-server.c +++ b/c/src/lib/libmisc/monitor/mon-server.c @@ -1,8 +1,5 @@ /* - * @(#)server.c 1.5 - 96/01/03 - * - * - * RTEMS monitor server (handles requests for info from RTEMS monitors + * RTEMS monitor server (handles requests for info from RTEMS monitors * running on other nodes) * * $Id$ diff --git a/c/src/lib/libmisc/monitor/mon-symbols.c b/c/src/lib/libmisc/monitor/mon-symbols.c index 942209fc2d..6c6589d38f 100644 --- a/c/src/lib/libmisc/monitor/mon-symbols.c +++ b/c/src/lib/libmisc/monitor/mon-symbols.c @@ -1,11 +1,3 @@ -/* - * @(#)symbols.c 1.10 - 95/08/02 - * - * $Id$ - */ - -/* #define qsort _quicksort */ - /* * File: symbols.c * @@ -15,6 +7,8 @@ * * * TODO: + * + * $Id$ */ #define __RTEMS_VIOLATE_KERNEL_VISIBILITY__ @@ -50,11 +44,6 @@ rtems_symbol_table_destroy(rtems_symbol_table_t *table) if (table->addresses) (void) free(table->addresses); table->addresses = 0; - - if (table->symbols) - (void) free(table->symbols); - table->symbols = 0; - p = table->string_buffer_head; while (p) { @@ -93,11 +82,6 @@ rtems_symbol_create( table->addresses = (rtems_symbol_t *) realloc((void *) table->addresses, newsize * sizeof(rtems_symbol_t)); if (table->addresses == 0) /* blew it; lost orig */ goto failed; - - table->symbols = (rtems_symbol_t *) realloc((void *) table->symbols, newsize * sizeof(rtems_symbol_t)); - if (table->symbols == 0) /* blew it; lost orig */ - goto failed; - table->size = newsize; } @@ -129,9 +113,6 @@ rtems_symbol_create( (void) strcpy(sp->name, name); table->strings_next += symbol_length; - - table->symbols[table->next] = *sp; - table->sorted = 0; table->next++; @@ -147,7 +128,7 @@ failed: * Qsort entry point for compare by address */ -int +static int rtems_symbol_compare(const void *e1, const void *e2) { @@ -162,48 +143,20 @@ rtems_symbol_compare(const void *e1, return 0; } -/* - * Qsort entry point for compare by string name (case independent) - */ - -int -rtems_symbol_string_compare(const void *e1, - const void *e2) -{ - rtems_symbol_t *s1, *s2; - s1 = (rtems_symbol_t *) e1; - s2 = (rtems_symbol_t *) e2; - - return strcasecmp(s1->name, s2->name); -} - /* * Sort the symbol table using qsort */ -void +static void rtems_symbol_sort(rtems_symbol_table_t *table) { -#ifdef RTEMS_ON_SIMULATOR - printf("Sorting symbols ... "); /* so slow we need a msg */ - fflush(stdout); -#endif - qsort((void *) table->addresses, (size_t) table->next, sizeof(rtems_symbol_t), rtems_symbol_compare); - - qsort((void *) table->symbols, (size_t) table->next, - sizeof(rtems_symbol_t), rtems_symbol_string_compare); - -#ifdef RTEMS_ON_SIMULATOR - /* so slow we need a msg */ - printf("done\n"); -#endif - table->sorted = 1; } + /* * Search the symbol table by address * This code based on CYGNUS newlib bsearch, but changed @@ -262,42 +215,79 @@ rtems_symbol_value_lookup( } /* - * Search the symbol table by string name (case independent) + * Search the symbol table for the exact matching address. + * If the symbol table has already been sorted, then + * call the regular symbol value lookup, however, it it + * has not yet been sorted, search it sequentially. + * This routine is primarily used for low level symbol + * lookups (eg. from exception handler and interrupt routines) + * where the penality of sorted is not wanted and where + * an exact match is needed such that symbol table order + * is not important. */ - -rtems_symbol_t * -rtems_symbol_name_lookup( +const rtems_symbol_t * +rtems_symbol_value_lookup_exact( rtems_symbol_table_t *table, - char *name + rtems_unsigned32 value ) { - rtems_symbol_t *sp = 0; - rtems_symbol_t key; + int s; + rtems_symbol_t *sp; if (table == 0) + { table = rtems_monitor_symbols; + if (table == 0) + return NULL; + } + + if (table->sorted) + { + sp = rtems_symbol_value_lookup(table, value); + if ( rtems_symbol_value(sp) == value ) + return sp; + else + return NULL; /* not an exact match */ + } + + for (s = 0, sp = table->addresses; s < table->next; s++, sp++) + { + if ( sp->value == value ) + return sp; + } - if ((table == 0) || (name == 0)) - goto done; + return NULL; - if (table->sorted == 0) - rtems_symbol_sort(table); +} - /* - * dummy up one for bsearch() - */ - key.name = name; - key.value = 0; +/* + * Search the symbol table by string name (case independent) + */ - sp = (rtems_symbol_t *) bsearch((const void *) &key, - (const void *) table->symbols, - (size_t) table->next, - sizeof(rtems_symbol_t), - rtems_symbol_string_compare); +rtems_symbol_t * +rtems_symbol_name_lookup( + rtems_symbol_table_t *table, + char *name + ) +{ + int s; + rtems_symbol_t *sp; -done: - return sp; + if (table == 0) + { + table = rtems_monitor_symbols; + if (table == 0) + return NULL; + } + + for (s = 0, sp = table->addresses; s < table->next; s++, sp++) + { + if ( strcasecmp(sp->name, name) == 0 ) + return sp; + } + + return NULL; } void * @@ -325,7 +315,7 @@ rtems_monitor_symbol_next( _Thread_Disable_dispatch(); *next_id += 1; - return (void *) (table->symbols + n); + return (void *) (table->addresses + n); failed: *next_id = RTEMS_OBJECT_ID_FINAL; @@ -438,7 +428,7 @@ rtems_monitor_symbol_dump_all( if (table->sorted == 0) rtems_symbol_sort(table); - for (s = 0, sp = table->symbols; s < table->next; s++, sp++) + for (s = 0, sp = table->addresses; s < table->next; s++, sp++) { rtems_monitor_symbol_t canonical_symbol; diff --git a/c/src/lib/libmisc/monitor/mon-task.c b/c/src/lib/libmisc/monitor/mon-task.c index 95b650d429..b1a7938eb5 100644 --- a/c/src/lib/libmisc/monitor/mon-task.c +++ b/c/src/lib/libmisc/monitor/mon-task.c @@ -1,7 +1,4 @@ /* - * @(#)task.c 1.9 - 95/08/01 - * - * * RTEMS Monitor task support * * $Id$ diff --git a/c/src/lib/libmisc/monitor/monitor.h b/c/src/lib/libmisc/monitor/monitor.h index 6379254158..8a86b2c7d0 100644 --- a/c/src/lib/libmisc/monitor/monitor.h +++ b/c/src/lib/libmisc/monitor/monitor.h @@ -1,10 +1,3 @@ -/* - * @(#)monitor.h 1.21 - 96/01/03 - * - * - * monitor.h,v 1.3 1995/09/29 17:19:02 joel Exp - */ - /* * File: monitor.h * @@ -12,6 +5,8 @@ * The RTEMS monitor task include file. * * TODO: + * + * $Id$ */ #ifndef __MONITOR_H @@ -25,7 +20,7 @@ extern "C" { #endif /* - * XXX this should be in rtems proper when type becomes part of id + * Monitor types are derived from rtems object classes */ typedef enum { @@ -306,7 +301,7 @@ typedef void (*rtems_monitor_object_dump_header_fn)(boolean); typedef void (*rtems_monitor_object_dump_fn)(void *, boolean); typedef struct { - rtems_monitor_object_type_t type; + rtems_monitor_object_type_t type; void *object_information; int size; /* of canonical object */ rtems_monitor_object_next_fn next; @@ -419,6 +414,7 @@ void rtems_symbol_table_destroy(rtems_symbol_table_t *table); rtems_symbol_t *rtems_symbol_create(rtems_symbol_table_t *, char *, unsigned32); rtems_symbol_t *rtems_symbol_value_lookup(rtems_symbol_table_t *, unsigned32); +const rtems_symbol_t *rtems_symbol_value_lookup_exact(rtems_symbol_table_t *, unsigned32); rtems_symbol_t *rtems_symbol_name_lookup(rtems_symbol_table_t *, char *); void *rtems_monitor_symbol_next(void *object_info, rtems_monitor_symbol_t *, rtems_id *); void rtems_monitor_symbol_canonical(rtems_monitor_symbol_t *, rtems_symbol_t *); diff --git a/c/src/lib/libmisc/monitor/symbols.h b/c/src/lib/libmisc/monitor/symbols.h index 736e7a074b..061ccdd952 100644 --- a/c/src/lib/libmisc/monitor/symbols.h +++ b/c/src/lib/libmisc/monitor/symbols.h @@ -1,7 +1,4 @@ /* - * @(#)symbols.h 1.3 - 95/06/09 - * - * * RTEMS monitor symbol table functions * * Description: @@ -47,14 +44,6 @@ typedef struct { rtems_symbol_t *addresses; /* symbol array by address */ - /* - * String list -- sorted by name (when we do a lookup) - * This is a duplicate of the info in table->addresses, but it's - * pretty small, so I don't worry about it. - */ - - rtems_symbol_t *symbols; /* symbol array */ - /* * String pool, unsorted, a list of blocks of string data */ diff --git a/c/src/lib/libmisc/stackchk/check.c b/c/src/lib/libmisc/stackchk/check.c index bf5bda7fdc..3d06d1dd12 100644 --- a/c/src/lib/libmisc/stackchk/check.c +++ b/c/src/lib/libmisc/stackchk/check.c @@ -20,6 +20,19 @@ #include +/* + * HACK + * the stack dump information should be printed by a "fatal" extension. + * Fatal extensions only get called via rtems_fatal_error_occurred() + * and not when rtems_shutdown_executive() is called. + * I hope/think this is changing so that fatal extensions are renamed + * to "shutdown" extensions. + * When that happens, this #define should be deleted and all the code + * it marks. + */ +#define DONT_USE_FATAL_EXTENSION + + extern rtems_configuration_table BSP_Configuration; #include @@ -49,7 +62,11 @@ rtems_extensions_table Stack_check_Extension_table = { Stack_check_Switch_extension, /* task_switch */ Stack_check_Begin_extension, /* task_begin */ 0, /* task_exitted */ +#ifdef DONT_USE_FATAL_EXTENSION + 0, /* fatal */ +#else Stack_check_Fatal_extension, /* fatal */ +#endif }; /* @@ -167,10 +184,6 @@ void Stack_check_Initialize( void ) Stack_check_Blown_task = 0; -#ifdef STACK_CHECKER_REPORT_USAGE - atexit( Stack_check_Dump_usage ); -#endif - /* * If installed by a task, that task will not get setup properly * since it missed out on the create hook. This will cause a @@ -217,6 +230,17 @@ void Stack_check_Initialize( void ) stack_check_dope_stack(&stack_check_interrupt_stack); } +#ifdef DONT_USE_FATAL_EXTENSION +#ifdef RTEMS_DEBUG + /* + * this would normally be called by a fatal extension + * handler, but we don't run fatal extensions unless + * we fatal error. + */ + atexit(Stack_check_Dump_usage); +#endif +#endif + stack_check_initialized = 1; } @@ -431,14 +455,16 @@ void Stack_check_Dump_threads_usage( * Stack_check_Fatal_extension */ -void Stack_check_Fatal_extension( +void Stack_check_Fatal_extension( Internal_errors_Source source, boolean is_internal, unsigned32 status ) { +#ifndef DONT_USE_FATAL_EXTENSION if (status == 0) Stack_check_Dump_usage(); +#endif } -- cgit v1.2.3