xref: /haiku/src/kits/debugger/DebuggerGlobals.cpp (revision 71452e98334eaac603bf542d159e24788a46bebb)
1 /*
2  * Copyright 2009-2016, Ingo Weinhold, ingo_weinhold@gmx.de.
3  * Copyright 2011-2016, Rene Gollent, rene@gollent.com.
4  * Distributed under the terms of the MIT License.
5  */
6 
7 #include "DebuggerGlobals.h"
8 
9 #include "ImageDebugLoadingStateHandlerRoster.h"
10 #include "TargetHostInterface.h"
11 #include "TypeHandlerRoster.h"
12 
13 
14 status_t
15 debugger_global_init(TargetHostInterfaceRoster::Listener* listener)
16 {
17 	status_t error = TypeHandlerRoster::CreateDefault();
18 	if (error != B_OK)
19 		return error;
20 
21 	error = ImageDebugLoadingStateHandlerRoster::CreateDefault();
22 	if (error != B_OK)
23 		return error;
24 
25 	error = TargetHostInterfaceRoster::CreateDefault(listener);
26 	if (error != B_OK)
27 		return error;
28 
29 	// for now, always create an instance of the local interface
30 	// by default
31 	TargetHostInterface* hostInterface;
32 	TargetHostInterfaceRoster* roster = TargetHostInterfaceRoster::Default();
33 	error = roster->CreateInterface(roster->InterfaceInfoAt(0), NULL,
34 		hostInterface);
35 	if (error != B_OK)
36 		return error;
37 
38 	return B_OK;
39 }
40 
41 
42 void
43 debugger_global_uninit()
44 {
45 	TargetHostInterfaceRoster::DeleteDefault();
46 	ImageDebugLoadingStateHandlerRoster::DeleteDefault();
47 	TypeHandlerRoster::DeleteDefault();
48 }
49