diff -x '*.po' -d -urpN abrt.0/inc/CrashTypes.h abrt.1/inc/CrashTypes.h
--- abrt.0/inc/CrashTypes.h	2010-05-28 18:55:39.000000000 +0200
+++ abrt.1/inc/CrashTypes.h	2010-06-01 19:26:22.129761826 +0200
@@ -25,6 +25,7 @@
 // filled by a hook:
 #define FILENAME_ANALYZER     "analyzer"
 #define FILENAME_EXECUTABLE   "executable"
+#define FILENAME_BINARY       "binary"
 #define FILENAME_CMDLINE      "cmdline"
 #define FILENAME_REASON       "reason"
 #define FILENAME_COREDUMP     "coredump"
diff -x '*.po' -d -urpN abrt.0/lib/Plugins/CCpp.conf abrt.1/lib/Plugins/CCpp.conf
--- abrt.0/lib/Plugins/CCpp.conf	2010-05-28 18:55:39.000000000 +0200
+++ abrt.1/lib/Plugins/CCpp.conf	2010-06-07 11:55:06.421708060 +0200
@@ -5,6 +5,10 @@ Enabled = yes
 # in crashed process' current dir, set to "yes"
 MakeCompatCore = yes
 
+# Do you want a copy of crashed binary be saved?
+# (useful, for example, when _deleted binary_ segfaults)
+SaveBinaryImage = no
+
 # Generate backtrace
 Backtrace = yes
 
diff -x '*.po' -d -urpN abrt.0/src/Hooks/abrt-hook-ccpp.cpp abrt.1/src/Hooks/abrt-hook-ccpp.cpp
--- abrt.0/src/Hooks/abrt-hook-ccpp.cpp	2010-05-28 18:55:39.000000000 +0200
+++ abrt.1/src/Hooks/abrt-hook-ccpp.cpp	2010-06-07 11:58:08.420711818 +0200
@@ -132,11 +132,12 @@ static off_t copyfd_sparse(int src_fd, i
 	return total;
 }
 
-static char* get_executable(pid_t pid)
+static char* get_executable(pid_t pid, int *fd_p)
 {
     char buf[sizeof("/proc/%lu/exe") + sizeof(long)*3];
 
     sprintf(buf, "/proc/%lu/exe", (long)pid);
+    *fd_p = open(buf, O_RDONLY); /* might fail and return -1, it's ok */
     return malloc_readlink(buf);
 }
 
@@ -262,7 +263,8 @@ int main(int argc, char** argv)
         error_msg_and_die("pid '%s' or limit '%s' is bogus", argv[2], argv[5]);
     }
 
-    char* executable = get_executable(pid);
+    int src_fd_binary;
+    char* executable = get_executable(pid, &src_fd_binary);
     if (executable == NULL)
     {
         error_msg_and_die("can't read /proc/%lu/exe link", (long)pid);
@@ -278,7 +280,13 @@ int main(int argc, char** argv)
     /* Parse abrt.conf and plugins/CCpp.conf */
     unsigned setting_MaxCrashReportsSize = 0;
     bool setting_MakeCompatCore = false;
-    parse_conf(CONF_DIR"/plugins/CCpp.conf", &setting_MaxCrashReportsSize, &setting_MakeCompatCore);
+    bool setting_SaveBinaryImage = false;
+    parse_conf(CONF_DIR"/plugins/CCpp.conf", &setting_MaxCrashReportsSize, &setting_MakeCompatCore, &setting_SaveBinaryImage);
+    if (!setting_SaveBinaryImage && src_fd_binary >= 0)
+    {
+        close(src_fd_binary);
+        src_fd_binary = -1;
+    }
 
     /* Open a fd to compat coredump, if requested and is possible */
     int user_core_fd = -1;
@@ -332,7 +340,7 @@ int main(int argc, char** argv)
             fstat(fd, &sb); /* !paranoia. this can't fail. */
 
             if (sb.st_size != 0 /* if it wasn't created by us just now... */
-	     && (unsigned)(time(NULL) - sb.st_mtime) < 20 /* and is relatively new [is 20 sec ok?] */
+             && (unsigned)(time(NULL) - sb.st_mtime) < 20 /* and is relatively new [is 20 sec ok?] */
             ) {
                 sz = read(fd, path, sizeof(path)-1); /* (ab)using path as scratch buf */
                 if (sz > 0)
@@ -391,6 +399,20 @@ int main(int argc, char** argv)
         free(cmdline);
         free(reason);
 
+        if (src_fd_binary > 0)
+        {
+            strcpy(path + path_len, "/"FILENAME_BINARY);
+            int dst_fd_binary = xopen3(path, O_WRONLY | O_CREAT | O_TRUNC, 0600);
+            off_t sz = copyfd_eof(src_fd_binary, dst_fd_binary, COPYFD_SPARSE);
+            if (sz < 0 || fsync(dst_fd_binary) != 0)
+            {
+                unlink(path);
+                error_msg_and_die("error saving binary image to %s", path);
+            }
+            close(dst_fd_binary);
+            close(src_fd_binary);
+        }
+
         /* We need coredumps to be readable by all, because
          * when abrt daemon processes coredump,
          * process producing backtrace is run under the same UID
diff -x '*.po' -d -urpN abrt.0/src/Hooks/abrt-hook-python.cpp abrt.1/src/Hooks/abrt-hook-python.cpp
--- abrt.0/src/Hooks/abrt-hook-python.cpp	2010-05-28 18:55:39.000000000 +0200
+++ abrt.1/src/Hooks/abrt-hook-python.cpp	2010-06-07 11:56:17.368708969 +0200
@@ -91,7 +91,7 @@ int main(int argc, char** argv)
     error_msg_and_die("daemon is not running, python crash dump aborted");
 
   unsigned setting_MaxCrashReportsSize = 0;
-  parse_conf(NULL, &setting_MaxCrashReportsSize, NULL);
+  parse_conf(NULL, &setting_MaxCrashReportsSize, NULL, NULL);
   if (setting_MaxCrashReportsSize > 0)
   {
     check_free_space(setting_MaxCrashReportsSize);
diff -x '*.po' -d -urpN abrt.0/src/Hooks/hooklib.cpp abrt.1/src/Hooks/hooklib.cpp
--- abrt.0/src/Hooks/hooklib.cpp	2010-05-28 18:55:39.000000000 +0200
+++ abrt.1/src/Hooks/hooklib.cpp	2010-06-07 12:03:42.935708254 +0200
@@ -22,7 +22,7 @@
 
 using namespace std;
 
-void parse_conf(const char *additional_conf, unsigned *setting_MaxCrashReportsSize, bool *setting_MakeCompatCore)
+void parse_conf(const char *additional_conf, unsigned *setting_MaxCrashReportsSize, bool *setting_MakeCompatCore, bool *setting_SaveBinaryImage)
 {
     FILE *fp = fopen(CONF_DIR"/abrt.conf", "r");
     if (!fp)
@@ -77,6 +77,17 @@ void parse_conf(const char *additional_c
             continue;
         }
 #undef DIRECTIVE
+#define DIRECTIVE "SaveBinaryImage"
+        if (setting_SaveBinaryImage && strncmp(p, DIRECTIVE, sizeof(DIRECTIVE)-1) == 0)
+        {
+            p = skip_whitespace(p + sizeof(DIRECTIVE)-1);
+            if (*p != '=')
+                continue;
+            p = skip_whitespace(p + 1);
+            *setting_SaveBinaryImage = string_to_bool(p);
+            continue;
+        }
+#undef DIRECTIVE
         /* add more 'if (strncmp(p, DIRECTIVE, sizeof(DIRECTIVE)-1) == 0)' here... */
     }
 }
diff -x '*.po' -d -urpN abrt.0/src/Hooks/hooklib.h abrt.1/src/Hooks/hooklib.h
--- abrt.0/src/Hooks/hooklib.h	2010-05-28 18:55:39.000000000 +0200
+++ abrt.1/src/Hooks/hooklib.h	2010-06-07 11:56:10.231708933 +0200
@@ -16,6 +16,6 @@
     51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */
 
-void parse_conf(const char *additional_conf, unsigned *setting_MaxCrashReportsSize, bool *setting_MakeCompatCore);
+void parse_conf(const char *additional_conf, unsigned *setting_MaxCrashReportsSize, bool *setting_MakeCompatCore, bool *setting_SaveBinaryImage);
 void check_free_space(unsigned setting_MaxCrashReportsSize);
 void trim_debug_dumps(unsigned setting_MaxCrashReportsSize, const char *exclude_path);
