2 * Copyright 2009, Ingo Weinhold, ingo_weinhold@gmx.de.
3 * Distributed under the terms of the MIT License.
8 #include "ImageDebugInfo.h"
9 #include "LocatableFile.h"
11 #include "TeamDebugInfo.h"
14 Image::Image(Team
* team
,const ImageInfo
& imageInfo
, LocatableFile
* imageFile
)
18 fImageFile(imageFile
),
20 fDebugInfoState(IMAGE_DEBUG_INFO_NOT_LOADED
)
22 if (fImageFile
!= NULL
)
23 fImageFile
->AcquireReference();
29 if (fDebugInfo
!= NULL
) {
31 fTeam
->DebugInfo()->RemoveImageDebugInfo(fDebugInfo
);
32 fDebugInfo
->ReleaseReference();
34 if (fImageFile
!= NULL
)
35 fImageFile
->ReleaseReference();
47 Image::ContainsAddress(target_addr_t address
) const
49 return (address
>= fInfo
.TextBase()
50 && address
< fInfo
.TextBase() + fInfo
.TextSize())
51 || (address
>= fInfo
.DataBase()
52 && address
< fInfo
.DataBase() + fInfo
.DataSize());
57 Image::SetImageDebugInfo(ImageDebugInfo
* debugInfo
,
58 image_debug_info_state state
)
60 if (debugInfo
== fDebugInfo
&& state
== fDebugInfoState
)
63 if (fDebugInfo
!= NULL
) {
64 fTeam
->DebugInfo()->RemoveImageDebugInfo(fDebugInfo
);
65 fDebugInfo
->ReleaseReference();
68 fDebugInfo
= debugInfo
;
69 fDebugInfoState
= state
;
71 status_t error
= B_OK
;
72 if (fDebugInfo
!= NULL
) {
73 error
= fTeam
->DebugInfo()->AddImageDebugInfo(fDebugInfo
);
75 fDebugInfo
->AcquireReference();
78 fDebugInfoState
= IMAGE_DEBUG_INFO_UNAVAILABLE
;
83 fTeam
->NotifyImageDebugInfoChanged(this);