[insight-vmi] r1990 committed - Added helper function to retrieve a module by name.

0 views
Skip to first unread message

insig...@googlecode.com

unread,
Jun 21, 2013, 11:33:30 AM6/21/13
to insight-v...@googlegroups.com
Revision: 1990
Author: chrsc...@googlemail.com
Date: Fri Jun 21 08:33:25 2013
Log: Added helper function to retrieve a module by name.

http://code.google.com/p/insight-vmi/source/detail?r=1990

Modified:
/trunk/insightd/scripts/module_utils.js

=======================================
--- /trunk/insightd/scripts/module_utils.js Tue Feb 12 09:44:16 2013
+++ /trunk/insightd/scripts/module_utils.js Fri Jun 21 08:33:25 2013
@@ -4,11 +4,39 @@

include("scripts/lib_string.js");

+function find_module(name)
+{
+ var head = new Instance("modules");
+
+ // Iterate over all modules
+ var m = head.next;
+ while (m &&
+ m.Address() != head.Address() &&
+ m.MemberAddress("list") != head.Address())
+ {
+ if (m.name == name)
+ return m;
+ m = m.list.next;
+ }
+
+ return false;
+}
+
+
+function print_module_heading(m)
+{
+ print("===", m.name);
+ if (m.MemberExists("module_core"))
+ print(".module_core = 0x" + m.module_core.Address());
+ println(" ===");
+}
+
+
function print_module_syms(m)
{
- println("===", m.name + ".module_core = 0x" +
m.module_core.Address(), "===");
-
- var cnt = m.num_syms;
+ print_module_heading(m);
+
+ var cnt = m.num_syms;

for (var i = 0; i < cnt; ++i) {
var sym = m.syms.ArrayElem(i);
@@ -19,8 +47,8 @@

function print_module_sections(m)
{
- println("===", m.name + ".module_core = 0x" +
m.module_core.Address(), "===");
-
+ print_module_heading(m);
+
var attrs = m.sect_attrs;
var cnt = attrs.nsections;

Reply all
Reply to author
Forward
0 new messages