This is an archive of the discontinued LLVM Phabricator instance.

[lldb][Docs] Add extra lldb aliases to gdb->lldb map
AbandonedPublic

Authored by kastiglione on Oct 24 2019, 10:25 PM.

Details

Summary

Adds a few more aliases to the lldb translations.

Event Timeline

kastiglione created this revision.Oct 24 2019, 10:25 PM
Herald added a project: Restricted Project. · View Herald TranscriptOct 24 2019, 10:25 PM

I think the reason why the gdb aliases aren't mentioned here is that intent was to train users in LLDB's more regular command syntax. That said, personally I wouldn't mind documenting them.

@jingham may have a stronger opinion on this :-)

Thanks. I thought this was reasonable since the documentation shows many uses of lldb aliases already.

intent was to train users in LLDB's more regular command syntax

lldb's aliases, especially the regex ones, are great. In my experience, people prefer aliases, they're quick to type and often easier to remember :) I think it's great that lldb has both regular syntax and aliases, people can pick what suits them.

kastiglione added a comment.EditedOct 25 2019, 9:32 AM

fwiw I have a python command called abbrev that takes a command and shows you the alias you can use instead.

(lldb) abbrev mem read -s 8 -c 10 -f x 0xfedcba00
x/10xg 0xfedcba00
(lldb) abbrev break set -f foo.c -l 123
b foo.c:23
(lldb) abbrev thread jump --by 3
j +3

I have no objection to documenting the aliases we have. Having the ability to define shortcuts for common operations was one of the key pieces that allowed the straight command set to be laid out in an orderly fashion, which I think is great for discoverability. It's really hard to do the latter and not have some commands be overly long to type. This gives us the best of both worlds.

I personally am a little less fond of the complex regex commands, particularly ones like "b" that become their own little DSL and now you have to try to decode it's operations from looking at the regex matcher to figure out what is actually going to happen. But I don't think I'm in the majority in that opinion.

It's a bit of a shame that our "list of aliases" is available as a gdb->lldb table. The table is actually arranged by task, so it serves as a pretty good task -> full & short-cut lldb commands, but you wouldn't think to use it for that purpose if you were not a gdb user. And it's a bit weird to have things in the table that don't have gdb equivalents. I wonder if it is time to take the gdb commands out and just make this a task -> lldb commands table?

But anyway, these changes are fine.

The abbrev script sounds cool. We have a bunch of useful Python examples in examples/Python, this sounds like a perfect candidate for that if you are free to contribute it. We should figure out a mechanism to test and package the appropriate ones of these utilities with lldb distributions, not everything in lldb has to be built in...

jingham accepted this revision.Oct 25 2019, 10:37 AM
This revision is now accepted and ready to land.Oct 25 2019, 10:37 AM

I wonder if it is time to take the gdb commands out and just make this a task -> lldb commands table?

+1 from me

The abbrev script sounds cool. We have a bunch of useful Python examples in examples/Python, this sounds like a perfect candidate for that if you are free to contribute it. We should figure out a mechanism to test and package the appropriate ones of these utilities with lldb distributions, not everything in lldb has to be built in...

Sounds interesting, and I yes can contribute it. I'll have a look at examples/Python and follow up.

kastiglione abandoned this revision.Feb 8 2021, 8:19 PM