Ghidra Decompiler Analysis Engine
comment_ghidra.hh
Go to the documentation of this file.
1
/* ###
2
* IP: GHIDRA
3
*
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
* you may not use this file except in compliance with the License.
6
* You may obtain a copy of the License at
7
*
8
* http://www.apache.org/licenses/LICENSE-2.0
9
*
10
* Unless required by applicable law or agreed to in writing, software
11
* distributed under the License is distributed on an "AS IS" BASIS,
12
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
* See the License for the specific language governing permissions and
14
* limitations under the License.
15
*/
18
#ifndef __COMMENT_GHIDRA__
19
#define __COMMENT_GHIDRA__
20
21
#include "
comment.hh
"
22
#include "
ghidra_arch.hh
"
23
30
class
CommentDatabaseGhidra
:
public
CommentDatabase
{
31
ArchitectureGhidra
*ghidra;
32
mutable
CommentDatabaseInternal
cache;
33
mutable
bool
cachefilled;
34
void
fillCache(
const
Address
&fad)
const
;
35
public
:
36
CommentDatabaseGhidra
(
ArchitectureGhidra
*g);
37
virtual
void
clear
(
void
) { cache.
clear
(); cachefilled=
false
; }
38
virtual
void
clearType
(
const
Address
&fad,uint4 tp) {
39
cache.
clearType
(fad,tp);
40
}
41
virtual
void
addComment
(uint4 tp,
const
Address
&fad,
42
const
Address
&ad,
const
string
&txt);
43
virtual
bool
addCommentNoDuplicate
(uint4 tp,
const
Address
&fad,
const
Address
&ad,
const
string
&txt);
44
virtual
void
deleteComment
(
Comment
*com) {
45
throw
LowlevelError
(
"deleteComment unimplemented"
); }
46
virtual
CommentSet::const_iterator
beginComment
(
const
Address
&fad)
const
;
47
virtual
CommentSet::const_iterator
endComment
(
const
Address
&fad)
const
;
48
virtual
void
saveXml
(ostream &s)
const
{
49
throw
LowlevelError
(
"commentdb::saveXml unimplemented"
); }
50
virtual
void
restoreXml
(
const
Element
*el,
const
AddrSpaceManager
*trans) {
51
throw
LowlevelError
(
"commentdb::restoreXml unimplemented"
); }
52
};
53
54
#endif
comment.hh
A database interface for high-level language comments.
CommentDatabaseInternal::clearType
virtual void clearType(const Address &fad, uint4 tp)
Clear all comments matching (one of) the indicated types.
Definition:
comment.cc:154
ghidra_arch.hh
Ghidra specific architecture information and connection to a Ghidra client.
LowlevelError
The lowest level error generated by the decompiler.
Definition:
error.hh:44
CommentDatabaseGhidra::clear
virtual void clear(void)
Clear all comments from this container.
Definition:
comment_ghidra.hh:37
CommentDatabaseGhidra::addCommentNoDuplicate
virtual bool addCommentNoDuplicate(uint4 tp, const Address &fad, const Address &ad, const string &txt)
Add a new comment to the container, making sure there is no duplicate.
Definition:
comment_ghidra.cc:64
CommentDatabaseGhidra::beginComment
virtual CommentSet::const_iterator beginComment(const Address &fad) const
Get an iterator to the beginning of comments for a single function.
Definition:
comment_ghidra.cc:70
CommentDatabaseGhidra::saveXml
virtual void saveXml(ostream &s) const
Save all comments in the container to an XML stream.
Definition:
comment_ghidra.hh:48
CommentDatabaseInternal::clear
virtual void clear(void)
Clear all comments from this container.
Definition:
comment.cc:144
CommentDatabaseGhidra::restoreXml
virtual void restoreXml(const Element *el, const AddrSpaceManager *trans)
Restore all comments from XML.
Definition:
comment_ghidra.hh:50
Element
An XML element. A node in the DOM tree.
Definition:
xml.hh:150
CommentDatabaseGhidra::endComment
virtual CommentSet::const_iterator endComment(const Address &fad) const
Get an iterator to the ending of comments for a single function.
Definition:
comment_ghidra.cc:77
CommentDatabaseGhidra::addComment
virtual void addComment(uint4 tp, const Address &fad, const Address &ad, const string &txt)
Definition:
comment_ghidra.cc:56
Address
A low-level machine address for labelling bytes and data.
Definition:
address.hh:46
CommentDatabaseGhidra
An implementation of CommentDatabase backed by a Ghidra client.
Definition:
comment_ghidra.hh:30
CommentDatabaseGhidra::clearType
virtual void clearType(const Address &fad, uint4 tp)
Clear all comments matching (one of) the indicated types.
Definition:
comment_ghidra.hh:38
CommentDatabaseGhidra::CommentDatabaseGhidra
CommentDatabaseGhidra(ArchitectureGhidra *g)
Constructor.
Definition:
comment_ghidra.cc:18
CommentDatabaseGhidra::deleteComment
virtual void deleteComment(Comment *com)
Remove the given Comment object from the container.
Definition:
comment_ghidra.hh:44
Comment
A comment attached to a specific function and code address.
Definition:
comment.hh:37
ArchitectureGhidra
An implementation of the Architecture interface and connection to a Ghidra client.
Definition:
ghidra_arch.hh:60
CommentDatabase
An interface to a container of comments.
Definition:
comment.hh:86
AddrSpaceManager
A manager for different address spaces.
Definition:
translate.hh:218
CommentDatabaseInternal
An in-memory implementation of the CommentDatabase API.
Definition:
comment.hh:156
Generated by
1.8.17