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