Vergil Cola
/
MQTTGateway2
Fork of my original MQTTGateway
MQTTSManager/MQTTPacket/StackTrace.h@0:a1734fe1ec4b, 2017-04-08 (annotated)
- Committer:
- vpcola
- Date:
- Sat Apr 08 14:43:14 2017 +0000
- Revision:
- 0:a1734fe1ec4b
Initial commit
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
vpcola | 0:a1734fe1ec4b | 1 | /******************************************************************************* |
vpcola | 0:a1734fe1ec4b | 2 | * Copyright (c) 2014 IBM Corp. |
vpcola | 0:a1734fe1ec4b | 3 | * |
vpcola | 0:a1734fe1ec4b | 4 | * All rights reserved. This program and the accompanying materials |
vpcola | 0:a1734fe1ec4b | 5 | * are made available under the terms of the Eclipse Public License v1.0 |
vpcola | 0:a1734fe1ec4b | 6 | * and Eclipse Distribution License v1.0 which accompany this distribution. |
vpcola | 0:a1734fe1ec4b | 7 | * |
vpcola | 0:a1734fe1ec4b | 8 | * The Eclipse Public License is available at |
vpcola | 0:a1734fe1ec4b | 9 | * http://www.eclipse.org/legal/epl-v10.html |
vpcola | 0:a1734fe1ec4b | 10 | * and the Eclipse Distribution License is available at |
vpcola | 0:a1734fe1ec4b | 11 | * http://www.eclipse.org/org/documents/edl-v10.php. |
vpcola | 0:a1734fe1ec4b | 12 | * |
vpcola | 0:a1734fe1ec4b | 13 | * Contributors: |
vpcola | 0:a1734fe1ec4b | 14 | * Ian Craggs - initial API and implementation and/or initial documentation |
vpcola | 0:a1734fe1ec4b | 15 | * Ian Craggs - fix for bug #434081 |
vpcola | 0:a1734fe1ec4b | 16 | *******************************************************************************/ |
vpcola | 0:a1734fe1ec4b | 17 | |
vpcola | 0:a1734fe1ec4b | 18 | #ifndef STACKTRACE_H_ |
vpcola | 0:a1734fe1ec4b | 19 | #define STACKTRACE_H_ |
vpcola | 0:a1734fe1ec4b | 20 | |
vpcola | 0:a1734fe1ec4b | 21 | #include <stdio.h> |
vpcola | 0:a1734fe1ec4b | 22 | #define NOSTACKTRACE 1 |
vpcola | 0:a1734fe1ec4b | 23 | |
vpcola | 0:a1734fe1ec4b | 24 | #if defined(NOSTACKTRACE) |
vpcola | 0:a1734fe1ec4b | 25 | #define FUNC_ENTRY |
vpcola | 0:a1734fe1ec4b | 26 | #define FUNC_ENTRY_NOLOG |
vpcola | 0:a1734fe1ec4b | 27 | #define FUNC_ENTRY_MED |
vpcola | 0:a1734fe1ec4b | 28 | #define FUNC_ENTRY_MAX |
vpcola | 0:a1734fe1ec4b | 29 | #define FUNC_EXIT |
vpcola | 0:a1734fe1ec4b | 30 | #define FUNC_EXIT_NOLOG |
vpcola | 0:a1734fe1ec4b | 31 | #define FUNC_EXIT_MED |
vpcola | 0:a1734fe1ec4b | 32 | #define FUNC_EXIT_MAX |
vpcola | 0:a1734fe1ec4b | 33 | #define FUNC_EXIT_RC(x) |
vpcola | 0:a1734fe1ec4b | 34 | #define FUNC_EXIT_MED_RC(x) |
vpcola | 0:a1734fe1ec4b | 35 | #define FUNC_EXIT_MAX_RC(x) |
vpcola | 0:a1734fe1ec4b | 36 | |
vpcola | 0:a1734fe1ec4b | 37 | #else |
vpcola | 0:a1734fe1ec4b | 38 | |
vpcola | 0:a1734fe1ec4b | 39 | #if defined(WIN32) |
vpcola | 0:a1734fe1ec4b | 40 | #define inline __inline |
vpcola | 0:a1734fe1ec4b | 41 | #define FUNC_ENTRY StackTrace_entry(__FUNCTION__, __LINE__, TRACE_MINIMUM) |
vpcola | 0:a1734fe1ec4b | 42 | #define FUNC_ENTRY_NOLOG StackTrace_entry(__FUNCTION__, __LINE__, -1) |
vpcola | 0:a1734fe1ec4b | 43 | #define FUNC_ENTRY_MED StackTrace_entry(__FUNCTION__, __LINE__, TRACE_MEDIUM) |
vpcola | 0:a1734fe1ec4b | 44 | #define FUNC_ENTRY_MAX StackTrace_entry(__FUNCTION__, __LINE__, TRACE_MAXIMUM) |
vpcola | 0:a1734fe1ec4b | 45 | #define FUNC_EXIT StackTrace_exit(__FUNCTION__, __LINE__, NULL, TRACE_MINIMUM) |
vpcola | 0:a1734fe1ec4b | 46 | #define FUNC_EXIT_NOLOG StackTrace_exit(__FUNCTION__, __LINE__, -1) |
vpcola | 0:a1734fe1ec4b | 47 | #define FUNC_EXIT_MED StackTrace_exit(__FUNCTION__, __LINE__, NULL, TRACE_MEDIUM) |
vpcola | 0:a1734fe1ec4b | 48 | #define FUNC_EXIT_MAX StackTrace_exit(__FUNCTION__, __LINE__, NULL, TRACE_MAXIMUM) |
vpcola | 0:a1734fe1ec4b | 49 | #define FUNC_EXIT_RC(x) StackTrace_exit(__FUNCTION__, __LINE__, &x, TRACE_MINIMUM) |
vpcola | 0:a1734fe1ec4b | 50 | #define FUNC_EXIT_MED_RC(x) StackTrace_exit(__FUNCTION__, __LINE__, &x, TRACE_MEDIUM) |
vpcola | 0:a1734fe1ec4b | 51 | #define FUNC_EXIT_MAX_RC(x) StackTrace_exit(__FUNCTION__, __LINE__, &x, TRACE_MAXIMUM) |
vpcola | 0:a1734fe1ec4b | 52 | #else |
vpcola | 0:a1734fe1ec4b | 53 | #define FUNC_ENTRY StackTrace_entry(__func__, __LINE__, TRACE_MINIMUM) |
vpcola | 0:a1734fe1ec4b | 54 | #define FUNC_ENTRY_NOLOG StackTrace_entry(__func__, __LINE__, -1) |
vpcola | 0:a1734fe1ec4b | 55 | #define FUNC_ENTRY_MED StackTrace_entry(__func__, __LINE__, TRACE_MEDIUM) |
vpcola | 0:a1734fe1ec4b | 56 | #define FUNC_ENTRY_MAX StackTrace_entry(__func__, __LINE__, TRACE_MAXIMUM) |
vpcola | 0:a1734fe1ec4b | 57 | #define FUNC_EXIT StackTrace_exit(__func__, __LINE__, NULL, TRACE_MINIMUM) |
vpcola | 0:a1734fe1ec4b | 58 | #define FUNC_EXIT_NOLOG StackTrace_exit(__func__, __LINE__, NULL, -1) |
vpcola | 0:a1734fe1ec4b | 59 | #define FUNC_EXIT_MED StackTrace_exit(__func__, __LINE__, NULL, TRACE_MEDIUM) |
vpcola | 0:a1734fe1ec4b | 60 | #define FUNC_EXIT_MAX StackTrace_exit(__func__, __LINE__, NULL, TRACE_MAXIMUM) |
vpcola | 0:a1734fe1ec4b | 61 | #define FUNC_EXIT_RC(x) StackTrace_exit(__func__, __LINE__, &x, TRACE_MINIMUM) |
vpcola | 0:a1734fe1ec4b | 62 | #define FUNC_EXIT_MED_RC(x) StackTrace_exit(__func__, __LINE__, &x, TRACE_MEDIUM) |
vpcola | 0:a1734fe1ec4b | 63 | #define FUNC_EXIT_MAX_RC(x) StackTrace_exit(__func__, __LINE__, &x, TRACE_MAXIMUM) |
vpcola | 0:a1734fe1ec4b | 64 | |
vpcola | 0:a1734fe1ec4b | 65 | void StackTrace_entry(const char* name, int line, int trace); |
vpcola | 0:a1734fe1ec4b | 66 | void StackTrace_exit(const char* name, int line, void* return_value, int trace); |
vpcola | 0:a1734fe1ec4b | 67 | |
vpcola | 0:a1734fe1ec4b | 68 | void StackTrace_printStack(FILE* dest); |
vpcola | 0:a1734fe1ec4b | 69 | char* StackTrace_get(unsigned long); |
vpcola | 0:a1734fe1ec4b | 70 | |
vpcola | 0:a1734fe1ec4b | 71 | #endif |
vpcola | 0:a1734fe1ec4b | 72 | |
vpcola | 0:a1734fe1ec4b | 73 | #endif |
vpcola | 0:a1734fe1ec4b | 74 | |
vpcola | 0:a1734fe1ec4b | 75 | |
vpcola | 0:a1734fe1ec4b | 76 | |
vpcola | 0:a1734fe1ec4b | 77 | |
vpcola | 0:a1734fe1ec4b | 78 | #endif /* STACKTRACE_H_ */ |