[Lldb-commits] [lldb] r274725 - debugserver will now report the minimum version load command

Tamas Berghammer via lldb-commits lldb-commits at lists.llvm.org
Thu Jul 7 03:47:51 PDT 2016


Hi Jason,

This CL caused a build failure on our OSX build bot:
http://lab.llvm.org:8011/builders/lldb-x86_64-darwin-13.4/builds/11405/steps/ninja%20build%20local/logs/stdio

I committed in a possible fix at http://reviews.llvm.org/rL274743 but
please take a look as I don't know too much about this code so my fix might
be wrong.

Thanks,
Tamas

On Thu, Jul 7, 2016 at 4:19 AM Jason Molenda via lldb-commits <
lldb-commits at lists.llvm.org> wrote:

> Author: jmolenda
> Date: Wed Jul  6 22:12:01 2016
> New Revision: 274725
>
> URL: http://llvm.org/viewvc/llvm-project?rev=274725&view=rev
> Log:
> debugserver will now report the minimum version load command
> os name and version # from the mach-o binary as it scans the
> header/load commands from memory and sends the details back
> in the jGetLoadedDynamicLibrariesInfos response.  lldb isn't
> using these fields yet but I have a suspicion I'm going to
> need them soon.
>
> <rdar://problem/25251243>
>
> Modified:
>     lldb/trunk/tools/debugserver/source/MacOSX/MachProcess.h
>     lldb/trunk/tools/debugserver/source/MacOSX/MachProcess.mm
>
> Modified: lldb/trunk/tools/debugserver/source/MacOSX/MachProcess.h
> URL:
> http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/MacOSX/MachProcess.h?rev=274725&r1=274724&r2=274725&view=diff
>
> ==============================================================================
> --- lldb/trunk/tools/debugserver/source/MacOSX/MachProcess.h (original)
> +++ lldb/trunk/tools/debugserver/source/MacOSX/MachProcess.h Wed Jul  6
> 22:12:01 2016
> @@ -69,6 +69,8 @@ public:
>          struct mach_header_64 mach_header;
>          std::vector<struct mach_o_segment> segments;
>          uuid_t uuid;
> +        std::string min_version_os_name;
> +        std::string min_version_os_version;
>      };
>
>      struct binary_image_information
>
> Modified: lldb/trunk/tools/debugserver/source/MacOSX/MachProcess.mm
> URL:
> http://llvm.org/viewvc/llvm-project/lldb/trunk/tools/debugserver/source/MacOSX/MachProcess.mm?rev=274725&r1=274724&r2=274725&view=diff
>
> ==============================================================================
> --- lldb/trunk/tools/debugserver/source/MacOSX/MachProcess.mm (original)
> +++ lldb/trunk/tools/debugserver/source/MacOSX/MachProcess.mm Wed Jul  6
> 22:12:01 2016
> @@ -631,6 +631,44 @@ MachProcess::GetMachOInformationFromMemo
>              if (ReadMemory (load_cmds_p, sizeof (struct uuid_command),
> &uuidcmd) == sizeof (struct uuid_command))
>                  uuid_copy (inf.uuid, uuidcmd.uuid);
>          }
> +        if (lc.cmd == LC_VERSION_MIN_IPHONEOS || lc.cmd ==
> LC_VERSION_MIN_MACOSX
> +            || lc.cmd == LC_VERSION_MIN_WATCHOS || lc.cmd ==
> LC_VERSION_MIN_TVOS)
> +        {
> +            struct version_min_command vers_cmd;
> +            if (ReadMemory (load_cmds_p, sizeof (struct
> version_min_command), &vers_cmd) != sizeof (struct version_min_command))
> +            {
> +                return false;
> +            }
> +            switch (lc.cmd)
> +            {
> +                case LC_VERSION_MIN_IPHONEOS:
> +                    inf.min_version_os_name = "iphoneos";
> +                    break;
> +                case LC_VERSION_MIN_MACOSX:
> +                    inf.min_version_os_name = "macosx";
> +                    break;
> +                case LC_VERSION_MIN_TVOS:
> +                    inf.min_version_os_name = "tvos";
> +                    break;
> +                case LC_VERSION_MIN_WATCHOS:
> +                    inf.min_version_os_name = "watchos";
> +                    break;
> +                default:
> +                    return false;
> +            }
> +            uint32_t xxxx = vers_cmd.sdk >> 16;
> +            uint32_t yy = (vers_cmd.sdk >> 8) & 0xffu;
> +            uint32_t zz = vers_cmd.sdk & 0xffu;
> +            inf.min_version_os_version = "";
> +            inf.min_version_os_version += std::to_string(xxxx);
> +            inf.min_version_os_version += ".";
> +            inf.min_version_os_version += std::to_string(yy);
> +            if (zz != 0)
> +            {
> +                inf.min_version_os_version += ".";
> +                inf.min_version_os_version += std::to_string(zz);
> +            }
> +        }
>          load_cmds_p += lc.cmdsize;
>      }
>      return true;
> @@ -657,6 +695,13 @@ MachProcess::FormatDynamicLibrariesIntoJ
>          uuid_unparse_upper (image_infos[i].macho_info.uuid, uuidstr);
>          image_info_dict_sp->AddStringItem ("uuid", uuidstr);
>
> +        if (image_infos[i].macho_info.min_version_os_name.empty() == false
> +            && image_infos[i].macho_info.min_version_os_version.empty()
> == false)
> +        {
> +            image_info_dict_sp->AddStringItem ("min_version_os_name",
> image_infos[i].macho_info.min_version_os_name);
> +            image_info_dict_sp->AddStringItem ("min_version_os_sdk",
> image_infos[i].macho_info.min_version_os_version);
> +        }
> +
>          JSONGenerator::DictionarySP mach_header_dict_sp (new
> JSONGenerator::Dictionary());
>          mach_header_dict_sp->AddIntegerItem ("magic",
> image_infos[i].macho_info.mach_header.magic);
>          mach_header_dict_sp->AddIntegerItem ("cputype", (uint32_t)
> image_infos[i].macho_info.mach_header.cputype);
>
>
> _______________________________________________
> lldb-commits mailing list
> lldb-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20160707/84a53d4c/attachment-0001.html>


More information about the lldb-commits mailing list