From: Good Guy Date: Mon, 12 Sep 2016 23:15:36 +0000 (-0600) Subject: upgrade dmp output X-Git-Url: https://cinelerra-gg.org/git/?a=commitdiff_plain;h=9bdcade2e925eed0fdff09902b2e2aa1a99f8573;p=goodguy%2Fhistory.git upgrade dmp output --- diff --git a/cinelerra-5.1/cinelerra/adeviceprefs.C b/cinelerra-5.1/cinelerra/adeviceprefs.C index eb3ccfcf..f3a10893 100644 --- a/cinelerra-5.1/cinelerra/adeviceprefs.C +++ b/cinelerra-5.1/cinelerra/adeviceprefs.C @@ -342,6 +342,7 @@ int ADevicePrefs::create_alsa_objs() int x1 = x + menu->get_w() + 5; ArrayList *alsa_titles = new ArrayList; + alsa_titles->set_array_delete(); AudioALSA::list_devices(alsa_titles, 0, mode); diff --git a/cinelerra-5.1/cinelerra/mwindow.C b/cinelerra-5.1/cinelerra/mwindow.C index 15b29e5c..de49bcf4 100644 --- a/cinelerra-5.1/cinelerra/mwindow.C +++ b/cinelerra-5.1/cinelerra/mwindow.C @@ -3146,13 +3146,23 @@ void MWindow::dump_exe(FILE *fp) { char proc_path[BCTEXTLEN], exe_path[BCTEXTLEN]; sprintf(proc_path, "/proc/%d/exe", (int)getpid()); - int ret = readlink(proc_path, exe_path, sizeof(exe_path)); - if( ret < 0 ) { fprintf(fp,"readlink: %m\n"); return; } - exe_path[ret] = 0; + + int ret = -1, n = 100; + for( int len; (len=readlink(proc_path, exe_path, sizeof(exe_path)))>0; --n ) { + exe_path[len] = 0; strcpy(proc_path, exe_path); + ret = 0; + } + if( n < 0 || ret < 0 ) { fprintf(fp,"readlink: %m\n"); return; } + struct stat st; - if( stat(exe_path,&st) ) { fprintf(fp,"stat: %m\n"); return; } - fprintf(fp, "path: %s = %9jd bytes\n",exe_path,st.st_size); - int fd = open(exe_path,O_RDONLY+O_NONBLOCK); + if( stat(proc_path,&st) ) { fprintf(fp,"stat: %m\n"); return; } + fprintf(fp, "path: %s = %9jd bytes\n",proc_path,st.st_size); + struct tm *tm = localtime(&st.st_mtime); + char mtime[256]; + strftime(mtime, sizeof(mtime), "%F %T", tm); + fprintf(fp,"mtime: %s\n", mtime); + + int fd = open(proc_path,O_RDONLY+O_NONBLOCK); if( fd < 0 ) { fprintf(fp,"open: %m\n"); return; } uint8_t *bfr = 0; int64_t bfrsz = 0; diff --git a/cinelerra-5.1/guicast/bcsignals.C b/cinelerra-5.1/guicast/bcsignals.C index 793666cd..bb3e5958 100644 --- a/cinelerra-5.1/guicast/bcsignals.C +++ b/cinelerra-5.1/guicast/bcsignals.C @@ -28,6 +28,7 @@ #include #include #include +#include #include #include #include @@ -835,9 +836,10 @@ static void handle_dump(int n, siginfo_t * info, void *sc) ucontext_t *uc = (ucontext_t *)sc; int pid = getpid(), tid = gettid(); struct sigcontext *c = (struct sigcontext *)&uc->uc_mcontext; + uint8_t *ip = (uint8_t *)c->IP; fprintf(stderr,"** %s at %p in pid %d, tid %d\n", n==SIGSEGV? "segv" : n==SIGINT? "intr" : "trap", - (void*)c->IP, pid, tid); + (void*)ip, pid, tid); FILE *fp = 0; char fn[PATH_MAX]; if( BC_Signals::trap_path ) { @@ -874,6 +876,27 @@ static void handle_dump(int n, siginfo_t * info, void *sc) fprintf(fp,"\nVERSION:\n"); bc_copy_textfile(INT_MAX, fp,"/proc/version"); fprintf(fp,"\nMEMINFO:\n"); bc_copy_textfile(INT_MAX, fp,"/proc/meminfo"); fprintf(fp,"\nMAPS:\n"); bc_copy_textfile(INT_MAX, fp,"/proc/%d/maps",pid); + char proc_mem[64]; + if( tid > 0 && tid != pid ) + sprintf(proc_mem,"/proc/%d/task/%d/mem",pid,tid); + else + sprintf(proc_mem,"/proc/%d/mem",pid); + int pfd = open(proc_mem,O_RDONLY); + if( pfd >= 0 ) { + fprintf(fp,"\nCODE:\n"); + for( int i=-32; i<32; ) { + uint8_t v; void *vp = (void *)(ip + i); + if( !(i & 7) ) fprintf(fp,"%p: ", vp); + if( pread(pfd,&v,sizeof(v),(off_t)vp) != sizeof(v) ) break; + fprintf(fp,"%c%02x", !i ? '>' : ' ', v); + if( !(++i & 7) ) fprintf(fp,"\n"); + } + fprintf(fp,"\n"); + close(pfd); + } + else + fprintf(fp,"err opening: %s, %m\n", proc_mem); + fprintf(fp,"\n\n"); if( fp != stdout ) fclose(fp); char cmd[1024], *cp = cmd;