MQTTPacket library (clone of https://os.mbed.com/teams/mqtt/code/MQTTPacket/)
Embed:
(wiki syntax)
Show/hide line numbers
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 * Ian Craggs - fix for bug #434081 00016 *******************************************************************************/ 00017 00018 #ifndef STACKTRACE_H_ 00019 #define STACKTRACE_H_ 00020 00021 #include <stdio.h> 00022 #define NOSTACKTRACE 1 00023 00024 #if defined(NOSTACKTRACE) 00025 #define FUNC_ENTRY 00026 #define FUNC_ENTRY_NOLOG 00027 #define FUNC_ENTRY_MED 00028 #define FUNC_ENTRY_MAX 00029 #define FUNC_EXIT 00030 #define FUNC_EXIT_NOLOG 00031 #define FUNC_EXIT_MED 00032 #define FUNC_EXIT_MAX 00033 #define FUNC_EXIT_RC(x) 00034 #define FUNC_EXIT_MED_RC(x) 00035 #define FUNC_EXIT_MAX_RC(x) 00036 00037 #else 00038 00039 #if defined(WIN32) 00040 #define inline __inline 00041 #define FUNC_ENTRY StackTrace_entry(__FUNCTION__, __LINE__, TRACE_MINIMUM) 00042 #define FUNC_ENTRY_NOLOG StackTrace_entry(__FUNCTION__, __LINE__, -1) 00043 #define FUNC_ENTRY_MED StackTrace_entry(__FUNCTION__, __LINE__, TRACE_MEDIUM) 00044 #define FUNC_ENTRY_MAX StackTrace_entry(__FUNCTION__, __LINE__, TRACE_MAXIMUM) 00045 #define FUNC_EXIT StackTrace_exit(__FUNCTION__, __LINE__, NULL, TRACE_MINIMUM) 00046 #define FUNC_EXIT_NOLOG StackTrace_exit(__FUNCTION__, __LINE__, -1) 00047 #define FUNC_EXIT_MED StackTrace_exit(__FUNCTION__, __LINE__, NULL, TRACE_MEDIUM) 00048 #define FUNC_EXIT_MAX StackTrace_exit(__FUNCTION__, __LINE__, NULL, TRACE_MAXIMUM) 00049 #define FUNC_EXIT_RC(x) StackTrace_exit(__FUNCTION__, __LINE__, &x, TRACE_MINIMUM) 00050 #define FUNC_EXIT_MED_RC(x) StackTrace_exit(__FUNCTION__, __LINE__, &x, TRACE_MEDIUM) 00051 #define FUNC_EXIT_MAX_RC(x) StackTrace_exit(__FUNCTION__, __LINE__, &x, TRACE_MAXIMUM) 00052 #else 00053 #define FUNC_ENTRY StackTrace_entry(__func__, __LINE__, TRACE_MINIMUM) 00054 #define FUNC_ENTRY_NOLOG StackTrace_entry(__func__, __LINE__, -1) 00055 #define FUNC_ENTRY_MED StackTrace_entry(__func__, __LINE__, TRACE_MEDIUM) 00056 #define FUNC_ENTRY_MAX StackTrace_entry(__func__, __LINE__, TRACE_MAXIMUM) 00057 #define FUNC_EXIT StackTrace_exit(__func__, __LINE__, NULL, TRACE_MINIMUM) 00058 #define FUNC_EXIT_NOLOG StackTrace_exit(__func__, __LINE__, NULL, -1) 00059 #define FUNC_EXIT_MED StackTrace_exit(__func__, __LINE__, NULL, TRACE_MEDIUM) 00060 #define FUNC_EXIT_MAX StackTrace_exit(__func__, __LINE__, NULL, TRACE_MAXIMUM) 00061 #define FUNC_EXIT_RC(x) StackTrace_exit(__func__, __LINE__, &x, TRACE_MINIMUM) 00062 #define FUNC_EXIT_MED_RC(x) StackTrace_exit(__func__, __LINE__, &x, TRACE_MEDIUM) 00063 #define FUNC_EXIT_MAX_RC(x) StackTrace_exit(__func__, __LINE__, &x, TRACE_MAXIMUM) 00064 00065 void StackTrace_entry(const char* name, int line, int trace); 00066 void StackTrace_exit(const char* name, int line, void* return_value, int trace); 00067 00068 void StackTrace_printStack(FILE* dest); 00069 char* StackTrace_get(unsigned long); 00070 00071 #endif 00072 00073 #endif 00074 00075 00076 00077 00078 #endif /* STACKTRACE_H_ */
Generated on Thu Jul 14 2022 11:12:53 by 1.7.2