1 /*---------------------------------------------------------------------------*
2   Project:  Horizon
3   File:     dbg_Break.h
4 
5   Copyright (C)2009-2012 Nintendo Co., Ltd.  All rights reserved.
6 
7   These coded instructions, statements, and computer programs contain
8   proprietary information of Nintendo of America Inc. and/or Nintendo
9   Company Ltd., and are protected by Federal copyright law.  They may
10   not be disclosed to third parties or copied or duplicated in any form,
11   in whole or in part, without the prior written consent of Nintendo.
12 
13   $Rev: 48011 $
14  *---------------------------------------------------------------------------*/
15 
16 /* Please see man pages for details
17 
18 
19 
20 */
21 
22 #ifndef NN_DBG_DBG_BREAK_H_
23 #define NN_DBG_DBG_BREAK_H_
24 
25 #include <nn/Result.h>
26 #include <nn/types.h>
27 #include <nn/dbg/dbg_Enum.h>
28 
29 //-------------------------------------------------------------------
30 // for C / C++
31 
32 #ifdef __cplusplus
33 extern "C" {
34 #endif  // ifdef __cplusplus
35 
36 /* Please see man pages for details
37 
38 */
39 nnResult nndbgBreak(int reason);
40 
41 /* Please see man pages for details
42 
43 */
44 void nndbgPanic(void);
45 
46 
47 void nndbgBreakWithMessage_ (nndbgBreakReason reason, const char* filename, int lineno, const char* fmt, ...);
48 void nndbgBreakWithTMessage_(nndbgBreakReason reason, const char* filename, int lineno, const char* fmt, ...);
49 
50 void nndbgBreakWithResultMessage_ (nndbgBreakReason reason, nnResult result, const char* filename, int lineno, const char* fmt, ...);
51 void nndbgBreakWithResultTMessage_(nndbgBreakReason reason, nnResult result, const char* filename, int lineno, const char* fmt, ...);
52 
53 #ifdef __cplusplus
54 }
55 #endif  // ifdef __cplusplus
56 
57 
58 
59 //-------------------------------------------------------------------
60 // for C++
61 
62 #ifdef __cplusplus
63 
64 namespace nn { namespace dbg {
65 
66     //----------------------------------------------------------------------
67     //
68     //
69     //
70     //
71     //
72     //
73     //
74     //
75     //
76     //
77     //
78     //
79     //
80     //
81     //
82     //
83     //
84     //----------------------------------------------------------------------
85     typedef void (*BreakHandler)(BreakReason reason, Result* pResult,
86                 const char* filename, int lineno, const char* fmt, std::va_list args);
87 
88     nn::Result Break(nn::dbg::BreakReason reason);
89 
90     /* Please see man pages for details
91 
92 
93 
94 
95 
96     */
Break()97     inline nn::Result Break()
98     {
99         return Break(BREAK_REASON_PANIC);
100     }
101 
102     /* Please see man pages for details
103 
104 
105 
106     */
107     void Panic();
108 
109     //----------------------------------------------------------------------
110     //
111     //
112     //
113     //
114     //
115     //
116     //
117     //
118     //
119     //
120     //
121     //
122     //
123     //
124     //
125     //
126     //
127     //
128     //----------------------------------------------------------------------
129     void SetBreakHandler(BreakHandler handler);
130 
131 
132     namespace detail
133     {
134         namespace CTR
135         {
136             struct DllInfo
137             {
138                 uptr    pathAddress;
139                 s32     pathLength;
140                 uptr    erAddress;
141                 uptr    rwAddress;
142             };
143         }
144 
145         Result NotifyDllLoadedToDebugger(const void* pDllInfo, size_t size);
146         Result NotifyDllUnloadingToDebugger(const void* pDllInfo, size_t size);
147     }
148 }}
149 
150 #endif  // ifdef __cplusplus
151 
152 
153 
154 #endif /* NN_DBG_DBG_BREAK_H_ */
155