Hi: I compile the code in x86-64 machine, and run dhat . it is ok. The compile cmd: gcc -g -O0 main.c The dhat cmd valgrind -tool=exp-dhat ./a.out
But I compile the same code in the same machine, but another compile cmd, and run dhat. It failed. The compile cmd: gcc -g -O0 -m32 main.c The dhat cmd valgrind -tool=exp-dhat ./a.out I just compile same code into ELF32 mode. The output as below: DHAT: dh_main.c:756 (dh_handle_noninsn_write): the 'impossible' happened. host stacktrace: ==84382== at 0x3800C886: show_sched_status_wrk (m_libcassert.c:343) ==84382== by 0x3800C9C6: report_and_quit (m_libcassert.c:419) ==84382== by 0x3800CAEB: vgPlain_assert_fail (m_libcassert.c:485) ==84382== by 0x38008623: dh_handle_noninsn_write (dh_main.c:756) ==84382== by 0x38010558: final_tidyup (m_main.c:2798) ==84382== by 0x38010A54: shutdown_actions_NORETURN (m_main.c:2564) ==84382== by 0x38078E90: run_a_thread_NORETURN (syswrap-linux.c:199) sched status: running_tid=1 Thread 1: status = VgTs_Runnable (lwpid 84382) ==84382== at 0x402452B: _vgnU_freeres (vg_preloaded.c:59) ==84382== by 0x2: ??? The valgrind version is 3.12.0 root@SZV1000161574:/usr1/code/source/test# gcc --version gcc (Ubuntu 4.8.4-2ubuntu1~14.04.3) 4.8.4 Copyright (C) 2013 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is Does dhat support elf32 mode? BR Owen
output.log
Description: output.log
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <fcntl.h> #include <unistd.h> #include <sys/mman.h> #include <sys/types.h> #include <sys/stat.h> //#include "dhat.h" //è·åæä»¶å¤§å°ï¼åä½bytes size_t getFileSize(const char* path) { struct stat buf; if( stat(path, &buf)<0 ) { perror("stat"); exit(1); } return buf.st_size; } int main(int argc, char *argv[]) { char* pmap=NULL; int fdSem ; size_t filesize=getFileSize("output.log"); int fd=open("output.log", O_RDWR ); if( fd<0 ) { perror("open"); exit(1); } // fdSem = open("sem.txt", O_CREAT); // close(fdSem); // printf("fdSem=%d\n", fdSem); pmap=(char*)mmap(NULL, filesize, PROT_READ|PROT_WRITE , MAP_SHARED, fd, 0); if( MAP_FAILED==pmap ) { perror("mmap"); exit(1); } // VALGRIND_DO_MMAP_REGISTER(pmap, filesize); write(1, pmap, filesize); write(1, pmap, filesize); close(fd); munmap(pmap, filesize); // VALGRIND_DO_MUNMAP_UNREGISTER(pmap, filesize); #if 0 pmap = (char *)malloc(1024 ); memset(pmap, 0, 512); memset(pmap, 2, 128); printf("%p = %s\n",pmap, pmap ); free(pmap); #endif return 0; }
------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________ Valgrind-users mailing list Valgrind-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/valgrind-users