Skip to content

Commit 6dc0ca9

Browse files
committed
rebase
Created using spr 1.3.4
2 parents e4eb32e + 58d99f5 commit 6dc0ca9

File tree

49 files changed

+1275
-163
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

49 files changed

+1275
-163
lines changed

compiler-rt/lib/asan/asan_posix.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ void PlatformTSDDtor(void *tsd) {
149149
# endif
150150

151151
static void BeforeFork() {
152-
VReport(2, "BeforeFork tid: %d\n", GetTid());
152+
VReport(2, "BeforeFork tid: %llu\n", GetTid());
153153
if (CAN_SANITIZE_LEAKS) {
154154
__lsan::LockGlobal();
155155
}
@@ -169,7 +169,7 @@ static void AfterFork(bool fork_child) {
169169
if (CAN_SANITIZE_LEAKS) {
170170
__lsan::UnlockGlobal();
171171
}
172-
VReport(2, "AfterFork tid: %d\n", GetTid());
172+
VReport(2, "AfterFork tid: %llu\n", GetTid());
173173
}
174174

175175
void InstallAtForkHandler() {

compiler-rt/lib/dfsan/dfsan_custom.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2859,15 +2859,15 @@ WRAPPER_ALIAS(__isoc99_sscanf, sscanf)
28592859
WRAPPER_ALIAS(__isoc23_sscanf, sscanf)
28602860

28612861
static void BeforeFork() {
2862-
VReport(2, "BeforeFork tid: %d\n", GetTid());
2862+
VReport(2, "BeforeFork tid: %llu\n", GetTid());
28632863
StackDepotLockBeforeFork();
28642864
ChainedOriginDepotLockBeforeFork();
28652865
}
28662866

28672867
static void AfterFork(bool fork_child) {
28682868
ChainedOriginDepotUnlockAfterFork(fork_child);
28692869
StackDepotUnlockAfterFork(fork_child);
2870-
VReport(2, "AfterFork tid: %d\n", GetTid());
2870+
VReport(2, "AfterFork tid: %llu\n", GetTid());
28712871
}
28722872

28732873
SANITIZER_INTERFACE_ATTRIBUTE

compiler-rt/lib/hwasan/hwasan_linux.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -528,7 +528,7 @@ uptr TagMemoryAligned(uptr p, uptr size, tag_t tag) {
528528
}
529529

530530
static void BeforeFork() {
531-
VReport(2, "BeforeFork tid: %d\n", GetTid());
531+
VReport(2, "BeforeFork tid: %llu\n", GetTid());
532532
if (CAN_SANITIZE_LEAKS) {
533533
__lsan::LockGlobal();
534534
}
@@ -548,7 +548,7 @@ static void AfterFork(bool fork_child) {
548548
if (CAN_SANITIZE_LEAKS) {
549549
__lsan::UnlockGlobal();
550550
}
551-
VReport(2, "AfterFork tid: %d\n", GetTid());
551+
VReport(2, "AfterFork tid: %llu\n", GetTid());
552552
}
553553

554554
void HwasanInstallAtForkHandler() {

compiler-rt/lib/lsan/lsan_posix.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ void InstallAtExitCheckLeaks() {
9797
}
9898

9999
static void BeforeFork() {
100-
VReport(2, "BeforeFork tid: %d\n", GetTid());
100+
VReport(2, "BeforeFork tid: %llu\n", GetTid());
101101
LockGlobal();
102102
LockThreads();
103103
LockAllocator();
@@ -109,7 +109,7 @@ static void AfterFork(bool fork_child) {
109109
UnlockAllocator();
110110
UnlockThreads();
111111
UnlockGlobal();
112-
VReport(2, "AfterFork tid: %d\n", GetTid());
112+
VReport(2, "AfterFork tid: %llu\n", GetTid());
113113
}
114114

115115
void InstallAtForkHandler() {

compiler-rt/lib/msan/msan_linux.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,7 @@ void MsanTSDDtor(void *tsd) {
302302
# endif
303303

304304
static void BeforeFork() {
305-
VReport(2, "BeforeFork tid: %d\n", GetTid());
305+
VReport(2, "BeforeFork tid: %llu\n", GetTid());
306306
// Usually we lock ThreadRegistry, but msan does not have one.
307307
LockAllocator();
308308
StackDepotLockBeforeFork();
@@ -314,7 +314,7 @@ static void AfterFork(bool fork_child) {
314314
StackDepotUnlockAfterFork(fork_child);
315315
UnlockAllocator();
316316
// Usually we unlock ThreadRegistry, but msan does not have one.
317-
VReport(2, "AfterFork tid: %d\n", GetTid());
317+
VReport(2, "AfterFork tid: %llu\n", GetTid());
318318
}
319319

320320
void InstallAtForkHandler() {

compiler-rt/lib/sanitizer_common/sanitizer_linux.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1037,9 +1037,7 @@ ThreadLister::Result ThreadLister::ListThreads(
10371037
Report("Can't open %s for reading.\n", task_path_.data());
10381038
return Error;
10391039
}
1040-
auto acts_cleanup = at_scope_exit([&] {
1041-
internal_close(descriptor);
1042-
});
1040+
auto acts_cleanup = at_scope_exit([&] { internal_close(descriptor); });
10431041
threads->clear();
10441042

10451043
Result result = Ok;

compiler-rt/lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cpp

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -148,14 +148,6 @@ bool ThreadSuspender::SuspendThread(tid_t tid) {
148148
// Log this event and move on.
149149
VReport(1, "Could not attach to thread %zu (errno %d).\n", (uptr)tid,
150150
pterrno);
151-
if (common_flags()->verbosity >= 2) {
152-
InternalScopedString path;
153-
path.AppendF("/proc/%d/task/%llu/status", pid_, tid);
154-
InternalMmapVector<char> buffer;
155-
ReadFileToVector(path.data(), &buffer);
156-
buffer.push_back(0);
157-
VReport(2, "%s: %s\n", path.data(), buffer.data());
158-
}
159151
return false;
160152
} else {
161153
VReport(2, "Attached to thread %zu.\n", (uptr)tid);
@@ -234,8 +226,18 @@ bool ThreadSuspender::SuspendAllThreads() {
234226
break;
235227
}
236228
for (tid_t tid : threads) {
237-
if (SuspendThread(tid))
229+
if (SuspendThread(tid)) {
238230
retry = true;
231+
} else {
232+
if (common_flags()->verbosity >= 2) {
233+
InternalScopedString path;
234+
path.AppendF("/proc/%d/task/%llu/status", pid_, tid);
235+
InternalMmapVector<char> buffer;
236+
ReadFileToVector(path.data(), &buffer);
237+
buffer.push_back(0);
238+
VReport(2, "%s: %s\n", path.data(), buffer.data());
239+
}
240+
}
239241
}
240242
if (retry)
241243
VReport(1, "SuspendAllThreads retry: %d\n", i);

compiler-rt/lib/tsan/rtl/tsan_rtl.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -806,7 +806,7 @@ int Finalize(ThreadState *thr) {
806806

807807
#if !SANITIZER_GO
808808
void ForkBefore(ThreadState* thr, uptr pc) SANITIZER_NO_THREAD_SAFETY_ANALYSIS {
809-
VReport(2, "BeforeFork tid: %d\n", GetTid());
809+
VReport(2, "BeforeFork tid: %llu\n", GetTid());
810810
GlobalProcessorLock();
811811
// Detaching from the slot makes OnUserFree skip writing to the shadow.
812812
// The slot will be locked so any attempts to use it will deadlock anyway.
@@ -848,7 +848,7 @@ static void ForkAfter(ThreadState* thr,
848848
SlotAttachAndLock(thr);
849849
SlotUnlock(thr);
850850
GlobalProcessorUnlock();
851-
VReport(2, "AfterFork tid: %d\n", GetTid());
851+
VReport(2, "AfterFork tid: %llu\n", GetTid());
852852
}
853853

854854
void ForkParentAfter(ThreadState* thr, uptr pc) { ForkAfter(thr, false); }

lldb/include/lldb/API/SBProcess.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ class LLDB_API SBProcess {
159159
lldb::SBError Destroy();
160160

161161
lldb::SBError Continue();
162+
lldb::SBError Continue(RunDirection direction);
162163

163164
lldb::SBError Stop();
164165

lldb/include/lldb/Target/Process.h

Lines changed: 15 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -857,10 +857,10 @@ class Process : public std::enable_shared_from_this<Process>,
857857
/// \see Thread:Resume()
858858
/// \see Thread:Step()
859859
/// \see Thread:Suspend()
860-
Status Resume();
860+
Status Resume(lldb::RunDirection direction = lldb::eRunForward);
861861

862862
/// Resume a process, and wait for it to stop.
863-
Status ResumeSynchronous(Stream *stream);
863+
Status ResumeSynchronous(Stream *stream, lldb::RunDirection direction = lldb::eRunForward);
864864

865865
/// Halts a running process.
866866
///
@@ -1104,9 +1104,14 @@ class Process : public std::enable_shared_from_this<Process>,
11041104
/// \see Thread:Resume()
11051105
/// \see Thread:Step()
11061106
/// \see Thread:Suspend()
1107-
virtual Status DoResume() {
1108-
return Status::FromErrorStringWithFormatv(
1109-
"error: {0} does not support resuming processes", GetPluginName());
1107+
virtual Status DoResume(lldb::RunDirection direction) {
1108+
if (direction == lldb::RunDirection::eRunForward) {
1109+
return Status::FromErrorStringWithFormatv(
1110+
"error: {0} does not support resuming processes", GetPluginName());
1111+
} else {
1112+
return Status::FromErrorStringWithFormatv(
1113+
"error: {0} does not support reverse execution of processes", GetPluginName());
1114+
}
11101115
}
11111116

11121117
/// Called after resuming a process.
@@ -2332,6 +2337,8 @@ class Process : public std::enable_shared_from_this<Process>,
23322337

23332338
bool IsRunning() const;
23342339

2340+
lldb::RunDirection GetLastRunDirection() { return m_last_run_direction; }
2341+
23352342
DynamicCheckerFunctions *GetDynamicCheckers() {
23362343
return m_dynamic_checkers_up.get();
23372344
}
@@ -2851,7 +2858,7 @@ void PruneThreadPlans();
28512858
///
28522859
/// \return
28532860
/// An Status object describing the success or failure of the resume.
2854-
Status PrivateResume();
2861+
Status PrivateResume(lldb::RunDirection direction = lldb::eRunForward);
28552862

28562863
// Called internally
28572864
void CompleteAttach();
@@ -3127,6 +3134,8 @@ void PruneThreadPlans();
31273134
// m_currently_handling_do_on_removals are true,
31283135
// Resume will only request a resume, using this
31293136
// flag to check.
3137+
// The direction of execution from the last time this process was resumed.
3138+
lldb::RunDirection m_last_run_direction;
31303139

31313140
lldb::tid_t m_interrupt_tid; /// The tid of the thread that issued the async
31323141
/// interrupt, used by thread plan timeout. It

0 commit comments

Comments
 (0)