1 /*! |
|
2 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: Definitions for key sequence recognition component. |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef KEYSEQUENCERECOGNITIONSERVICELOG_H |
|
19 #define KEYSEQUENCERECOGNITIONSERVICELOG_H |
|
20 |
|
21 #include <QDebug> |
|
22 |
|
23 class MethodEntryExitDebugPrint |
|
24 { |
|
25 public: |
|
26 MethodEntryExitDebugPrint(const char* methodDescription) |
|
27 : |
|
28 m_methodDescription(0), |
|
29 m_stackFrame(0) |
|
30 { |
|
31 #ifdef __WINS__ |
|
32 // Workaround for exception detection as MSL runtime has a bug in |
|
33 // std::uncaught_exception() implementation. |
|
34 int stackFrame = 0; |
|
35 _asm( mov stackFrame, ebp ); |
|
36 m_stackFrame = stackFrame; |
|
37 #endif |
|
38 m_methodDescription = methodDescription; |
|
39 qDebug() << m_methodDescription << "IN"; |
|
40 }; |
|
41 |
|
42 ~MethodEntryExitDebugPrint() |
|
43 { |
|
44 #ifdef __WINS__ |
|
45 // Workaround for exception detection as MSL runtime has a bug in |
|
46 // std::uncaught_exception() implementation. |
|
47 int stackFrame = 0; |
|
48 int returnValue = -1; |
|
49 _asm( mov stackFrame, ebp ); |
|
50 _asm( mov returnValue, ebx ); |
|
51 if ((stackFrame + sizeof(int) != m_stackFrame) && (0 == returnValue)) { |
|
52 qDebug() << m_methodDescription << "EXCEPTION!"; |
|
53 } else { |
|
54 qDebug() << m_methodDescription << "OUT"; |
|
55 } |
|
56 #else |
|
57 if (std::uncaught_exception()) { |
|
58 qDebug() << m_methodDescription << "EXCEPTION!"; |
|
59 } else { |
|
60 qDebug() << m_methodDescription << "OUT"; |
|
61 } |
|
62 #endif |
|
63 }; |
|
64 |
|
65 private: |
|
66 const char* m_methodDescription; |
|
67 int m_stackFrame; |
|
68 }; |
|
69 |
|
70 #define DPRINT_METHODENTRYEXIT \ |
|
71 MethodEntryExitDebugPrint __entryExitDebugPrint(__PRETTY_FUNCTION__) |
|
72 |
|
73 #endif // KEYSEQUENCERECOGNITIONSERVICELOG_H |
|