ExceptionConfigWindow: detect current exception status...
...on startup by seeing if the breakpoints for the exception functions are already installed or not.
This commit is contained in:
@@ -118,6 +118,24 @@ ExceptionConfigWindow::_Init()
|
|||||||
fExceptionCaught->SetEnabled(false);
|
fExceptionCaught->SetEnabled(false);
|
||||||
|
|
||||||
fCloseButton->SetTarget(this);
|
fCloseButton->SetTarget(this);
|
||||||
|
|
||||||
|
|
||||||
|
// check if the exception breakpoints are already installed
|
||||||
|
AutoLocker< ::Team> teamLocker(fTeam);
|
||||||
|
for (ImageList::ConstIterator it = fTeam->Images().GetIterator();
|
||||||
|
it.HasNext();) {
|
||||||
|
Image* image = it.Next();
|
||||||
|
|
||||||
|
ImageDebugInfo* info = image->GetImageDebugInfo();
|
||||||
|
target_addr_t address;
|
||||||
|
if (_FindExceptionFunction(info, address) != B_OK)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (fTeam->BreakpointAtAddress(address) != NULL) {
|
||||||
|
fExceptionThrown->SetValue(B_CONTROL_ON);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -125,25 +143,38 @@ void
|
|||||||
ExceptionConfigWindow::_UpdateThrownBreakpoints(bool enable)
|
ExceptionConfigWindow::_UpdateThrownBreakpoints(bool enable)
|
||||||
{
|
{
|
||||||
AutoLocker< ::Team> teamLocker(fTeam);
|
AutoLocker< ::Team> teamLocker(fTeam);
|
||||||
|
|
||||||
for (ImageList::ConstIterator it = fTeam->Images().GetIterator();
|
for (ImageList::ConstIterator it = fTeam->Images().GetIterator();
|
||||||
it.HasNext();) {
|
it.HasNext();) {
|
||||||
Image* image = it.Next();
|
Image* image = it.Next();
|
||||||
|
|
||||||
ImageDebugInfo* info = image->GetImageDebugInfo();
|
ImageDebugInfo* info = image->GetImageDebugInfo();
|
||||||
if (info != NULL) {
|
target_addr_t address;
|
||||||
FunctionInstance* instance = info->FunctionByName(
|
if (_FindExceptionFunction(info, address) != B_OK)
|
||||||
"__cxa_allocate_exception");
|
continue;
|
||||||
if (instance == NULL)
|
|
||||||
instance = info->FunctionByName("__throw(void)");
|
|
||||||
|
|
||||||
if (instance != NULL) {
|
if (enable)
|
||||||
target_addr_t address = instance->Address();
|
fListener->SetBreakpointRequested(address, true, true);
|
||||||
if (enable)
|
else
|
||||||
fListener->SetBreakpointRequested(address, true);
|
fListener->ClearBreakpointRequested(address);
|
||||||
else
|
|
||||||
fListener->ClearBreakpointRequested(address);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
status_t
|
||||||
|
ExceptionConfigWindow::_FindExceptionFunction(ImageDebugInfo* info,
|
||||||
|
target_addr_t& _foundAddress) const
|
||||||
|
{
|
||||||
|
if (info != NULL) {
|
||||||
|
FunctionInstance* instance = info->FunctionByName(
|
||||||
|
"__cxa_allocate_exception");
|
||||||
|
if (instance == NULL)
|
||||||
|
instance = info->FunctionByName("__throw(void)");
|
||||||
|
|
||||||
|
if (instance != NULL) {
|
||||||
|
_foundAddress = instance->Address();
|
||||||
|
return B_OK;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return B_NAME_NOT_FOUND;
|
||||||
|
}
|
||||||
|
|||||||
@@ -8,9 +8,12 @@
|
|||||||
|
|
||||||
#include <Window.h>
|
#include <Window.h>
|
||||||
|
|
||||||
|
#include "types/Types.h"
|
||||||
|
|
||||||
|
|
||||||
class BButton;
|
class BButton;
|
||||||
class BCheckBox;
|
class BCheckBox;
|
||||||
|
class ImageDebugInfo;
|
||||||
class Team;
|
class Team;
|
||||||
class UserInterfaceListener;
|
class UserInterfaceListener;
|
||||||
|
|
||||||
@@ -36,6 +39,8 @@ public:
|
|||||||
private:
|
private:
|
||||||
void _Init();
|
void _Init();
|
||||||
void _UpdateThrownBreakpoints(bool enable);
|
void _UpdateThrownBreakpoints(bool enable);
|
||||||
|
status_t _FindExceptionFunction(ImageDebugInfo* info,
|
||||||
|
target_addr_t& _foundAddress) const;
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
Reference in New Issue
Block a user