Low level MQTTSN packet library, part of the Eclipse Paho project: http://eclipse.org/paho

Dependents:   MQTTSN sara-n200-hello-mqtt-sn MQTTSN_2

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers StackTrace.h Source File

StackTrace.h

00001 /*******************************************************************************
00002  * Copyright (c) 2014 IBM Corp.
00003  *
00004  * All rights reserved. This program and the accompanying materials
00005  * are made available under the terms of the Eclipse Public License v1.0
00006  * and Eclipse Distribution License v1.0 which accompany this distribution.
00007  *
00008  * The Eclipse Public License is available at
00009  *    http://www.eclipse.org/legal/epl-v10.html
00010  * and the Eclipse Distribution License is available at
00011  *   http://www.eclipse.org/org/documents/edl-v10.php.
00012  *
00013  * Contributors:
00014  *    Ian Craggs - initial API and implementation and/or initial documentation
00015  *******************************************************************************/
00016 
00017 #ifndef STACKTRACE_H_
00018 #define STACKTRACE_H_
00019 
00020 #include <stdio.h>
00021 #define NOSTACKTRACE 1
00022 
00023 #if defined(NOSTACKTRACE)
00024 #define FUNC_ENTRY
00025 #define FUNC_ENTRY_NOLOG
00026 #define FUNC_ENTRY_MED
00027 #define FUNC_ENTRY_MAX
00028 #define FUNC_EXIT
00029 #define FUNC_EXIT_NOLOG
00030 #define FUNC_EXIT_MED
00031 #define FUNC_EXIT_MAX
00032 #define FUNC_EXIT_RC(x)
00033 #define FUNC_EXIT_MED_RC(x)
00034 #define FUNC_EXIT_MAX_RC(x)
00035 #else
00036 #if defined(WIN32)
00037 #define inline __inline
00038 #define FUNC_ENTRY StackTrace_entry(__FUNCTION__, __LINE__, TRACE_MINIMUM)
00039 #define FUNC_ENTRY_NOLOG StackTrace_entry(__FUNCTION__, __LINE__, -1)
00040 #define FUNC_ENTRY_MED StackTrace_entry(__FUNCTION__, __LINE__, TRACE_MEDIUM)
00041 #define FUNC_ENTRY_MAX StackTrace_entry(__FUNCTION__, __LINE__, TRACE_MAXIMUM)
00042 #define FUNC_EXIT StackTrace_exit(__FUNCTION__, __LINE__, NULL, TRACE_MINIMUM)
00043 #define FUNC_EXIT_NOLOG StackTrace_exit(__FUNCTION__, __LINE__, -1)
00044 #define FUNC_EXIT_MED StackTrace_exit(__FUNCTION__, __LINE__, NULL, TRACE_MEDIUM)
00045 #define FUNC_EXIT_MAX StackTrace_exit(__FUNCTION__, __LINE__, NULL, TRACE_MAXIMUM)
00046 #define FUNC_EXIT_RC(x) StackTrace_exit(__FUNCTION__, __LINE__, &x, TRACE_MINIMUM)
00047 #define FUNC_EXIT_MED_RC(x) StackTrace_exit(__FUNCTION__, __LINE__, &x, TRACE_MEDIUM)
00048 #define FUNC_EXIT_MAX_RC(x) StackTrace_exit(__FUNCTION__, __LINE__, &x, TRACE_MAXIMUM)
00049 #else
00050 #define FUNC_ENTRY StackTrace_entry(__func__, __LINE__, TRACE_MINIMUM)
00051 #define FUNC_ENTRY_NOLOG StackTrace_entry(__func__, __LINE__, -1)
00052 #define FUNC_ENTRY_MED StackTrace_entry(__func__, __LINE__, TRACE_MEDIUM)
00053 #define FUNC_ENTRY_MAX StackTrace_entry(__func__, __LINE__, TRACE_MAXIMUM)
00054 #define FUNC_EXIT StackTrace_exit(__func__, __LINE__, NULL, TRACE_MINIMUM)
00055 #define FUNC_EXIT_NOLOG StackTrace_exit(__func__, __LINE__, NULL, -1)
00056 #define FUNC_EXIT_MED StackTrace_exit(__func__, __LINE__, NULL, TRACE_MEDIUM)
00057 #define FUNC_EXIT_MAX StackTrace_exit(__func__, __LINE__, NULL, TRACE_MAXIMUM)
00058 #define FUNC_EXIT_RC(x) StackTrace_exit(__func__, __LINE__, &x, TRACE_MINIMUM)
00059 #define FUNC_EXIT_MED_RC(x) StackTrace_exit(__func__, __LINE__, &x, TRACE_MEDIUM)
00060 #define FUNC_EXIT_MAX_RC(x) StackTrace_exit(__func__, __LINE__, &x, TRACE_MAXIMUM)
00061 #endif
00062 #endif
00063 
00064 void StackTrace_entry(const char* name, int line, int trace);
00065 void StackTrace_exit(const char* name, int line, void* return_value, int trace);
00066 
00067 void StackTrace_printStack(FILE* dest);
00068 char* StackTrace_get(unsigned long);
00069 
00070 
00071 #endif /* STACKTRACE_H_ */
00072