-
-
Notifications
You must be signed in to change notification settings - Fork 338
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Debugger: Add dedicated functions for global {un}init.
- Add new source file DebuggerGlobals, which contains the relevant functions for initializing/destroying the various singleton rosters that the core subsystems rely upon. It is the app's responsibility to ensure these are called before anything else, and as final cleanup at exit. - The GUI/CLI app objects now take care of initializing the settings factory and ValueHandlerRoster, as those are entirely app-specific. - Refactor calls to init functions appropriately.
- Loading branch information
Showing
4 changed files
with
90 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/* | ||
* Copyright 2009-2016, Ingo Weinhold, ingo_weinhold@gmx.de. | ||
* Copyright 2011-2016, Rene Gollent, rene@gollent.com. | ||
* Distributed under the terms of the MIT License. | ||
*/ | ||
|
||
#include "DebuggerGlobals.h" | ||
|
||
#include "ImageDebugLoadingStateHandlerRoster.h" | ||
#include "TargetHostInterface.h" | ||
#include "TypeHandlerRoster.h" | ||
|
||
|
||
status_t | ||
debugger_global_init(TargetHostInterfaceRoster::Listener* listener) | ||
{ | ||
status_t error = TypeHandlerRoster::CreateDefault(); | ||
if (error != B_OK) | ||
return error; | ||
|
||
error = ImageDebugLoadingStateHandlerRoster::CreateDefault(); | ||
if (error != B_OK) | ||
return error; | ||
|
||
error = TargetHostInterfaceRoster::CreateDefault(listener); | ||
if (error != B_OK) | ||
return error; | ||
|
||
// for now, always create an instance of the local interface | ||
// by default | ||
TargetHostInterface* hostInterface; | ||
TargetHostInterfaceRoster* roster = TargetHostInterfaceRoster::Default(); | ||
error = roster->CreateInterface(roster->InterfaceInfoAt(0), NULL, | ||
hostInterface); | ||
if (error != B_OK) | ||
return error; | ||
|
||
return B_OK; | ||
} | ||
|
||
|
||
void | ||
debugger_global_uninit() | ||
{ | ||
TargetHostInterfaceRoster::DeleteDefault(); | ||
ImageDebugLoadingStateHandlerRoster::DeleteDefault(); | ||
TypeHandlerRoster::DeleteDefault(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
/* | ||
* Copyright 2009-2016, Ingo Weinhold, ingo_weinhold@gmx.de. | ||
* Copyright 2011-2016, Rene Gollent, rene@gollent.com. | ||
* Distributed under the terms of the MIT License. | ||
*/ | ||
#ifndef DEBUGGER_GLOBALS_H | ||
#define DEBUGGER_GLOBALS_H | ||
|
||
#include "TargetHostInterfaceRoster.h" | ||
|
||
|
||
status_t debugger_global_init(TargetHostInterfaceRoster::Listener* listener); | ||
|
||
void debugger_global_uninit(); | ||
|
||
#endif // DEBUGGER_GLOBALS_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -81,6 +81,7 @@ SourceHdrs | |
|
||
local sources = | ||
Debugger.cpp | ||
DebuggerGlobals.cpp | ||
|
||
# arch | ||
Architecture.cpp | ||
|