[lldb-dev] Problems selecting correct Platform

Ted Woodward ted.woodward at codeaurora.org
Thu Mar 19 12:15:06 PDT 2015

I've got a Hexagon platform, that launches the Hexagon simulator and is used
for standalone development. Now I'm working on supporting Hexagon Linux, but
it's not choosing the Linux platform, instead it's choosing the Hexagon

I want LLDB to use the Hexagon Platform if my executable's triple is
"hexagon-unknown-elf" (which is really hexagon-unknown-unknown) and use the
Linux platform if my executable's triple is "hexagon-unknown-linux".

First problem:
"target create" doesn't search platforms for one matching the executable's
triple. It used to, but when TargetList::CreateTarget was switched to call
CreateTargetInternal, "target create" was changed to call the method that
takes an ArchSpec instead of a triple. This method doesn't search for a
compatible Platform, but instead chooses the current Platform.

Is this intended behavior?

Second problem:
I change DoExecute() in CommandObjectTarget.cpp to call the ArchSpec version
if the ArchSpec is valid, and the triple version if it is not. This has LLDB
going through platforms to find a match, but there's another problem when it
gets to PlatformLinux. PlatformLinux::GetSupportedArchitectureAtIndex() will
only return host architectures. So in my case, running on Windows, it
returns x86_64-pc-windows-msvc or i386-pc-windows-msvc. Neither is a match
for Linux.

Shouldn't the Linux platform match anything with a triple *-*-linux? Or does
the platform not matter if I'm just going to use gdb-remote to connect to
gdbserver or LLGS on a remote Hexagon Linux board?

Qualcomm Innovation Center, Inc.
The Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, a
Linux Foundation Collaborative Project

More information about the lldb-dev mailing list