Platform code should check for null

Platform*.ResolveExecutable has code like:

error = ModuleList::GetSharedModule (module_spec,
  exe_module_sp,
  module_search_paths_ptr,
  NULL,
  NULL);

if (exe_module_sp->GetObjectFile() == NULL)
{
   exe_module_sp.reset();
   error.SetErrorStringWithFormat ("'%s%s%s' doesn't contain the architecture %s",
   exe_file.GetDirectory().AsCString(""),
   exe_file.GetDirectory() ? "/" : "",
   exe_file.GetFilename().AsCString(""),
   exe_arch.GetArchitectureName());
}

However if for whatever reason the file doesn't load (corrupt, missing, plugin not compiled in? etc) exe_module_sp is null. IMO that check needs to check exe_module_sp too.

if (exe_module_sp == NULL || exe_module_sp->GetObjectFile() == NULL)

so it gives a nice error instead of a memory access error.

I fixed:

% svn commit source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp
Sending source/Plugins/Platform/FreeBSD/PlatformFreeBSD.cpp
Transmitting file data .
Committed revision 167471.

I didn't see any others besides the one in TargetList.cpp:

        if (error.Success() && exe_module_sp)
        {
            if (exe_module_sp->GetObjectFile() == NULL)
            {
                if (arch.IsValid())
                {
                    error.SetErrorStringWithFormat("\"%s%s%s\" doesn't contain architecture %s",
                                                   file.GetDirectory().AsCString(),
                                                   file.GetDirectory() ? "/" : "",
                                                   file.GetFilename().AsCString(),
                                                   arch.GetArchitectureName());
                }
                else
                {
                    error.SetErrorStringWithFormat("unsupported file type \"%s%s%s\"",
                                                   file.GetDirectory().AsCString(),
                                                   file.GetDirectory() ? "/" : "",
                                                   file.GetFilename().AsCString());
                }
                return error;
            }

This already checks the module.