This is an archive of the discontinued LLVM Phabricator instance.

Add -p and -r options to lldb-mi command -file-exec-file-and-symbols to support iOS debugging on macOS
ClosedPublic

Authored by ChuckR on Mar 10 2015, 10:26 AM.

Details

Diff Detail

Event Timeline

ChuckR updated this revision to Diff 21599.Mar 10 2015, 10:26 AM
ChuckR retitled this revision from to Add -p and -r options to lldb-mi command -file-exec-file-and-symbols to support iOS debugging on macOS.
ChuckR updated this object.
ChuckR edited the test plan for this revision. (Show Details)
ChuckR added a reviewer: abidh.
ChuckR added a subscriber: Unknown Object (MLST).
clayborg requested changes to this revision.Mar 10 2015, 11:06 AM
clayborg added a reviewer: clayborg.
clayborg added a subscriber: clayborg.

Looks good except the launch code. See my inlined comment. BTW: to make inline comments in the code, you click and drag in the line numbers column and let go and then you can comment on specific bits of code.

tools/lldb-mi/MICmdCmdExec.cpp
96–110 ↗(On Diff #21599)

You shouldn't have to do this, you should be able to leave the code like it was before.

This revision now requires changes to proceed.Mar 10 2015, 11:06 AM

I didn't see these options in doc: https://sourceware.org/gdb/onlinedocs/gdb/GDB_002fMI-File-Commands.html. Is it well-known options?

I use the the following code instead of this:

-interpreter-exec console "platform select remote-ios --sysroot \"/Users/IliaK/Library/Developer/Xcode/iOS DeviceSupport/8.1.2 (12B440)\" --build 12B440 --version 8.1.2"
-interpreter-exec console "target create --arch arm64 \"~/Project1.app\""

See my remarks below.

tools/lldb-mi/MICmdCmdFile.cpp
88

Why not eArgValType_StringQuotedNumberPath?

113

Without args is better.

144–153

looks like a hack.

abidh edited edge metadata.Mar 11 2015, 3:31 AM

I personally don't like using "-interpreter-exec" when there are proper MI commands available to do the job. But if start adding option/commands in lldb-mi for every options available in lldb proper then it will also get a little messy. Would it work for you to use "-interpreter-exec" as Ilia suggested above?

In D8210#138690, @abidh wrote:

I personally don't like using "-interpreter-exec" when there are proper MI commands available to do the job. But if start adding option/commands in lldb-mi for every options available in lldb proper then it will also get a little messy. Would it work for you to use "-interpreter-exec" as Ilia suggested above?

I don't insist on it if these options are well-known. As I said I don't see them in description of -file-exec-and-symbols command.

abidh added a comment.Mar 11 2015, 4:37 AM
In D8210#138690, @abidh wrote:

I personally don't like using "-interpreter-exec" when there are proper MI commands available to do the job. But if start adding option/commands in lldb-mi for every options available in lldb proper then it will also get a little messy. Would it work for you to use "-interpreter-exec" as Ilia suggested above?

I don't insist on it if these options are well-known. As I said I don't see them in description of -file-exec-and-symbols command.

These options are not standard MI options. ChuckR is probably trying to add in lldb-mi what he see in "Target Create" command in lldb.

In D8210#138716, @abidh wrote:
In D8210#138690, @abidh wrote:

I personally don't like using "-interpreter-exec" when there are proper MI commands available to do the job. But if start adding option/commands in lldb-mi for every options available in lldb proper then it will also get a little messy. Would it work for you to use "-interpreter-exec" as Ilia suggested above?

I don't insist on it if these options are well-known. As I said I don't see them in description of -file-exec-and-symbols command.

These options are not standard MI options. ChuckR is probably trying to add in lldb-mi what he see in "Target Create" command in lldb.

Then I dislike this patch. I'm not sure that we should add custom options. Is there another way to do it?

I'm not responsible for the MI code or its uses, so this is only a slight opinion:

It seems to me if a client has to call "interpreter-exec" with lldb-specific commands, you are already adding lldb specific options to the MI interface, just in a messy way. It would be cleaner to have some way to ask if the MI flavor is lldb, and then just add in the lldb options in an MI-pretty way. Of course, if you did it this way you should also document the extensions.

Jim

In D8210#138716, @abidh wrote:
In D8210#138690, @abidh wrote:

I personally don't like using "-interpreter-exec" when there are proper MI commands available to do the job. But if start adding option/commands in lldb-mi for every options available in lldb proper then it will also get a little messy. Would it work for you to use "-interpreter-exec" as Ilia suggested above?

I don't insist on it if these options are well-known. As I said I don't see them in description of -file-exec-and-symbols command.

These options are not standard MI options. ChuckR is probably trying to add in lldb-mi what he see in "Target Create" command in lldb.

Then I dislike this patch. I'm not sure that we should add custom options. Is there another way to do it?

I could not find another way to do this. I agree with jignham that if the answer is to use interpret-exec, then there is a gap in the MI options. interpret-exec- output is harder to parse and is means the consumer of lldb-mi must add additional logic. While these are not officially documented flags in the gdb-mi docs, I do not think that should stop us from adding to lldb-mi where needed. I am happy to talk about a more organized way to add this ability, but simply saying this isn't in the gdb docs so we can't do it doesn't seem like a good answer.

In D8210#138716, @abidh wrote:
In D8210#138690, @abidh wrote:

I personally don't like using "-interpreter-exec" when there are proper MI commands available to do the job. But if start adding option/commands in lldb-mi for every options available in lldb proper then it will also get a little messy. Would it work for you to use "-interpreter-exec" as Ilia suggested above?

I don't insist on it if these options are well-known. As I said I don't see them in description of -file-exec-and-symbols command.

These options are not standard MI options. ChuckR is probably trying to add in lldb-mi what he see in "Target Create" command in lldb.

Then I dislike this patch. I'm not sure that we should add custom options. Is there another way to do it?

I could not find another way to do this. I agree with jignham that if the answer is to use interpret-exec, then there is a gap in the MI options. interpret-exec- output is harder to parse and is means the consumer of lldb-mi must add additional logic. While these are not officially documented flags in the gdb-mi docs, I do not think that should stop us from adding to lldb-mi where needed. I am happy to talk about a more organized way to add this ability, but simply saying this isn't in the gdb docs so we can't do it doesn't seem like a good answer.

In D8210#138716, @abidh wrote:
In D8210#138690, @abidh wrote:

I personally don't like using "-interpreter-exec" when there are proper MI commands available to do the job. But if start adding option/commands in lldb-mi for every options available in lldb proper then it will also get a little messy. Would it work for you to use "-interpreter-exec" as Ilia suggested above?

I don't insist on it if these options are well-known. As I said I don't see them in description of -file-exec-and-symbols command.

These options are not standard MI options. ChuckR is probably trying to add in lldb-mi what he see in "Target Create" command in lldb.

Then I dislike this patch. I'm not sure that we should add custom options. Is there another way to do it?

I could not find another way to do this. I agree with jignham that if the answer is to use interpret-exec, then there is a gap in the MI options. interpret-exec- output is harder to parse and is means the consumer of lldb-mi must add additional logic. While these are not officially documented flags in the gdb-mi docs, I do not think that should stop us from adding to lldb-mi where needed. I am happy to talk about a more organized way to add this ability, but simply saying this isn't in the gdb docs so we can't do it doesn't seem like a good answer.

I am all for adding new options if that make sense. But these options should be properly thought out as they get baked into the clients and then become difficult to change. So please address the comments by the other reviews and add a new text file in lldb-mi which documents these new options.

ChuckR updated this revision to Diff 21781.Mar 11 2015, 3:45 PM
ChuckR edited edge metadata.

Updated based on code review feedback. We confirmed that the interpret-exec command does not suit our needs, and have documented the flags that we have added to file-exec-and-symbols.

ki.stfu requested changes to this revision.Mar 11 2015, 9:19 PM
ki.stfu added a reviewer: ki.stfu.

If be honest I'd prefer to add this comment into tools/lldb-mi/MICmdCmdFile.h. In that case everyone who are interesting in "-file-exec-and-symbols" will see that it has non-standard options.

There are 2 small fixes (see below):

tools/lldb-mi/MICmdCmdFile.h
72

A little fix:

const CMIUtilString m_constStrArgNamedPlatformName; // Added to support iOS platform selection
73

A little fix:

const CMIUtilString m_constStrArgNamedRemotePath; // Added to support iOS device remote file location
This revision now requires changes to proceed.Mar 11 2015, 9:19 PM
abidh added a comment.Mar 12 2015, 3:55 AM

If be honest I'd prefer to add this comment into tools/lldb-mi/MICmdCmdFile.h. In that case everyone who are interesting in "-file-exec-and-symbols" will see that it has non-standard options.

There are 2 small fixes (see below):

We may have more extensions in future so it would be good to have one place where all are documented. Your point is valid too. So I think we should add a comment in MICmdCmdFile.h that this command has some new options. Please see the MIExtensions.txt for details.

clayborg accepted this revision.Mar 12 2015, 9:36 AM
clayborg edited edge metadata.

Looks good lldb::SB API interaction perspective, I will let others decide the MI implications.

ChuckR updated this revision to Diff 21847.Mar 12 2015, 10:22 AM
ChuckR edited edge metadata.

Added comment on FileExecAndSymbols to see MIExtensions.txt. Fixed capitalization in comments.

ki.stfu accepted this revision.Mar 12 2015, 10:27 AM
ki.stfu edited edge metadata.
This revision is now accepted and ready to land.Mar 12 2015, 10:27 AM
abidh accepted this revision.Mar 12 2015, 10:46 AM
abidh edited edge metadata.

This patch adds some extra empty lines, please remove them. Also handle one inline comment and then feel free to commit.

tools/lldb-mi/MIExtensions.txt
11

I think remove the contents from "if breakpoints are set" onward (last 2 lines) as those lines are not making sense when you have not described that you can give this command without file. Also the purpose is to document the extension.

I am still new to this and I cannot commit directly. Should I submit a new patch with these minor changes, or will somebody with commit access make them and submit on my behalf?

I am still new to this and I cannot commit directly. Should I submit a new patch with these minor changes, or will somebody with commit access make them and submit on my behalf?

I will commit it for you after making those few changes.

In D8210#140012, @abidh wrote:

I am still new to this and I cannot commit directly. Should I submit a new patch with these minor changes, or will somebody with commit access make them and submit on my behalf?

I will commit it for you after making those few changes.

Thanks!

abidh closed this revision.Mar 12 2015, 11:38 AM

Committed in 232077.