@@ -3857,8 +3857,8 @@ thread_result_t Process::RunPrivateStateThread(bool is_secondary_thread) {
3857
3857
// case we should tell it to stop doing that. Normally, we don't NEED
3858
3858
// to do that because we will next close the communication to the stub
3859
3859
// and that will get it to shut down. But there are remote debugging
3860
- // cases where relying on that side-effect causes the shutdown to be
3861
- // flakey, so we should send a positive signal to interrupt the wait.
3860
+ // cases where relying on that side-effect causes the shutdown to be
3861
+ // flakey, so we should send a positive signal to interrupt the wait.
3862
3862
Status error = HaltPrivate ();
3863
3863
BroadcastEvent (eBroadcastBitInterrupt, nullptr );
3864
3864
} else if (StateIsRunningState (m_last_broadcast_state)) {
@@ -6410,12 +6410,20 @@ GetCoreFileSaveRangesStackOnly(Process &process,
6410
6410
if (!reg_ctx_sp)
6411
6411
continue ;
6412
6412
const addr_t sp = reg_ctx_sp->GetSP ();
6413
+ const size_t red_zone = process.GetABI ()->GetRedZoneSize ();
6413
6414
lldb_private::MemoryRegionInfo sp_region;
6414
6415
if (process.GetMemoryRegionInfo (sp, sp_region).Success ()) {
6415
6416
// Only add this region if not already added above. If our stack pointer
6416
6417
// is pointing off in the weeds, we will want this range.
6417
- if (stack_bases.count (sp_region.GetRange ().GetRangeBase ()) == 0 )
6418
+ if (stack_bases.count (sp_region.GetRange ().GetRangeBase ()) == 0 ) {
6419
+ // Take only the start of the stack to the stack pointer and include the redzone.
6420
+ // Because stacks grow 'down' to include the red_zone we have to subtract it from the sp.
6421
+ const size_t stack_head = (sp - red_zone);
6422
+ const size_t stack_size = sp_region.GetRange ().GetRangeEnd () - (stack_head);
6423
+ sp_region.GetRange ().SetRangeBase (stack_head);
6424
+ sp_region.GetRange ().SetByteSize (stack_size);
6418
6425
AddRegion (sp_region, try_dirty_pages, ranges);
6426
+ }
6419
6427
}
6420
6428
}
6421
6429
}
0 commit comments