Anything concerning signals is not easy in my experience, doubly so with
SIGSEGV. In Windows it is 1000x easier to use IsBadReadPtr() for
studying random memory locations.
> most ideally i would like to get full info like
>
> "MOV instruction for IP 0x0040_110c tried to read from adress 0x0000_0012 which is page guarded from read"
>
> and then silently continue execution
Suggesting to look into gdb sources. Apparently it is capable of running
another program in such a fashion, with:
handle SIGSEGV nostop nopass
Just tested that, as it happens I have a handy module for that which
repeatedly reads bytes from random locations in memory. The code
originates from times when I still had the illusion that the program
could somehow survive illegal memory accesses and that this might be
useful for something. I have abandoned this illusion by now.
Below you see that gdb is printing out a line for each segfault
occurring in my program. You will need to copy that behavior from gdb
and add printouts of any additional information you are interested in.
altair: ~>gdb ac43
GNU gdb (GDB; openSUSE Leap 42.1) 7.11.1
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later
<
http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-suse-linux".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<
http://bugs.opensuse.org/>.
Find the GDB manual and other documentation resources online at:
<
http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ac43...done.
(gdb) handle SIGSEGV nostop nopass
Signal Stop Print Pass to program Description
SIGSEGV No Yes No Segmentation fault
(gdb) run -e 'illegalmemoryaccess()'
Starting program: /users/paavo/bin/ac43 -e 'illegalmemoryaccess()'
Missing separate debuginfos, use: zypper install
glibc-debuginfo-2.19-22.1.x86_64
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
process 20223 is executing new program:
/users/paavo/Acapella/trunk/Production/BuildProducts/Linux/Debug/bin/acapella
Missing separate debuginfos, use: zypper install
libgcc_s1-debuginfo-5.3.1+r233831-6.1.x86_64
libncurses5-debuginfo-5.9-53.4.x86_64 libstdc++6-debuginfo-5.3.1+r
233831-6.1.x86_64
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
[New Thread 0x7fffeff34700 (LWP 20232)]
[New Thread 0x7fffef533700 (LWP 20233)]
[New Thread 0x7fffee2b1700 (LWP 20234)]
[New Thread 0x7fffedab0700 (LWP 20235)]
[New Thread 0x7fffed2af700 (LWP 20236)]
[New Thread 0x7fffecaae700 (LWP 20237)]
[New Thread 0x7fffdffff700 (LWP 20238)]
[New Thread 0x7fffdf7fe700 (LWP 20239)]
[New Thread 0x7fffdeffd700 (LWP 20240)]
[New Thread 0x7fffde7fc700 (LWP 20241)]
[New Thread 0x7fffddffb700 (LWP 20242)]
[New Thread 0x7fffdd7fa700 (LWP 20243)]
[Thread 0x7fffdd7fa700 (LWP 20243) exited]
[New Thread 0x7fffdd7fa700 (LWP 20244)]
[Thread 0x7fffdd7fa700 (LWP 20244) exited]
[New Thread 0x7fffdd7fa700 (LWP 20245)]
Acapella (ver. 4.3.0.0) internal SW developer license for PerkinElmer
2017-08-22 08:40:32 1 {0/0} [acapella/debug] "IllegalMemoryAccess()
module called, process will be crashed now" |PID=20223|TID=20223|SESS=0|
"{immediate}(2) [::
IllegalMemoryAccess]"
Thread 1 "acapella" received signal SIGSEGV, Segmentation fault.
Thread 1 "acapella" received signal SIGSEGV, Segmentation fault.
Thread 1 "acapella" received signal SIGSEGV, Segmentation fault.
Thread 1 "acapella" received signal SIGSEGV, Segmentation fault.
Thread 1 "acapella" received signal SIGSEGV, Segmentation fault.
Thread 1 "acapella" received signal SIGSEGV, Segmentation fault.
Thread 1 "acapella" received signal SIGSEGV, Segmentation fault.
Thread 1 "acapella" received signal SIGSEGV, Segmentation fault.
Thread 1 "acapella" received signal SIGSEGV, Segmentation fault.
Thread 1 "acapella" received signal SIGSEGV, Segmentation fault.
Thread 1 "acapella" received signal SIGSEGV, Segmentation fault.
Thread 1 "acapella" received signal SIGSEGV, Segmentation fault.
Thread 1 "acapella" received signal SIGSEGV, Segmentation fault.
Thread 1 "acapella" received signal SIGSEGV, Segmentation fault.
Thread 1 "acapella" received signal SIGSEGV, Segmentation fault.
Thread 1 "acapella" received signal SIGSEGV, Segmentation fault.
Thread 1 "acapella" received signal SIGSEGV, Segmentation fault.
Thread 1 "acapella" received signal SIGSEGV, Segmentation fault.
Thread 1 "acapella" received signal SIGSEGV, Segmentation fault.
Thread 1 "acapella" received signal SIGSEGV, Segmentation fault.
Thread 1 "acapella" received signal SIGSEGV, Segmentation fault.
Thread 1 "acapella" received signal SIGSEGV, Segmentation fault.
Thread 1 "acapella" received signal SIGSEGV, Segmentation fault.
Thread 1 "acapella" received signal SIGSEGV, Segmentation fault.
...