> I do not understand. The below error is an uninitialised value error. > Why do you say you cannot catch the errors ?
Valgrind points to them, but I don't seem to confirm the uninitialization. > You just have to use monitor get_vbits at the time of the error > to investigate more in depth where the error comes from, > and if needed, relaunch the execution after having added some > breakpoints earlier in the program flow, and again use get_vbits > to try to understand where the uninit error comes from. Easier said than done :) I've tried but there are a lot of local variables: int retval; struct rs *rs = (struct rs *)p; int deg_lambda, el, deg_omega; int i, j, r,k; data_t u,q,tmp,num1,num2,den,discr_r; data_t lambda[NROOTS+1], s[NROOTS]; /* Err+Eras Locator poly * and syndrome poly */ data_t b[NROOTS+1], t[NROOTS+1], omega[NROOTS+1]; data_t root[NROOTS], reg[NROOTS+1], loc[NROOTS]; int syn_error, count; and lines where they can be used before initialization: ~ 300. > Yes, the monitor get_vbits only knows about address+length. > So, you need to do something like > (gdb) p &myvar > (gdb) p sizeof(myvar) > and then use > (gdb) monitor get_vbits <address> <size> > to get the vbits. Yes, but in some cases the sizeof indicates the size of the pointer (not the size of the allocated memory). So I had to browse the code to get the size of the allocations/structs involved. > When valgrind reports that the origin of an uninit var is in a function, > then it means it is one of the local variables of the function. > Not the arguments of this function. OK, that's why it is difficult to find this. Specially because it is a 3rd party library. Since the line valgrind pinpoints is not accurate/relevant, we are in doubt about where the error comes from. (I'm not saying its valgrind's fault, of course, it already is an extremely useful tool, as is). > If you want to detect buffer over or under run in stack and global > variables, then yes, the experimental exp-sgcheck tool is your friend. OK, so it is not applicable to this case of uninitialized stack variables. What is strange is that I never faced such a shortcoming in my own code. In my code valgrind always points to the location of the error exactly. Does this happen because this is a library that I link with? Or because of the nature of the error? Thanks. -- João M. S. Silva ------------------------------------------------------------------------------ BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT Develop your own process in accordance with the BPMN 2 standard Learn Process modeling best practices with Bonita BPM through live exercises http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_ source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF _______________________________________________ Valgrind-users mailing list Valgrind-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/valgrind-users