upgrade dmp output
authorGood Guy <good1.2guy@gmail.com>
Mon, 12 Sep 2016 23:15:36 +0000 (17:15 -0600)
committerGood Guy <good1.2guy@gmail.com>
Mon, 12 Sep 2016 23:15:36 +0000 (17:15 -0600)
cinelerra-5.1/cinelerra/adeviceprefs.C
cinelerra-5.1/cinelerra/mwindow.C
cinelerra-5.1/guicast/bcsignals.C

index eb3ccfcf32380bf58703f9325f47dbbd2913ae5e..f3a108930da731d68e718da9c59bf8a7d7d80554 100644 (file)
@@ -342,6 +342,7 @@ int ADevicePrefs::create_alsa_objs()
        int x1 = x + menu->get_w() + 5;
 
        ArrayList<char*> *alsa_titles = new ArrayList<char*>;
+       alsa_titles->set_array_delete();
        AudioALSA::list_devices(alsa_titles, 0, mode);
 
 
index 15b29e5c4ce1d06b5b1bfbd89e34bf89f69e0df0..de49bcf436aeead88135ae27e3e7b18bbc71e465 100644 (file)
@@ -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;
index 793666cd1ca53262be65b034680817b939e05bce..bb3e59580e2e2ea9abacf378f5b5640e052c2957 100644 (file)
@@ -28,6 +28,7 @@
 #include <ctype.h>
 #include <dirent.h>
 #include <execinfo.h>
+#include <fcntl.h>
 #include <pwd.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -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;