user12050586
user12050586

Reputation:

Getting statuses after gdb finishes

When GDB finishes, I get the following output:

─── Output/messages ─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
[Inferior 1 (process 18473) exited with code 05]

Upvotes: 2

Views: 50

Answers (1)

Employed Russian
Employed Russian

Reputation: 213486

Is there a way to capture the exit code in the prompt, 5, after gdb has finished?

In GDB, you could use $_exitcode convenience variable.

Does 18473 refer to the thread ID, the (unix) process ID, or something else?

The UNIX process ID.

Finally, why it is called an "inferior" process?

That's just what GDB developers call it. It the same as "the process GDB is debugging" (as opposed to the GDB process itself), and is much shorter. It's also "inferior" to GDB in the sense that GDB is controlling it (making it stop, single-step, or run as GDB desires).

Upvotes: 1

Related Questions