Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to open a source file in GDB TUI

Tags:

gdb

When I'm GDB TUI can I load arbitrary source file for browsing without jumping into it using breakpoint?

Thanks.

like image 544
jackhab Avatar asked Jun 27 '13 11:06

jackhab


People also ask

What is TUI mode in GDB?

The GDB Text User Interface, TUI in short, is a terminal interface which uses the curses library to show the source file, the assembly output, the program registers and GDB commands in separate text windows. The TUI is enabled by invoking GDB using either `gdbtui' or `gdb -tui' .

How do I add a breakpoint in GDB?

Setting breakpoints A breakpoint is like a stop sign in your code -- whenever gdb gets to a breakpoint it halts execution of your program and allows you to examine it. To set breakpoints, type "break [filename]:[linenumber]". For example, if you wanted to set a breakpoint at line 55 of main.

What does P do in GDB?

The usual way to examine data in your program is with the print command (abbreviated p ), or its synonym inspect . It evaluates and prints the value of an expression of the language your program is written in (see section Using GDB with Different Languages).


1 Answers

You can't list any arbitrary file, but if it's part of your program, you can try something like

list sourcefile.c:1

That :1 at the end says to list from line number 1, and lets gdb know that it's file, not a function.

like image 59
dbrank0 Avatar answered Oct 07 '22 15:10

dbrank0