gpt4 book ai didi

bash - Readline 应用名称

转载 作者:行者123 更新时间:2023-11-29 09:23:39 27 4
gpt4 key购买 nike

Readline 手册描述了可用的条件结构 here .特别是,手册说

The application construct is used to include application-specific settings. Each program using the Readline library sets the application name, and you can test for a particular value. This could be used to bind key sequences to functions useful for a specific program. For instance, the following command adds a key sequence that quotes the current or previous word in Bash:

$if Bash

# Quote the current or previous word "\C-xq": "\eb\"\ef\""

$endif

给定一个使用 readline 库的应用程序,您如何找出它为“应用程序名称”设置的值?

最佳答案

理想的解决方案是阅读应用程序的文档,这无疑会在有关 readline 的部分告诉您。 (是的,那是个玩笑。)

这是一种可能有效的技术:

带有调试符号的应用程序的成绩单:


$ <b>gdb the_application</b>
...
Reading symbols from /usr/local/bin/the_application...done.
(gdb) <b>b rl_initialize</b>
Breakpoint 1 at 0x496180: file readline.c, line 1050.
(gdb) <b>r</b>
Starting program: /usr/local/bin/the_application

Breakpoint 1, rl_initialize () at readline.c:1050
1050 {
(gdb) <b>p rl_readline_name</b>
$1 = 0x4d1fbb "TheApplication"

更可能是应用程序没有调试符号的抄本:


$ <b>gdb the_application</b>
...
Reading symbols from /bin/bash...(no debugging symbols found)...done.
(gdb) <b>break rl_initialize</b>
Breakpoint 1 at 0x48df40
(gdb) <b>r</b>
Starting program: /usr/bin/local/the_application

Breakpoint 1, 0x000000000048df40 in rl_initialize ()
(gdb) <b>p (char*)rl_readline_name</b>
$1 = 0x4b0bcb "TheApplication"

关于bash - Readline 应用名称,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27181517/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com