<html>
<head>
<base href="https://bugs.llvm.org/">
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW - lldb - nicer command to search for Bytes"
href="https://bugs.llvm.org/show_bug.cgi?id=48021">48021</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>lldb - nicer command to search for Bytes
</td>
</tr>
<tr>
<th>Product</th>
<td>lldb
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>MacOS X
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>enhancement
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>All Bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>lldb-dev@lists.llvm.org
</td>
</tr>
<tr>
<th>Reporter</th>
<td>rustymagnet3001@gmail.com
</td>
</tr>
<tr>
<th>CC</th>
<td>jdevlieghere@apple.com, llvm-bugs@lists.llvm.org
</td>
</tr></table>
<p>
<div>
<pre>lldb-1200.0.32.1
/******************* sample code ******************/
// Baboon
// 0x42, 0x61, 0x62, 0x6f, 0x6f, 0x6e
const int animalByteArray[7] = { 66, 97, 98, 111, 111, 110 };
void foo_func (const void *ptr) {
printf ("\n[*]Pointer: %p.\n", ptr); /* breakpoint here */
}
int main (void) {
const int *ptr = animalByteArray;
puts ("[*]Can you change the animal?\n");
for (; *ptr != '\0'; ++ptr)
printf ("%c", *ptr);
foo_func (ptr);
return 0;
}
/***********************************************/
// Once breakpoint fires, get start and end positions for Memory Search
(lldb) section
[0x00000100000000-0x00000100004000] 0x0000004000 objc_play`__TEXT
// Memory find for "B", max matches of three, from start to end address
(lldb) mem find -s "B" -c 3 -- 0x00000100000000 0x00000100004000
WORKS
(lldb) mem find -s "B " -c 3 -- 0x00000100000000 0x00000100004000
WORKS
But I try something more intuative:
(lldb) mem find -s "Ba" -c 3 -- 0x00000100000000 0x00000100004000
FAILS
(lldb) mem find -s "Baboon" -c 3 -- 0x00000100000000 0x00000100004000
FAILS
(lldb) mem find -e "\42\61" -c 10 -- 0x00000100000000 0x00000100004000
FAILS
(lldb) mem find -e "\x42\x61" -c 10 -- 0x00000100000000 0x00000100004000
FAILS
If I try the same with radare2 tools:
▶ rabin2 -qz objc_play
0x100003f60 28 6 Baboon
Ultimately, I am trying to figure out how to write the byte buffer I pass the
lldb-python SBProcess.ReadMemory API.</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are on the CC list for the bug.</li>
</ul>
</body>
</html>