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

Changeset c7bbf029 in mainline


Ignore:
Timestamp:
2011-04-21T15:45:31Z (11 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master
Children:
7da90cd
Parents:
d161715
Message:

improve stack traces and assertions
reduce header files pollution

Location:
uspace
Files:
1 added
15 edited

Legend:

Unmodified
Added
Removed
  • uspace/lib/block/libblock.c

    rd161715 rc7bbf029  
    5151#include <macros.h>
    5252#include <mem.h>
     53#include <malloc.h>
     54#include <stdio.h>
    5355#include <sys/typefmt.h>
    5456#include <stacktrace.h>
  • uspace/lib/c/Makefile

    rd161715 rc7bbf029  
    113113        generic/arg_parse.c \
    114114        generic/sort.c \
    115         generic/stats.c
     115        generic/stats.c \
     116        generic/assert.c \
    116117
    117118SOURCES = \
  • uspace/lib/c/arch/ia32/include/config.h

    rd161715 rc7bbf029  
    3636#define LIBC_ia32_CONFIG_H_
    3737
    38 #define PAGE_WIDTH      12
    39 #define PAGE_SIZE       (1 << PAGE_WIDTH)
     38#define PAGE_WIDTH  12
     39#define PAGE_SIZE   (1 << PAGE_WIDTH)
     40
     41#define USER_ADDRESS_SPACE_START_ARCH  UINT32_C(0x00000000)
     42#define USER_ADDRESS_SPACE_END_ARCH    UINT32_C(0x7fffffff)
    4043
    4144#endif
  • uspace/lib/c/arch/ia32/src/stacktrace.c

    rd161715 rc7bbf029  
    3535 */
    3636
     37#include <libarch/config.h>
    3738#include <sys/types.h>
    3839#include <bool.h>
    39 
    4040#include <stacktrace.h>
    4141
    42 #define FRAME_OFFSET_FP_PREV    0
    43 #define FRAME_OFFSET_RA         4
     42#define FRAME_OFFSET_FP_PREV  0
     43#define FRAME_OFFSET_RA       4
    4444
    4545bool stacktrace_fp_valid(stacktrace_t *st, uintptr_t fp)
    4646{
    4747        (void) st;
    48         return fp != 0;
     48        return (fp != 0) && (fp <= USER_ADDRESS_SPACE_END_ARCH);
    4949}
    5050
  • uspace/lib/c/generic/async.c

    rd161715 rc7bbf029  
    102102#include <arch/barrier.h>
    103103#include <bool.h>
     104#include <stdlib.h>
     105#include <malloc.h>
    104106#include "private/async.h"
    105107
  • uspace/lib/c/generic/stacktrace.c

    rd161715 rc7bbf029  
    6161        stacktrace_prepare();
    6262        stacktrace_print_fp_pc(stacktrace_fp_get(), stacktrace_pc_get());
     63       
    6364        /*
    6465         * Prevent the tail call optimization of the previous call by
    6566         * making it a non-tail call.
    6667         */
    67         (void) stacktrace_fp_get();
     68       
     69        printf("-- end of stack trace --\n");
    6870}
    6971
  • uspace/lib/c/include/assert.h

    rd161715 rc7bbf029  
    4040 *
    4141 * If NDEBUG is not set, the assert() macro
    42  * evaluates expr and if it is false prints 
     42 * evaluates expr and if it is false prints
    4343 * error message and terminate program.
    4444 *
     
    4747 */
    4848
    49 #include <stdio.h>
    50 #include <stdlib.h>
    51 
    5249#ifndef NDEBUG
    5350
    5451#define assert(expr) \
    5552        do { \
    56                 if (!(expr)) { \
    57                         printf("Assertion failed (%s) at file '%s', " \
    58                             "line %d.\n", #expr, __FILE__, __LINE__); \
    59                         abort(); \
    60                 } \
     53                if (!(expr)) \
     54                        assert_abort(#expr, __FILE__, __LINE__); \
    6155        } while (0)
    6256
     
    6761#endif /* NDEBUG */
    6862
     63extern void assert_abort(const char *, const char *, unsigned int)
     64    __attribute__((noreturn));
     65
    6966#endif
    7067
  • uspace/srv/devman/devman.c

    rd161715 rc7bbf029  
    3939#include <devmap.h>
    4040#include <str_error.h>
     41#include <stdio.h>
    4142
    4243#include "devman.h"
  • uspace/srv/fs/fat/fat_fat.c

    rd161715 rc7bbf029  
    4747#include <assert.h>
    4848#include <fibril_synch.h>
     49#include <malloc.h>
    4950#include <mem.h>
    5051
  • uspace/srv/fs/fat/fat_idx.c

    rd161715 rc7bbf029  
    4444#include <assert.h>
    4545#include <fibril_synch.h>
     46#include <malloc.h>
    4647
    4748/** Each instance of this type describes one interval of freed VFS indices. */
  • uspace/srv/fs/fat/fat_ops.c

    rd161715 rc7bbf029  
    5555#include <sys/mman.h>
    5656#include <align.h>
     57#include <malloc.h>
    5758
    5859#define FAT_NODE(node)  ((node) ? (fat_node_t *) (node)->data : NULL)
  • uspace/srv/hw/netif/ne2000/dp8390.c

    rd161715 rc7bbf029  
    5353#include <byteorder.h>
    5454#include <errno.h>
     55#include <stdio.h>
    5556#include <libarch/ddi.h>
    5657#include <net/packet.h>
  • uspace/srv/ns/clonable.c

    rd161715 rc7bbf029  
    7878        if (list_empty(&cs_req)) {
    7979                /* There was no pending connection request. */
    80                 printf(NAME ": Unexpected clonable server.\n");
     80                printf("%s: Unexpected clonable server.\n", NAME);
    8181                ipc_answer_0(callid, EBUSY);
    8282                return;
  • uspace/srv/ns/service.c

    rd161715 rc7bbf029  
    3535#include <assert.h>
    3636#include <errno.h>
     37#include <stdio.h>
     38#include <malloc.h>
    3739#include "service.h"
    3840#include "ns.h"
  • uspace/srv/ns/task.c

    rd161715 rc7bbf029  
    3939#include <stdio.h>
    4040#include <macros.h>
     41#include <malloc.h>
    4142#include "task.h"
    4243#include "ns.h"
Note: See TracChangeset for help on using the changeset viewer.