|
From: Yoni <ilo...@gm...> - 2009-09-24 12:11:45
|
Hi All, I was trying to run valgrind using exp-ptrcheck, and i keep getting errors on a perfectly good code. I am not a valgrind expert, but I looked a bit on ptrcheck code, and I could not understand how it can work. As I understand, every instruction is classified in the first use, and in the second time ptrcheck will compare the current status to the previews one (in helperc__mem_access). This approach could generate false alarms when you change a pointer legitimately (for example, by passing a pointer to pointer as an argument to a functions). that is what generating the error in my case: the following line generated an error char **p; .... (*p)[len] = 0; and when i changed it to: char **p, *tmp; ... tmp = (*p); tmp[len] = 0; It was OK. I would love if someone could explain to me this approach. Thanks, Yoni. |
|
From: Dan K. <da...@ke...> - 2009-09-24 16:32:05
|
We need to see more of your code, but it sounds like you forgot to allocate memory? On Sep 24, 2009 5:12 AM, "Yoni" <ilo...@gm...> wrote: Hi All, I was trying to run valgrind using exp-ptrcheck, and i keep getting errors on a perfectly good code. I am not a valgrind expert, but I looked a bit on ptrcheck code, and I could not understand how it can work. As I understand, every instruction is classified in the first use, and in the second time ptrcheck will compare the current status to the previews one (in helperc__mem_access). This approach could generate false alarms when you change a pointer legitimately (for example, by passing a pointer to pointer as an argument to a functions). that is what generating the error in my case: the following line generated an error char **p; .... (*p)[len] = 0; and when i changed it to: char **p, *tmp; ... tmp = (*p); tmp[len] = 0; It was OK. I would love if someone could explain to me this approach. Thanks, Yoni. ------------------------------------------------------------------------------ Come build with us! The BlackBerry® Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9-12, 2009. Register now! http://p.sf.net/sfu/devconf _______________________________________________ Valgrind-users mailing list Val...@li... https://lists.sourceforge.net/lists/listinfo/valgrind-users |