Page MenuHomePhabricator

Fix for remote-linux test fails: use currently selected platform on target launch
AbandonedPublic

Authored by omjavaid on Jul 12 2015, 9:16 PM.

Details

Summary

This patch fixes a bug which was causing test failures on remote targets.

LLDB was select default platform instead of currently select target platform due to which following use case ended up launching a local debug server instead of spawning a server on currently connect + select platform.
file a.out
target select remote-linux
target connect connect://hostname:5432
run

on issuing run command lldb will launch the target with old platform pointer select by default on creating Target with command file a.out.

This patch fixes this behavior by updating the sp_platform to currently selected platform making sure we launch debugserver on the right platform.

This should fix all remote tests that issues a command sequence following a file command.

Diff Detail

Event Timeline

omjavaid updated this revision to Diff 29528.Jul 12 2015, 9:16 PM
omjavaid retitled this revision from to Fix for remote-linux test fails: use currently selected platform on target launch.
omjavaid updated this object.
tberghammer edited edge metadata.Jul 13 2015, 4:13 AM

I agree that the current implementation is annoying with using the platform selected at target creation time, but changing the platform for a target after it is created might be dangerous because it can cache information from the platform.

target create a.out
breakpoint set -n printf
process launch
platform select remote-linux
platform connect ...
process launch # At this point I think the modules will be loaded and the breakpoints will be resolved to the wrong address

I don't know what is the best solution, but silently changing the platform of a target isn't sounds like the right approach

clayborg requested changes to this revision.Jul 13 2015, 10:46 AM
clayborg edited edge metadata.

The target should get the currently selected platform when the target is created as long as the architecture in the supplied executable is compatible with the currently selected platform. It the executable arch isn't compatible, a compatible platform will be auto selected. I don't believe this change is correct and probably should not be committed.

This revision now requires changes to proceed.Jul 13 2015, 10:46 AM

So you must select the platform first:

target select remote-linux
file a.out
target connect connect://hostname:5432
run
ted added a subscriber: ted.Jul 13 2015, 6:43 PM

I agree that the current implementation is annoying with using the platform selected at target creation time, but changing the platform for a target after it is created might be dangerous because it can cache information from the platform.

Platform select at target creation time is needed for non-native targets. If I load a standalone Hexagon executable while on Linux, the Platform needs to be switched to the Hexagon Simulator Platform. If I load a Hexagon Linux executable while on Windows, the Platform needs to be switched to the Linux platform.

The current logic should only switch Platforms to match the Target if the currently selected Platform isn't compatible.

omjavaid abandoned this revision.Oct 18 2016, 8:55 PM