简体   繁体   English

从shell脚本运行gdb命令

[英]Run gdb command from shell script

I was just wondering if it is possible to pass command to GDB from shell script. 我只是想知道是否可以从shell脚本向GDB传递命令。 I will just demonstrate it in code, so it is easier to understand. 我将在代码中演示它,因此更容易理解。

#!/bin/sh
gdb --silent Application.app
b -[Class method]

This causes the execution of the script to stop at line 2, and continue only when I quit GDB. 这导致脚本的执行在第2行停止,并且仅在我退出GDB时继续。
How would I pass the command, if it is even possible? 如果可能的话,我将如何通过命令? :) :)

gdb has an option to run the commands from a file with option --command=FILE . gdb有一个选项,可以使用选项--command=FILE从文件中运行命令。 You can write all the gdb commands inside that FILE . 您可以在该FILE编写所有gdb命令。

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

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