Search Memory

Search Memory locates sequences of bytes in program memory.  The search is based on a value entered as hex numbers, decimal numbers or strings.  The byte sequence may contain "wildcards" that will match any byte (or possibly nibble). String searching also allows for the use of regular expression searches.

To Search Memory:

  1. From the Tool, select Search Memory
  2. Enter a Hex String in the Value field
    This will create a Hex Sequence for searching.
  3. Choose "Next" to find the next occurrence
                                  - or -
    Choose "Previous" to find the previous occurrence
                                  - or -
    Choose "Search All" to find all occurrences.

Search Formats

 

Search Options

Search

Search Value

Hex Sequence

Format

Hex:

Example:

Value:   

 "1234 567 89ab"

Little Endian Hex Sequence   

34 12 67 05 ab 89

Big Endian Hex Sequence   

12 34 05 67 89 ab

As a convenience, if a user enters a single wildcard value within the search text, then the search string will be interpreted as if 2 consecutive wildcard characters were entered, meaning to match any byte value.

Similarly, if the search string contains an odd number of characters, then a 0 is prepended to the search string, based on the assumption that a single hex digit implies a leading 0 value.

 

String:

Value is interpreted as the specified character encoding. The center panel of the Search Memory dialog shows the Format Options, described below.

  • Encoding - Interprets strings by the specified encoding.  Note that byte ordering determines if the high order byte comes first or last.
  • Case Sensitive - Turning off this option will search for the string regardless of case using the specified character encoding. Only applicable for English characters.
  • Escape Sequences - Enabling this option allows escape sequences in the search value (i.e., allows \n to be searched for).

Decimal:

Value is interpreted as a sequence of decimal numbers, separated by spaces. The center panel of the Search Memory dialog shows the Decimal Options, described below.

Binary:

Value is interpreted as a sequence of binary numbers, separated by spaces.  Wildcard characters ('x' or '?' or '.') can be used to match any bit.

Regular Expression:

Value is interpreted as a Java Regular Expression that is matched against memory as if all memory was a string. Help on how to form regular expressions is available on the Regular Expression Help page.

Memory Block Types

 

Selection Scope

 

Code Unit Scope

Filters the matches based upon the code unit containing a given address.

Byte Order

Sets the byte ordering for multi-byte values.  Has no effect on non-Unicode Ascii values, Binary, or regular expressions.

Little Endian - places low-order bytes first.
For example, the hex number "1234" will generate the bytes "34" , "12".

Big Endian - places high-order bytes first.
For example, the hex number "1234" will generate the bytes "12", "34".

Alignment

 

Searching

For very large Programs that may take a while to search, you can cancel the search at any time. For these situations, a progress bar is displayed, along with a Cancel button. Click on the Cancel button to stop the search. 

Dismissing the search dialog automatically cancels the search operation.

 

Highlight Search Option

You can specify that the bytes found in the search be highlighted in the Code Browser by selecting the Highlight Search Results checkbox on the Search Options panel. To view the Search Options, select Edit Tool Options... from the tool menu, then select the Search node in the Options tree in the Options dialog. You can also change the highlight color. Click on the color bar next to Highlight Color to bring up a color chooser. Choose the new color, click on the OK button. Apply your changes by clicking on the OK or Apply button on the Options dialog. 

Highlights are displayed for the last search that you did. For example, if you bring up the Search Program Text dialog and search for text, that string now becomes the new highlight string. Similarly, if you invoke cursor text highlighting, that becomes the new highlight string.

Highlights are dropped when you close the search dialog, or close the query results window for your most recent search.



Search for Matching Instructions

This action works only on a selection of code. It uses the selected instructions to build a combined mask/value bit pattern that is then used to populate the search field in the Memory Search Dialog. This enables searching through memory for a particular ordering of instructions. There are three options available: 

Example:

A user first selects the following lines of code. Then, from the Search menu they choose Search for Matching Instructions and one of the following options:

Option 1:

If the Include Operands action is chosen then the search will find all instances of the following instructions and operands.

All of the bytes that make up the selected code will be searched for exactly, with no wild carding. The bit pattern 10000101 11000000 01010110 01101010 00010100 01011110 which equates to the byte pattern 85 c0 56 6a 14 5e is searched for.

Option 2:

If the Exclude Operands option is chosen then the search will find all instances of the following instructions only.

Only the parts of the byte pattern that make up the instructions will be searched for with the remaining bits used as wildcards. The bit pattern 10000101 11...... 01010... 01101010 ........ 01011... is searched for where the .'s indicate the wild carded values.

Option 3:

If the Include Operands (except constants) option is chosen then the search will find all instances of the instruction and all operands except the 0x14 which is a constant.

The bit pattern 10000101 11000000 01010110 01101010 ........ 01011110 which equates to the byte pattern 85 c0 56 6a xx 5e is searched for where xx can be any number N between 0x0 and 0xff.

NoteThe previous operations can only work on a single selected region. If multiple regions are selected, the following error dialog will be shown and the operation will be cancelled.



Provided by: the MemSearchPlugin  

 

Related Topics: