简体   繁体   English

lldb 相当于 gdb 的启动命令之一是什么?

[英]What is lldb's equivalent one of gdb's start command?

I heavily used gdb before, and now give lldb a shot.我以前大量使用gdb ,现在lldb I like gdb 'sstart command very much, but I can't find the equivalent one from lldb 's manual .我非常喜欢gdbstart命令,但我无法从lldb手册中找到等效的命令。 Now I can only use " b main " followed by run compound instead.现在我只能使用“ b main ”后跟run复合。 So just curious whether there is an equivalent one in lldb ?所以只是好奇在lldb是否有一个等效的? Or I can only use the compound of " b main " and run commands as a work-around.或者我只能使用“ b main ”的复合并run命令作为解决方法。

You are correct, lldb doesn't have a dedicated start command.你是对的,lldb 没有专门的start命令。 The stated motivation for that command is that gdb supports lots of runtimes that don't use a "main" symbol where determining where the first user code is not trivial, so it figures that out for you.该命令的声明动机是,gdb 支持许多不使用“主要”符号的运行时,以确定第一个用户代码的位置并非微不足道,因此它会为您解决这个问题。 We haven't had a need for that in lldb yet.我们还没有在 lldb 中需要它。

If you always use start to run programs in gdb, then you can just set a breakpoint on main in your ~/.lldbinit file.如果你总是使用start在 gdb 中运行程序,那么你可以在~/.lldbinit文件中的 main 上设置一个断点。 That will get copied to any new targets that get made in your lldb session, and run will behave exactly like start (for runtimes that use a main symbol).这将被复制到在 lldb 会话中创建的任何新目标,并且run行为将与start完全一样(对于使用主符号的运行时)。

If it's something you would use a lot but not always, you could make your own version fairly easily using the python extension point in the command interpreter:如果您经常使用它但并非总是如此,您可以使用命令解释器中的 python 扩展点轻松制作自己的版本:

https://lldb.llvm.org/use/python-reference.html#create-a-new-lldb-command-using-a-python-function https://lldb.llvm.org/use/python-reference.html#create-a-new-lldb-command-using-a-python-function

Also, feel free to file an Enhancement Request with http://bugs.llvm.org .此外,请随时向http://bugs.llvm.org提交增强请求。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM