c - Tools to detect memory(array of structures) getting over-written -


could guide me suitable tool debug c program? not simple 1 , part of big project. problem have array of structures , initialised properly. check values using gdb. after program runs, somewhere array contents being over-written. not sure process over-writing contents of array of structures. tool or technique within gdb track problem? can't watchpoint gdb because can't watch "constant value". tried valgrind, doesn't show memory related issues. help, appreciated. thanks, badri.

with gdb possible watch address. if can address of in gdb:

   p &somecomplexthing 

and answering 0x123456 can always

  watch *(void**)0x123456 

(or use whatever pointer-to-pointer type appropriate you)

beware of aslr; may want disable

(perhaps echo 0 > /proc/sys/kernel/randomize_va_space run root).

also, recent gcc 4.8 gives address sanitizer -fsanitize=address; , don't forget -wall -g flags gcc.


Comments

Popular posts from this blog

image - ClassNotFoundException when add a prebuilt apk into system.img in android -

I need to import mysql 5.1 to 5.5? -

Java, Hibernate, MySQL - store UTC date-time -