@@ -952,37 +952,26 @@ PluginManager::GetObjectFileCreateMemoryCallbackForPluginName(
952952 return nullptr ;
953953}
954954
955- Status PluginManager::SaveCore (const lldb::ProcessSP &process_sp,
956- lldb_private::SaveCoreOptions &options) {
955+ Status PluginManager::SaveCore (lldb_private::SaveCoreOptions &options) {
957956 Status error;
958957 if (!options.GetOutputFile ()) {
959958 error = Status::FromErrorString (" No output file specified" );
960959 return error;
961960 }
962961
963- if (!process_sp ) {
962+ if (!options. GetProcess () ) {
964963 error = Status::FromErrorString (" Invalid process" );
965964 return error;
966965 }
967966
968- if (!options.GetProcess ())
969- options.SetProcess (process_sp);
970-
971- // Make sure the process sp is the same as the one we are using.
972- if (options.GetProcess () != process_sp) {
973- error = Status::FromErrorString (
974- " Save Core Options configured for a different process." );
975- return error;
976- }
977-
978- error = options.EnsureValidConfiguration (process_sp);
967+ error = options.EnsureValidConfiguration ();
979968 if (error.Fail ())
980969 return error;
981970
982971 if (!options.GetPluginName ().has_value ()) {
983972 // Try saving core directly from the process plugin first.
984973 llvm::Expected<bool > ret =
985- process_sp ->SaveCore (options.GetOutputFile ()->GetPath ());
974+ options. GetProcess () ->SaveCore (options.GetOutputFile ()->GetPath ());
986975 if (!ret)
987976 return Status::FromError (ret.takeError ());
988977 if (ret.get ())
@@ -994,7 +983,10 @@ Status PluginManager::SaveCore(const lldb::ProcessSP &process_sp,
994983 auto instances = GetObjectFileInstances ().GetSnapshot ();
995984 for (auto &instance : instances) {
996985 if (plugin_name.empty () || instance.name == plugin_name) {
997- if (instance.save_core && instance.save_core (process_sp, options, error))
986+ // TODO: Refactor the instance.save_core() to not require a process and
987+ // get it from options instead.
988+ if (instance.save_core &&
989+ instance.save_core (options.GetProcess (), options, error))
998990 return error;
999991 }
1000992 }
0 commit comments