GNU Flashcards

(26 cards)

1
Q

How to compile with gdb debugging symbols?

A

use -ggdb option with gcc; gcc -ggdb main.c -o main

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Find the source file?

A

Info sources

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

To look at global variables?

A

Info variables

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

To look at local variables?

A

Info scope function_name

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Extract DEBUG Symbols out of binary with DEBUG Symbols?

A

objcopy –only-keep-debug BIN_DEBUG DEBUG_Symbols

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Dump Print Symbols?

A

maint print symbols filename_to_store

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Strip DEBUG Symbols out of binary with DEBUG Symbols?

A

strip –strip-debug BIN_DEBUG

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Strip all DEBUG Symbols out of binary with DEBUG Symbols?

A

strip –strip-debug –strip-unneeded BIN_DEBUG

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Add DEBUG Symbols with a binary?

A

objcopy –add-gnu-debuglink=DEBUG_Symbols BIN_FILE

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Load the symbol file with GDB?

A

symbol-file file_name

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Load the symbol file within GDB?

A

symbol-file DEBUG_Symbols

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

List the files from which symbols were loaded?

A

Info files

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

List symbols from object file?

A

nm

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Symbol Type A means?

A

Absolute Symbol

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Symbol Type B means?

A

In the uninitialized Data Section (BSS)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Symbol Type D means?

A

In the initialized Data Section

17
Q

Symbol Type N means?

A

Debugging Symbol

18
Q

Symbol Type T means?

A

In the Text Section

19
Q

Symbol Type U means?

A

Symbol undefined right now

20
Q

NM to display size?

21
Q

NM to grep functionname?

A

NM -A …| grep function_name

22
Q

NM to display objects in sorted order?

23
Q

NM to display external variables?

24
Q

What traces all system calls made by the program?

25
Attaching to a running process with strace?
strace -p process_id
26
Statistics on syscall?
strace -c ./exe_name