Name

list

list function
list line-spec

List lines of source code, starting at the beginning of function function (first form), or centered around the line defined by line-spec (second form). Pressing the ENTER key repeats the last command; for list, this shows successive lines of source text. A line-spec can take one of the forms shown below.

Line Specifications

list number

List lines centered around line number.

list +offsetlist -offset

List lines centered around the line offset lines after (first form) or before (second form) the last line printed.

list file:line

List lines centered around line line in source file file.

list file:function

List lines centered around the opening brace of function function in source file file. This is necessary if there are multiple functions of the same name in different source files.

list *address

List lines centered around the line containing address, which can be an expression.

list first,last

List the lines from first to last, each of which may be any of the previous forms for a line-spec.

list first,

List lines starting with first.

list ,last

List lines ending with last.

list +list -

List the lines just after (first form) or just before (second form) the lines just printed.

Get GDB Pocket Reference now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.