如何一次粘贴多个命令行?

huangapple go评论77阅读模式
英文:

How do I paste multiple command lines in one go?

问题

如何让GDB中的多行粘贴命令再次工作?

嗯,在GNU gdb(Ubuntu 8.1.1-0ubuntu1)8.1.1和GNU gdb(Ubuntu 12.1-0ubuntu1~22.04)12.1之间,复制/粘贴之间似乎发生了一些变化。// 编辑:这可能在GDB 9中发生了变化 // 感谢ks1322

不了解中间过程 - 我没有进行“升级”。

似乎在新版本上通过Windows Putty粘贴多行时,这些行被视为一个单独的块,然后需要按Enter键。在旧版本中,每一行都会立即处理。

命令行似乎会将这个块视为单独的命令,这是您所期望的。

但是GDB并不高兴,以某种方式将整个块视为单个命令。

我已经养成了使用本地编辑器构建简单的临时脚本的习惯,理想情况下,需要找到一种方法来恢复这种功能。有人找到解决方法吗?也许是在Windows/终端方面的一些设置?

我真的不想在Unix方面折腾编辑器、函数、.gdinit文件,当我可以直接在眼前看到我想要执行的三个命令!

调试的意义在于,2小时后任何多余的努力都是浪费的。

英文:

How can I get multi line pasting of commands working again in gdb?

Hmm something has changed with copy/paste between

GNU gdb (Ubuntu 8.1.1-0ubuntu1) 8.1.1

and // EDIT: It was probably changed in GDB 9 // thanks
ks1322

GNU gdb (Ubuntu 12.1-0ubuntu1~22.04) 12.1

No idea about intermediates - I didn't do the "upgrade".

It seems that when I paste multiple lines through windows putty on the newer release, the lines are treated as a single block, that then requires an enter. On older releases each line was processed immediately.

The command-line seems to treat the block as separate commands, as you would expect.

But gdb is not happy, treating the whole block as a single command in some way.

I have developed this habit of building simple ad-hoc scripts using a local editor, and ideally need a way to get this functionality back. Anyone found a fix? Perhaps something on the windows/terminal side?

I don't really want to mess around with editors, functions, .gdinit files, on the unix side, when I can just see the three commands I want to do right in front of me!

Sort-of the point of debugging is 2 hours later any excess effort is wasted.

答案1

得分: 4

ssbssa 正确,这是由 readline 更新引起的。

涉及的功能称为 bracketed-paste-mode。

要禁用它,我在我的 .inputrc 中添加了以下行:

set enable-bracketed-paste off

尽管这会关闭使用 readline 的所有使用该功能的东西,比如 bash,这可能不是你想要的。

如果你只想为 GDB 关闭这个功能,你可以:

$if Gdb
set enable-bracketed-paste off
$endif
英文:

ssbssa is correct that this was caused by a readline update.

The feature in question is called bracketed-paste-mode.

To disable this I added the following line to my .inputrc:

set enable-bracketed-paste off

though this is going to turn the feature off for everything that uses readline, e.g. bash, which might not be what you want.

If you want to turn the feature off just for GDB then you can:

$if Gdb
set enable-bracketed-paste off
$endif

huangapple
  • 本文由 发表于 2023年3月7日 21:11:21
  • 转载请务必保留本文链接:https://go.coder-hub.com/75662418.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定