[lldb-dev] [Bug 23571] New: LLDB on linux cannot continue a program which encounters a SIGSEGV

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Tue May 19 03:17:46 PDT 2015


https://llvm.org/bugs/show_bug.cgi?id=23571

            Bug ID: 23571
           Summary: LLDB on linux cannot continue a program which
                    encounters a SIGSEGV
           Product: lldb
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: All Bugs
          Assignee: lldb-dev at cs.uiuc.edu
          Reporter: labath at google.com
    Classification: Unclassified

$ cat mm.cpp
#include <iostream>
#include <sys/mman.h>
#include <signal.h>
#include <assert.h>
#include <sys/types.h>
#include <unistd.h>

void* address;
size_t size = 0x1000;
bool signaled = false;

void handler(int sig)
{
    std::cout << "signal " << sig << " received\n";
    signaled = true;
    munmap(address, size);
    void* newaddr = mmap(address, size, PROT_READ | PROT_WRITE, MAP_ANONYMOUS |
MAP_FIXED | MAP_PRIVATE, -1, 0);
    assert(newaddr == address);
    *(int*)newaddr = 777;
}

int main()
{
    sigset(SIGSEGV, handler);
    address = mmap(NULL, size, PROT_NONE, MAP_ANONYMOUS | MAP_PRIVATE, -1, 0);
    int x = *(int*)address;
    std::cout << (signaled ? "success " : "failure ") << x << "\n";
}





$ ~/llvm/bin/lldb ./mm
(lldb) target create "./mm"
Current executable set to './mm' (x86_64).
(lldb) br se -b main
Breakpoint 1: where = mm`main + 30 at mm.cpp:24, address = 0x0000000000400a7e
(lldb) pr lau
Process 14194 launched: './mm' (x86_64)
Process 14194 stopped
* thread #1: tid = 14194, 0x0000000000400a7e mm`main + 30 at mm.cpp:24, name =
'mm', stop reason = breakpoint 1.1
    frame #0: 0x0000000000400a7e mm`main + 30 at mm.cpp:24
   21
   22   int main()
   23   {
-> 24       sigset(SIGSEGV, handler);
   25
   26       address = mmap(NULL, size, PROT_NONE, MAP_ANONYMOUS | MAP_PRIVATE,
-1, 0);
   27       int x = *(int*)address;
(lldb) pr ha SIGSEGV -s false -p true -n false
NAME        PASS   STOP   NOTIFY
==========  =====  =====  ======
SIGSEGV     true   false  false
(lldb) c
Process 14194 resuming
Process 14194 stopped
* thread #1: tid = 14194, 0x0000000000400acc mm`main + 108 at mm.cpp:27, name =
'mm', stop reason = address access protected (fault address: 0x7ffff7ff7000)
    frame #0: 0x0000000000400acc mm`main + 108 at mm.cpp:27
   24       sigset(SIGSEGV, handler);
   25
   26       address = mmap(NULL, size, PROT_NONE, MAP_ANONYMOUS | MAP_PRIVATE,
-1, 0);
-> 27       int x = *(int*)address;
   28       std::cout << (signaled ? "success " : "failure ") << x << "\n";
   29   }
(lldb) c
Process 14194 resuming
Process 14194 stopped
* thread #1: tid = 14194, 0x0000000000400acc mm`main + 108 at mm.cpp:27, name =
'mm', stop reason = address access protected (fault address: 0x7ffff7ff7000)
    frame #0: 0x0000000000400acc mm`main + 108 at mm.cpp:27
   24       sigset(SIGSEGV, handler);
   25
   26       address = mmap(NULL, size, PROT_NONE, MAP_ANONYMOUS | MAP_PRIVATE,
-1, 0);
-> 27       int x = *(int*)address;
   28       std::cout << (signaled ? "success " : "failure ") << x << "\n";
   29   }
(lldb) c
Process 14194 resuming
Process 14194 stopped
* thread #1: tid = 14194, 0x0000000000400acc mm`main + 108 at mm.cpp:27, name =
'mm', stop reason = address access protected (fault address: 0x7ffff7ff7000)
    frame #0: 0x0000000000400acc mm`main + 108 at mm.cpp:27
   24       sigset(SIGSEGV, handler);
   25
   26       address = mmap(NULL, size, PROT_NONE, MAP_ANONYMOUS | MAP_PRIVATE,
-1, 0);
-> 27       int x = *(int*)address;
   28       std::cout << (signaled ? "success " : "failure ") << x << "\n";
   29   }
(lldb)

-- 
You are receiving this mail because:
You are the assignee for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-dev/attachments/20150519/8f63e813/attachment.html>


More information about the lldb-dev mailing list