Page MenuHomePhabricator

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

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

Details

Summary

Adds a few more aliases to the lldb translations.

Event Timeline

kastiglione created this revision.Thu, Oct 24, 10:25 PM
Herald added a project: Restricted Project. · View Herald TranscriptThu, Oct 24, 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.EditedFri, Oct 25, 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.Fri, Oct 25, 10:37 AM
This revision is now accepted and ready to land.Fri, Oct 25, 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.