Skip to content

Commit

Permalink
Add a new SBProcess:: GetCoreFile() API
Browse files Browse the repository at this point in the history
Summary:
This diff added a new `SBProcess::GetCoreFile()` to retrieve target dump file spec used for dump debugging. Note: this is different from the main executable module spec

Facebook:
This is required for `auto-load-debuginfo` Python script to locate METADATA file next to coredump file.

To achieve this, the patch hoists `m_core_file` into `PostMortemProcess` for sharing.

Test Plan:
A new unit test is added.
Tested end-to-end in `auto-load-debuginfo` Python script.

Reviewers: wanyi, hyubo, #lldb_team

Reviewed By: wanyi

Subscribers: #lldb_team

Differential Revision: https://phabricator.intern.facebook.com/D45255862
  • Loading branch information
jeffreytan81 authored and kusmour committed Sep 14, 2024
1 parent ec25794 commit 4159b47
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion lldb/source/Plugins/Process/mach-core/ProcessMachCore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ bool ProcessMachCore::LoadBinariesViaMetadata() {

// LoadCoreFileImges may have set the dynamic loader, e.g. in
// PlatformDarwinKernel::LoadPlatformBinaryAndSetup().
// If we now have a dynamic loader, save its name so we don't
// If we now have a dynamic loader, save its name so we don't
// un-set it later.
if (m_dyld_up)
m_dyld_plugin_name = GetDynamicLoader()->GetPluginName();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -838,7 +838,8 @@ def test_get_core_file_api(self):
Test SBProcess::GetCoreFile() API can successfully get the core file.
"""
core_file_name = "linux-x86_64.core"
target = self.dbg.CreateTarget("linux-x86_64.out")
self.runCmd("settings set use-module-list-dyld true")
target = self.dbg.CreateTarget(None)
process = target.LoadCore(core_file_name)
self.assertTrue(process, PROCESS_IS_VALID)
self.assertEqual(process.GetCoreFile().GetFilename(), core_file_name)
Expand Down

0 comments on commit 4159b47

Please sign in to comment.