[Lldb-commits] [lldb] r201364 - Change the way the m_trap_handlers Platform base class ivar is initialized;
Jason Molenda
jmolenda at apple.com
Thu Feb 13 15:11:45 PST 2014
Author: jmolenda
Date: Thu Feb 13 17:11:45 2014
New Revision: 201364
URL: http://llvm.org/viewvc/llvm-project?rev=201364&view=rev
Log:
Change the way the m_trap_handlers Platform base class ivar is initialized;
add a new pure virtual CalculateTrapHandlerSymbolNames() that Platform
subclasses must implement which fills in the function name list with any
trap handlers that are expected on that platform.
Modified:
lldb/trunk/include/lldb/Target/Platform.h
lldb/trunk/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp
lldb/trunk/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.h
lldb/trunk/source/Plugins/Platform/Linux/PlatformLinux.cpp
lldb/trunk/source/Plugins/Platform/Linux/PlatformLinux.h
lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.h
lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp
lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.h
lldb/trunk/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp
lldb/trunk/source/Plugins/Platform/POSIX/PlatformPOSIX.h
lldb/trunk/source/Plugins/Platform/Windows/PlatformWindows.h
lldb/trunk/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
lldb/trunk/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h
lldb/trunk/source/Target/Platform.cpp
Modified: lldb/trunk/include/lldb/Target/Platform.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Target/Platform.h?rev=201364&r1=201363&r2=201364&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Target/Platform.h (original)
+++ lldb/trunk/include/lldb/Target/Platform.h Thu Feb 13 17:11:45 2014
@@ -856,10 +856,7 @@ namespace lldb_private {
/// A list of symbol names. The list may be empty.
//------------------------------------------------------------------
virtual const std::vector<ConstString> &
- GetTrapHandlerSymbolNames ()
- {
- return m_trap_handlers;
- }
+ GetTrapHandlerSymbolNames ();
protected:
bool m_is_host;
@@ -894,6 +891,23 @@ namespace lldb_private {
bool m_ignores_remote_hostname;
std::string m_local_cache_directory;
std::vector<ConstString> m_trap_handlers;
+ bool m_calculated_trap_handlers;
+
+ //------------------------------------------------------------------
+ /// Ask the Platform subclass to fill in the list of trap handler names
+ ///
+ /// For most Unix user process environments, this will be a single
+ /// function name, _sigtramp. More specialized environments may have
+ /// additional handler names. The unwinder code needs to know when a
+ /// trap handler is on the stack because the unwind rules for the frame
+ /// that caused the trap are different.
+ ///
+ /// The base class Platform ivar m_trap_handlers should be updated by
+ /// the Platform subclass when this method is called. If there are no
+ /// predefined trap handlers, this method may be a no-op.
+ //------------------------------------------------------------------
+ virtual void
+ CalculateTrapHandlerSymbolNames () = 0;
const char *
GetCachedUserName (uint32_t uid)
Modified: lldb/trunk/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp?rev=201364&r1=201363&r2=201364&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp Thu Feb 13 17:11:45 2014
@@ -145,7 +145,6 @@ PlatformFreeBSD::PlatformFreeBSD (bool i
Platform(is_host),
m_remote_platform_sp()
{
- m_trap_handlers.push_back (ConstString ("_sigtramp"));
}
//------------------------------------------------------------------
@@ -676,3 +675,9 @@ PlatformFreeBSD::GetStatus (Stream &strm
Platform::GetStatus(strm);
}
+
+void
+PlatformFreeBSD::CalculateTrapHandlerSymbolNames ()
+{
+ m_trap_handlers.push_back (ConstString ("_sigtramp"));
+}
Modified: lldb/trunk/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.h?rev=201364&r1=201363&r2=201364&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.h (original)
+++ lldb/trunk/source/Plugins/Platform/FreeBSD/PlatformFreeBSD.h Thu Feb 13 17:11:45 2014
@@ -160,6 +160,9 @@ public:
virtual void
GetStatus (lldb_private::Stream &strm);
+ virtual void
+ CalculateTrapHandlerSymbolNames ();
+
protected:
lldb::PlatformSP m_remote_platform_sp; // Allow multiple ways to connect to a remote freebsd OS
Modified: lldb/trunk/source/Plugins/Platform/Linux/PlatformLinux.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/Linux/PlatformLinux.cpp?rev=201364&r1=201363&r2=201364&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/Linux/PlatformLinux.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/Linux/PlatformLinux.cpp Thu Feb 13 17:11:45 2014
@@ -307,7 +307,6 @@ PlatformLinux::PlatformLinux (bool is_ho
Platform(is_host), // This is the local host platform
m_remote_platform_sp ()
{
- m_trap_handlers.push_back (ConstString ("_sigtramp"));
}
//------------------------------------------------------------------
@@ -481,3 +480,9 @@ PlatformLinux::Attach(ProcessAttachInfo
}
return process_sp;
}
+
+void
+PlatformLinux::CalculateTrapHandlerSymbolNames ()
+{
+ m_trap_handlers.push_back (ConstString ("_sigtramp"));
+}
Modified: lldb/trunk/source/Plugins/Platform/Linux/PlatformLinux.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/Linux/PlatformLinux.h?rev=201364&r1=201363&r2=201364&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/Linux/PlatformLinux.h (original)
+++ lldb/trunk/source/Plugins/Platform/Linux/PlatformLinux.h Thu Feb 13 17:11:45 2014
@@ -100,6 +100,9 @@ namespace lldb_private {
return false;
}
+ virtual void
+ CalculateTrapHandlerSymbolNames ();
+
protected:
lldb::PlatformSP m_remote_platform_sp; // Allow multiple ways to connect to a remote darwin OS
Modified: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp?rev=201364&r1=201363&r2=201364&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.cpp Thu Feb 13 17:11:45 2014
@@ -40,7 +40,6 @@ PlatformDarwin::PlatformDarwin (bool is_
PlatformPOSIX(is_host), // This is the local host platform
m_developer_directory ()
{
- m_trap_handlers.push_back (ConstString ("_sigtramp"));
}
//------------------------------------------------------------------
@@ -1344,3 +1343,9 @@ PlatformDarwin::GetResumeCountForLaunchI
else
return 1;
}
+
+void
+PlatformDarwin::CalculateTrapHandlerSymbolNames ()
+{
+ m_trap_handlers.push_back (ConstString ("_sigtramp"));
+}
Modified: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.h?rev=201364&r1=201363&r2=201364&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.h (original)
+++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwin.h Thu Feb 13 17:11:45 2014
@@ -127,6 +127,9 @@ public:
virtual int32_t
GetResumeCountForLaunchInfo (lldb_private::ProcessLaunchInfo &launch_info);
+ virtual void
+ CalculateTrapHandlerSymbolNames ();
+
protected:
void
Modified: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp?rev=201364&r1=201363&r2=201364&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.cpp Thu Feb 13 17:11:45 2014
@@ -257,8 +257,6 @@ PlatformDarwinKernel::PlatformDarwinKern
{
SearchForKexts ();
}
- m_trap_handlers.push_back(ConstString ("trap_from_kernel"));
- m_trap_handlers.push_back(ConstString ("hndl_double_fault"));
}
//------------------------------------------------------------------
@@ -658,6 +656,13 @@ PlatformDarwinKernel::GetSupportedArchit
#endif
}
+void
+PlatformDarwinKernel::CalculateTrapHandlerSymbolNames ()
+{
+ m_trap_handlers.push_back(ConstString ("trap_from_kernel"));
+ m_trap_handlers.push_back(ConstString ("hndl_double_fault"));
+}
+
#else // __APPLE__
// Since DynamicLoaderDarwinKernel is compiled in for all systems, and relies on
@@ -675,5 +680,4 @@ PlatformDarwinKernel::GetPluginNameStati
return g_name;
}
-
#endif // __APPLE__
Modified: lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.h?rev=201364&r1=201363&r2=201364&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.h (original)
+++ lldb/trunk/source/Plugins/Platform/MacOSX/PlatformDarwinKernel.h Thu Feb 13 17:11:45 2014
@@ -161,6 +161,9 @@ protected:
lldb_private::Error
ExamineKextForMatchingUUID (const lldb_private::FileSpec &kext_bundle_path, const lldb_private::UUID &uuid, const lldb_private::ArchSpec &arch, lldb::ModuleSP &exe_module_sp);
+ virtual void
+ CalculateTrapHandlerSymbolNames ();
+
private:
BundleIDToKextMap m_name_to_kext_path_map;
Modified: lldb/trunk/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp?rev=201364&r1=201363&r2=201364&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp Thu Feb 13 17:11:45 2014
@@ -32,7 +32,6 @@ PlatformPOSIX::PlatformPOSIX (bool is_ho
Platform(is_host), // This is the local host platform
m_remote_platform_sp ()
{
- m_trap_handlers.push_back (ConstString ("_sigtramp"));
}
//------------------------------------------------------------------
@@ -590,3 +589,8 @@ PlatformPOSIX::SetRemoteWorkingDirectory
return Platform::SetRemoteWorkingDirectory(path);
}
+void
+PlatformPOSIX::CalculateTrapHandlerSymbolNames ()
+{
+ m_trap_handlers.push_back (ConstString ("_sigtramp"));
+}
Modified: lldb/trunk/source/Plugins/Platform/POSIX/PlatformPOSIX.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/POSIX/PlatformPOSIX.h?rev=201364&r1=201363&r2=201364&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/POSIX/PlatformPOSIX.h (original)
+++ lldb/trunk/source/Plugins/Platform/POSIX/PlatformPOSIX.h Thu Feb 13 17:11:45 2014
@@ -111,6 +111,9 @@ public:
uint64_t &low,
uint64_t &high);
+ virtual void
+ CalculateTrapHandlerSymbolNames ();
+
protected:
std::unique_ptr<lldb_private::OptionGroupOptions> m_options;
Modified: lldb/trunk/source/Plugins/Platform/Windows/PlatformWindows.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/Windows/PlatformWindows.h?rev=201364&r1=201363&r2=201364&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/Windows/PlatformWindows.h (original)
+++ lldb/trunk/source/Plugins/Platform/Windows/PlatformWindows.h Thu Feb 13 17:11:45 2014
@@ -148,6 +148,12 @@ public:
return false;
}
+ // FIXME not sure what the _sigtramp equivalent would be on this platform
+ virtual void
+ CalculateTrapHandlerSymbolNames ()
+ {
+ }
+
protected:
lldb::PlatformSP m_remote_platform_sp;
Modified: lldb/trunk/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp?rev=201364&r1=201363&r2=201364&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp (original)
+++ lldb/trunk/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp Thu Feb 13 17:11:45 2014
@@ -135,7 +135,6 @@ PlatformRemoteGDBServer::PlatformRemoteG
Platform(false), // This is a remote platform
m_gdb_client(true)
{
- m_trap_handlers.push_back (ConstString ("_sigtramp"));
}
//------------------------------------------------------------------
@@ -702,3 +701,9 @@ PlatformRemoteGDBServer::RunShellCommand
{
return m_gdb_client.RunShellCommand (command, working_dir, status_ptr, signo_ptr, command_output, timeout_sec);
}
+
+void
+PlatformRemoteGDBServer::CalculateTrapHandlerSymbolNames ()
+{
+ m_trap_handlers.push_back (ConstString ("_sigtramp"));
+}
Modified: lldb/trunk/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h?rev=201364&r1=201363&r2=201364&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h (original)
+++ lldb/trunk/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h Thu Feb 13 17:11:45 2014
@@ -209,6 +209,9 @@ public:
std::string *command_output, // Pass NULL if you don't want the command output
uint32_t timeout_sec); // Timeout in seconds to wait for shell program to finish
+ virtual void
+ CalculateTrapHandlerSymbolNames ();
+
protected:
GDBRemoteCommunicationClient m_gdb_client;
std::string m_platform_description; // After we connect we can get a more complete description of what we are connected to
Modified: lldb/trunk/source/Target/Platform.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Target/Platform.cpp?rev=201364&r1=201363&r2=201364&view=diff
==============================================================================
--- lldb/trunk/source/Target/Platform.cpp (original)
+++ lldb/trunk/source/Target/Platform.cpp Thu Feb 13 17:11:45 2014
@@ -256,7 +256,8 @@ Platform::Platform (bool is_host) :
m_supports_ssh (false),
m_ssh_opts (),
m_ignores_remote_hostname (false),
- m_trap_handlers()
+ m_trap_handlers(),
+ m_calculated_trap_handlers (false)
{
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_OBJECT));
if (log)
@@ -1391,3 +1392,15 @@ Platform::GetEnvironment (StringList &en
environment.Clear();
return false;
}
+
+const std::vector<ConstString> &
+Platform::GetTrapHandlerSymbolNames ()
+{
+ if (!m_calculated_trap_handlers)
+ {
+ CalculateTrapHandlerSymbolNames();
+ m_calculated_trap_handlers = true;
+ }
+ return m_trap_handlers;
+}
+
More information about the lldb-commits
mailing list