|
From: Yao Qi <qiy...@cn...> - 2005-11-04 11:57:03
|
Tom Hughes wrote: > In message <436...@cn...> > Yao Qi <qiy...@cn...> wrote: > > >>I am thinking of how to map IRStmt to guest original instruction in >>valgrind tool. I find that there are some funtions relative to this >>purpose in include/pub_tool_debuginfo.h and >>include/pub_tool_execontext.h. I could only get address and length of >>every original instruction per IRStmt, but how could I get the content >>of guest instructions? > > > Well if you've got the address and the length then just read it > from that address! I have considered this solution previously, and it is an effective way to read every guest instruction in '.text' section from the client. However, it will break the integrity and encapsulation of the CLIENT--CORE--TOOL orgnization of valgrind. All the machine instructions of CLIENT are translated to an intermediate representation and optimized by CORE, and TOOL get all the information of CLIENT from CORE, so now if My tool read machine instruction directly from CLIENT bypass CORE, it would not be a best solution to this problem. The coregrind/m_debuginfo/symtab.c is a good example that TOOL get all the information from CORE instead of from CLIENT directly. Maybe, I did not describe my ideas clearly, and what I want to say is, 1 Is there any API to get the original instruction? 2 If no such API in valgrind, do you think it is necessary to implement such API in valgrind? And can someone show me where should I start to investigate it? Maybe, VG_(describe_IP)(Addr eip, Char* buf, Int n_buf) could do this, but it seems that the SegInfo do not save enought information about '.text' segment, so I am not sure that the CORE should be enhaunced to support TOOL's feature of mapping IRStmt to original instruction. I would be grateful if someone could take some time out to answer these. Thanks in advance! -- Regards, Yao Yao Qi |