[Lldb-commits] [PATCH] D62948: lit/Register: Avoid stdio in register write tests

Jim Ingham via lldb-commits lldb-commits at lists.llvm.org
Tue Jun 18 16:05:38 PDT 2019



> On Jun 7, 2019, at 2:47 AM, Pavel Labath via Phabricator via lldb-commits <lldb-commits at lists.llvm.org> wrote:
> 
> labath planned changes to this revision.
> labath added a comment.
> 
> It looks like this problem is more widespread than we originally thought (a bunch of other tests are affected too). I'll need to think whether we can come up with a more general solution.
> 
> In D62948#1533088 <https://reviews.llvm.org/D62948#1533088>, @jgorbe wrote:
> 
>> About %T not working for "process launch", what about something like `RUN: %lldb -b --one-line-before-file "process launch --stdout %T/x86-zmm-write.out" -s %s %t` and then FileCheck-ing?
> 
> 
> There are two issues with that. The first one is that with --one-line, lldb stops processing commands after hitting the int3 instruction. I think this is related to the fact that lldb aborts the script if the inferior crashes, and it considers an unexpected int3 instruction to be a "crash". However, it's not clear to me why should the behavior depend on whether the command is in the script or on the command line, so this may be a bug actually.

You are running lldb with the -b option.  The -b option tells lldb to exit after all commands are read UNLESS the process crashes.  An unexplained int3 (i.e. not one of our breakpoints) is considered a crash and lldb should return control to the user in that case.  All the commands from the -o and -s options get glommed together in order and then run through, so it shouldn't matter which of those you specified the launch for.  Note, however, that you are putting the process launch in the -O not the -o option, which seems odd to me.

When I try something like that in lldb on the command-line:

> lldb --one-line-before-file "process launch /bin/ls" /bin/ls
(lldb) process launch /bin/ls
error: invalid target, create a target using the 'target create' command
(lldb) target create "/bin/ls"
Current executable set to '/bin/ls' (x86_64).

Which makes sense, you told lldb to launch a process before creating a target for it from the filename argument you also passed to lldb.  So lldb could either 

(a) make a target up on the fly, make /bin/ls the executable and launch using that target.
     Note that if we did this, then the file specified by the %t would create a SECOND target - which would be the selected one - and which would not be the one that is running
(b) give an error because you were trying to launch a process w/o having made a target first.

Neither of these seem to me  something you want to do.

You seem to be seeing different behavior from this, however, so I'm not sure why b isn't behaving as expected.

Jim

> 
> The second one is that putting complex commands on the command line creates a bit of a quoting nightmare, as the command is quote-processed both by the shell and by lldb. And shells (particularly windows ones) differ in how they handle that. If %T doesn't contain any funny characters, then everything is fine (and I expect a lot of our tests would fail if it did, so we kind of already assume that). However, I am reluctant to recommend that as the best practice for handling these kinds of things.
> 
> 
> CHANGES SINCE LAST ACTION
>  https://reviews.llvm.org/D62948/new/
> 
> https://reviews.llvm.org/D62948
> 
> 
> 
> _______________________________________________
> lldb-commits mailing list
> lldb-commits at lists.llvm.org
> https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits



More information about the lldb-commits mailing list