@@ -555,58 +555,6 @@ Status ProcessGDBRemote::DoConnectRemote(llvm::StringRef remote_url) {
555
555
}
556
556
}
557
557
558
- // The remote stub may know about the "main binary" in
559
- // the context of a firmware debug session, and can
560
- // give us a UUID and an address/slide of where the
561
- // binary is loaded in memory.
562
- UUID standalone_uuid;
563
- addr_t standalone_value;
564
- bool standalone_value_is_offset;
565
- if (m_gdb_comm.GetProcessStandaloneBinary (
566
- standalone_uuid, standalone_value, standalone_value_is_offset)) {
567
- ModuleSP module_sp;
568
-
569
- if (standalone_uuid.IsValid ()) {
570
- const bool force_symbol_search = true ;
571
- const bool notify = true ;
572
- DynamicLoader::LoadBinaryWithUUIDAndAddress (
573
- this , llvm::StringRef (), standalone_uuid, standalone_value,
574
- standalone_value_is_offset, force_symbol_search, notify);
575
- }
576
- }
577
-
578
- // The remote stub may know about a list of binaries to
579
- // force load into the process -- a firmware type situation
580
- // where multiple binaries are present in virtual memory,
581
- // and we are only given the addresses of the binaries.
582
- // Not intended for use with userland debugging when we
583
- // a DynamicLoader plugin that knows how to find the loaded
584
- // binaries and will track updates as binaries are added.
585
-
586
- std::vector<addr_t > bin_addrs = m_gdb_comm.GetProcessStandaloneBinaries ();
587
- if (bin_addrs.size ()) {
588
- UUID uuid;
589
- const bool value_is_slide = false ;
590
- for (addr_t addr : bin_addrs) {
591
- const bool notify = true ;
592
- // First see if this is a special platform
593
- // binary that may determine the DynamicLoader and
594
- // Platform to be used in this Process/Target in the
595
- // process of loading it.
596
- if (GetTarget ()
597
- .GetDebugger ()
598
- .GetPlatformList ()
599
- .LoadPlatformBinaryAndSetup (this , addr, notify))
600
- continue ;
601
-
602
- const bool force_symbol_search = true ;
603
- // Second manually load this binary into the Target.
604
- DynamicLoader::LoadBinaryWithUUIDAndAddress (
605
- this , llvm::StringRef (), uuid, addr, value_is_slide,
606
- force_symbol_search, notify);
607
- }
608
- }
609
-
610
558
const StateType state = SetThreadStopInfo (response);
611
559
if (state != eStateInvalid) {
612
560
SetPrivateState (state);
@@ -1007,6 +955,9 @@ void ProcessGDBRemote::DidLaunchOrAttach(ArchSpec &process_arch) {
1007
955
}
1008
956
}
1009
957
958
+ // Target and Process are reasonably initailized;
959
+ // load any binaries we have metadata for / set load address.
960
+ LoadStubBinaries ();
1010
961
MaybeLoadExecutableModule ();
1011
962
1012
963
// Find out which StructuredDataPlugins are supported by the debug monitor.
@@ -1028,6 +979,59 @@ void ProcessGDBRemote::DidLaunchOrAttach(ArchSpec &process_arch) {
1028
979
}
1029
980
}
1030
981
982
+ void ProcessGDBRemote::LoadStubBinaries () {
983
+ // The remote stub may know about the "main binary" in
984
+ // the context of a firmware debug session, and can
985
+ // give us a UUID and an address/slide of where the
986
+ // binary is loaded in memory.
987
+ UUID standalone_uuid;
988
+ addr_t standalone_value;
989
+ bool standalone_value_is_offset;
990
+ if (m_gdb_comm.GetProcessStandaloneBinary (standalone_uuid, standalone_value,
991
+ standalone_value_is_offset)) {
992
+ ModuleSP module_sp;
993
+
994
+ if (standalone_uuid.IsValid ()) {
995
+ const bool force_symbol_search = true ;
996
+ const bool notify = true ;
997
+ DynamicLoader::LoadBinaryWithUUIDAndAddress (
998
+ this , " " , standalone_uuid, standalone_value,
999
+ standalone_value_is_offset, force_symbol_search, notify);
1000
+ }
1001
+ }
1002
+
1003
+ // The remote stub may know about a list of binaries to
1004
+ // force load into the process -- a firmware type situation
1005
+ // where multiple binaries are present in virtual memory,
1006
+ // and we are only given the addresses of the binaries.
1007
+ // Not intended for use with userland debugging, when we use
1008
+ // a DynamicLoader plugin that knows how to find the loaded
1009
+ // binaries, and will track updates as binaries are added.
1010
+
1011
+ std::vector<addr_t > bin_addrs = m_gdb_comm.GetProcessStandaloneBinaries ();
1012
+ if (bin_addrs.size ()) {
1013
+ UUID uuid;
1014
+ const bool value_is_slide = false ;
1015
+ for (addr_t addr : bin_addrs) {
1016
+ const bool notify = true ;
1017
+ // First see if this is a special platform
1018
+ // binary that may determine the DynamicLoader and
1019
+ // Platform to be used in this Process and Target.
1020
+ if (GetTarget ()
1021
+ .GetDebugger ()
1022
+ .GetPlatformList ()
1023
+ .LoadPlatformBinaryAndSetup (this , addr, notify))
1024
+ continue ;
1025
+
1026
+ const bool force_symbol_search = true ;
1027
+ // Second manually load this binary into the Target.
1028
+ DynamicLoader::LoadBinaryWithUUIDAndAddress (this , llvm::StringRef (), uuid,
1029
+ addr, value_is_slide,
1030
+ force_symbol_search, notify);
1031
+ }
1032
+ }
1033
+ }
1034
+
1031
1035
void ProcessGDBRemote::MaybeLoadExecutableModule () {
1032
1036
ModuleSP module_sp = GetTarget ().GetExecutableModule ();
1033
1037
if (!module_sp)
0 commit comments