mirror of
https://github.com/NationalSecurityAgency/ghidra.git
synced 2025-10-04 18:29:37 +02:00
Merge remote-tracking branch 'origin/patch'
This commit is contained in:
commit
fcc5b18683
6 changed files with 22 additions and 12 deletions
|
@ -86,8 +86,8 @@ public class SymbolTableCommand extends LoadCommand {
|
||||||
// sort the entries by the index in the string table, so don't jump around reading
|
// sort the entries by the index in the string table, so don't jump around reading
|
||||||
List<NList> sortedList = nlistList
|
List<NList> sortedList = nlistList
|
||||||
.stream()
|
.stream()
|
||||||
.sorted((o1, o2) -> Integer.valueOf(o1.getStringTableIndex())
|
.sorted(
|
||||||
.compareTo(Integer.valueOf(o2.getStringTableIndex())))
|
(o1, o2) -> Integer.compare(o1.getStringTableIndex(), o2.getStringTableIndex()))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
// initialize the NList strings from string table
|
// initialize the NList strings from string table
|
||||||
|
|
|
@ -161,8 +161,8 @@ public class DyldCacheLocalSymbolsInfo implements StructConverter {
|
||||||
// sort the entries by the index in the string table, so don't jump around reading
|
// sort the entries by the index in the string table, so don't jump around reading
|
||||||
List<NList> sortedList = nlistList
|
List<NList> sortedList = nlistList
|
||||||
.stream()
|
.stream()
|
||||||
.sorted((o1, o2) -> Integer.valueOf(o1.getStringTableIndex())
|
.sorted((o1, o2) -> Integer.compare(o1.getStringTableIndex(),
|
||||||
.compareTo(Integer.valueOf(o2.getStringTableIndex())))
|
o2.getStringTableIndex()))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
// initialize the NList strings from string table
|
// initialize the NList strings from string table
|
||||||
|
|
|
@ -1142,7 +1142,7 @@ Address SegmentedResolver::resolve(uintb val,int4 sz,const Address &point,uintb
|
||||||
|
|
||||||
{
|
{
|
||||||
int4 innersz = segop->getInnerSize();
|
int4 innersz = segop->getInnerSize();
|
||||||
if (sz <= innersz) { // If -sz- matches the inner size, consider the value a "near" pointer
|
if (sz >= 0 && sz <= innersz) { // If -sz- matches the inner size, consider the value a "near" pointer
|
||||||
// In this case the address offset is not fully specified
|
// In this case the address offset is not fully specified
|
||||||
// we check if the rest is stored in a context variable
|
// we check if the rest is stored in a context variable
|
||||||
// (as with near pointers)
|
// (as with near pointers)
|
||||||
|
|
|
@ -490,9 +490,12 @@ AddrSpace *AddrSpaceManager::getSpaceByShortcut(char sc) const
|
||||||
/// If there is a special resolver for the AddrSpace, this is invoked, otherwise
|
/// If there is a special resolver for the AddrSpace, this is invoked, otherwise
|
||||||
/// basic wordsize conversion and wrapping is performed. If the address encoding is
|
/// basic wordsize conversion and wrapping is performed. If the address encoding is
|
||||||
/// partial (as in a \e near pointer) and the full encoding can be recovered, it is passed back.
|
/// partial (as in a \e near pointer) and the full encoding can be recovered, it is passed back.
|
||||||
|
/// The \e sz parameter indicates the number of bytes in constant and is used to determine if
|
||||||
|
/// the constant is a partial or full pointer encoding. A value of -1 indicates the value is
|
||||||
|
/// known to be a full encoding.
|
||||||
/// \param spc is the space to generate the address from
|
/// \param spc is the space to generate the address from
|
||||||
/// \param val is the constant encoding of the address
|
/// \param val is the constant encoding of the address
|
||||||
/// \param sz is the size of the constant encoding
|
/// \param sz is the size of the constant encoding (or -1)
|
||||||
/// \param point is the context address (for recovering full encoding info if necessary)
|
/// \param point is the context address (for recovering full encoding info if necessary)
|
||||||
/// \param fullEncoding is used to pass back the recovered full encoding of the pointer
|
/// \param fullEncoding is used to pass back the recovered full encoding of the pointer
|
||||||
/// \return the formal Address associated with the encoding
|
/// \return the formal Address associated with the encoding
|
||||||
|
|
|
@ -144,8 +144,12 @@ public:
|
||||||
/// \brief The main resolver method.
|
/// \brief The main resolver method.
|
||||||
///
|
///
|
||||||
/// Given a native constant in a specific context, resolve what address is being referred to.
|
/// Given a native constant in a specific context, resolve what address is being referred to.
|
||||||
|
/// The constant can be a partially encoded pointer, in which case the full pointer encoding
|
||||||
|
/// is recovered as well as the address. Whether or not a pointer is partially encoded or not
|
||||||
|
/// is determined by the \e sz parameter, indicating the number of bytes in the pointer. A value
|
||||||
|
/// of -1 here indicates that the pointer is known to be a full encoding.
|
||||||
/// \param val is constant to be resolved to an address
|
/// \param val is constant to be resolved to an address
|
||||||
/// \param sz is the size of \e val in context.
|
/// \param sz is the size of \e val in context (or -1).
|
||||||
/// \param point is the address at which this constant is being used
|
/// \param point is the address at which this constant is being used
|
||||||
/// \param fullEncoding is used to hold the full pointer encoding if \b val is a partial encoding
|
/// \param fullEncoding is used to hold the full pointer encoding if \b val is a partial encoding
|
||||||
/// \return the resolved Address
|
/// \return the resolved Address
|
||||||
|
|
|
@ -1125,15 +1125,15 @@ Datatype *TypeSpacebase::getSubType(uintb off,uintb *newoff) const
|
||||||
{
|
{
|
||||||
Scope *scope = getMap();
|
Scope *scope = getMap();
|
||||||
off = AddrSpace::byteToAddress(off, spaceid->getWordSize()); // Convert from byte offset to address unit
|
off = AddrSpace::byteToAddress(off, spaceid->getWordSize()); // Convert from byte offset to address unit
|
||||||
// It should always be the case that given offset represents a full encoding of the
|
// It should always be the case that the given offset represents a full encoding of the
|
||||||
// pointer, so the point of context is unused
|
// pointer, so the point of context is unused and the size is given as -1
|
||||||
Address nullPoint;
|
Address nullPoint;
|
||||||
uintb fullEncoding;
|
uintb fullEncoding;
|
||||||
Address addr = glb->resolveConstant(spaceid, off, spaceid->getAddrSize(), nullPoint, fullEncoding);
|
Address addr = glb->resolveConstant(spaceid, off, -1, nullPoint, fullEncoding);
|
||||||
SymbolEntry *smallest;
|
SymbolEntry *smallest;
|
||||||
|
|
||||||
// Assume symbol being referenced is address tied,
|
// Assume symbol being referenced is address tied so we use a null point of context
|
||||||
// so we use empty usepoint
|
// FIXME: A valid point of context may be necessary in the future
|
||||||
smallest = scope->queryContainer(addr,1,nullPoint);
|
smallest = scope->queryContainer(addr,1,nullPoint);
|
||||||
|
|
||||||
if (smallest == (SymbolEntry *)0) {
|
if (smallest == (SymbolEntry *)0) {
|
||||||
|
@ -1172,6 +1172,9 @@ Address TypeSpacebase::getAddress(uintb off,int4 sz,const Address &point) const
|
||||||
|
|
||||||
{
|
{
|
||||||
uintb fullEncoding;
|
uintb fullEncoding;
|
||||||
|
// Currently a constant off of a global spacebase must be a full pointer encoding
|
||||||
|
if (localframe.isInvalid())
|
||||||
|
sz = -1; // Set size to -1 to guarantee that full encoding recovery isn't launched
|
||||||
return glb->resolveConstant(spaceid,off,sz,point,fullEncoding);
|
return glb->resolveConstant(spaceid,off,sz,point,fullEncoding);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue