wmkhoo / taintgrind

A taint-tracking plugin for the Valgrind memory checking tool
GNU General Public License v2.0
247 stars 42 forks source link

How to track a variable #26

Closed misalungi closed 5 years ago

misalungi commented 5 years ago

I have a project consists of several cpp files. I want to use taintgrind to track a variable. I do not know how to mention which variable to be taint. Should I make a txt file or a dat file to mention the variable and put the address of txt file in this command: $ valgrind --tool=taintgrind --file-filter=/path/to/test.txt --taint-start=0 --taint-len=1 gzip path/to/test.txt

wmkhoo commented 5 years ago

That command is to taint the contents of a file. If you want to taint a variable in your program, use the client request TNT_TAINT().

wmkhoo commented 5 years ago

Hi,

VALGRIND_DO_CLIENT_REQUEST_STMT is defined in valgrind.h, which is part of valgrind. Did you download and build valgrind?

Regards

On Wed, 12 Dec 2018 at 21:19, misalungi notifications@github.com wrote:

I am using TNT_TAINT(&a, sizeof(a)); in my main file. There is an error in line of: TNT_TAINT(&a, sizeof(a)); This is the error. Function 'VALGRIND_DO_CLIENT_REQUEST_STMT' could not be resolved

I also added valgrind includes in include path. But I think this function:

define TNT_TAINT(addr, size)

VALGRIND_DO_CLIENT_REQUEST_STMT(VG_USERREQ__TAINTGRIND_TAINT,addr,size,0,0,); can not open VALGRIND_DO_CLIENT_REQUEST_STMT.

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/wmkhoo/taintgrind/issues/26#issuecomment-446585376, or mute the thread https://github.com/notifications/unsubscribe-auth/ABnDS0D3E3vaF-kqHHbZ4IqnuIkOe0PAks5u4QJ3gaJpZM4Yy-KZ .

misalungi commented 5 years ago

It works now. Thank you!

misalungi commented 5 years ago

Now I created a dot file with this command: valgrind --tool=taintgrind tests/sign32 2>&1 | python log2dot.py > sign32.dot I want to convert it to png or svg or pdf it gives this error: syntax error in line 47 near '&': subgraph cluster_std__ostream&{ label="std::ostream&"

wmkhoo commented 5 years ago

This is an ugly hack, but see if it works. I should probably use regex at some point.

wmkhoo commented 5 years ago

Closing this issue