You might try the gdbserver patch (which allows such an interactive
query of what an address is)
and/or use the code behind as an example.
See http://bugs.kde.org/show_bug.cgi?id=214909
gdb server patch allows to debug a program running under valgrind, and
do (some) interactive
calls to some of the valgrind tool functionality.
Here is a trace of an interactive usage of gdb server in valgrind with
memcheck tool,
showing a description of an address on the stack
an address of text
an address on the heap.
Hope this helps ...
(gdb) mo mc.c add 0xfe82aab0
Address 0xFE82AAB0 len 1 addressable
==30724== Address 0xfe82aab0 is on thread 1's stack
(gdb) bt
#0 param_test () at
/cm/build6/cm/ot/TOOL/ADA_PRIM!15.0.54/build_G!79.IP.L5/sources/param_te
st.adb:66
#1 0x0804cf1a in tool_ada_prim_shared_test () at
/cm/ot/TOOL/ADA_PRIM!15.0.54/build_G!79.IP.L5/ada/../sources/tool_ada_pr
im_shared_test.adb:138
(gdb) mo mc.c add 0x0804cf1a
Address 0x804CF1A len 1 addressable
==30724== Address 0x804cf1a is in the Text segment of
/cm/build6/cm/ot/TOOL/ADA_PRIM!15.0.54/build_G!79.IP.L5/ada/exe/tool_ada
_prim_shared_test
(gdb) mo mc.c add 0x727d060
Address 0x727D060 len 1 addressable
==30724== Address 0x727d060 is 0 bytes inside a block of size 10
alloc'd
==30724== at 0x4D80E46: memalign (vg_replace_malloc.c:581)
==30724== by 0x44146D4: malloc (in /lib/ld-2.5.so)
==30724== by 0x804B5BF: ??? (in
/cm/build6/cm/ot/TOOL/ADA_PRIM!15.0.54/build_G!79.IP.L5/ada/exe/tool_ada
_prim_shared_test)
==30724== by 0x9: ???
(gdb)
________________________________
From: Yu Huang [mailto:yuhu...@ncic.ac.cn]
Sent: Tuesday 21 December 2010 04:43
To: valgrind-users@lists.sourceforge.net
Subject: [Valgrind-users] How to determine which segment does an
addresspoints to in Valgrind?
Hi all,
Is there any easy way to get app's start and end address of
code, data, heap, stack and BSS segments?
Hooking functions such as malloc, mmap can capture memory
allocation ( what Massif do ). But I think this way is too heavy to me,
and I'm not sure such a way can solve my problem either. Since Valgrind
has a embeded linker, I believe it has something to manage the memory
layout.
Here is what I want to do:
> Lackey gives an address, such as 0x7FF0008E8,
> I want to determine which segment does the address
points to.
> If I have a directory like below, I then can easily
achive my goal.
"heap":[0x1000000, 0x2000000]
"text":[0x3C00000, 0x3F00000]
etc...
> Is it possible for me to build such a directory?
Thank you and Merry Xmas!
----
Ray
Chiese Academy of Sciences, Beijing, China.
____
This message and any files transmitted with it are legally privileged and
intended for the sole use of the individual(s) or entity to whom they are
addressed. If you are not the intended recipient, please notify the sender by
reply and delete the message and any attachments from your system. Any
unauthorised use or disclosure of the content of this message is strictly
prohibited and may be unlawful.
Nothing in this e-mail message amounts to a contractual or legal commitment on
the part of EUROCONTROL, unless it is confirmed by appropriately signed hard
copy.
Any views expressed in this message are those of the sender.
------------------------------------------------------------------------------
Gaining the trust of online customers is vital for the success of any company
that requires sensitive data to be transmitted over the Web. Learn how to
best implement a security strategy that keeps consumers' information secure
and instills the confidence they need to proceed with transactions.
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
Valgrind-users mailing list
Valgrind-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/valgrind-users