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