<html>
<head>
<base href="https://llvm.org/bugs/" />
</head>
<body><table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Bug ID</th>
<td><a class="bz_bug_link
bz_status_NEW "
title="NEW --- - LLDB on linux cannot continue a program which encounters a SIGSEGV"
href="https://llvm.org/bugs/show_bug.cgi?id=23571">23571</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>LLDB on linux cannot continue a program which encounters a SIGSEGV
</td>
</tr>
<tr>
<th>Product</th>
<td>lldb
</td>
</tr>
<tr>
<th>Version</th>
<td>unspecified
</td>
</tr>
<tr>
<th>Hardware</th>
<td>PC
</td>
</tr>
<tr>
<th>OS</th>
<td>Linux
</td>
</tr>
<tr>
<th>Status</th>
<td>NEW
</td>
</tr>
<tr>
<th>Severity</th>
<td>normal
</td>
</tr>
<tr>
<th>Priority</th>
<td>P
</td>
</tr>
<tr>
<th>Component</th>
<td>All Bugs
</td>
</tr>
<tr>
<th>Assignee</th>
<td>lldb-dev@cs.uiuc.edu
</td>
</tr>
<tr>
<th>Reporter</th>
<td>labath@google.com
</td>
</tr>
<tr>
<th>Classification</th>
<td>Unclassified
</td>
</tr></table>
<p>
<div>
<pre>$ 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)</pre>
</div>
</p>
<hr>
<span>You are receiving this mail because:</span>
<ul>
<li>You are the assignee for the bug.</li>
</ul>
</body>
</html>