How can I use GDB to break points on all functions of a file?
1389vstux8d0dbxpprtpwzpqo8yeora3knwiqk2mnoigys5ocmi how to use GDB to break a breakpoint on all functions of a file? Sometimes, you want to clear the code execution sequence of a module and break points on each function of the module. if you look for every function from the source code and break a breakpoint in GDB, the efficiency is very low. After research, find the following method.
1) The first step is to compile the source code as. O.
Here we use Doug Lea's malloc. C source code as an example.
Download the malloc. C source code:
Http://gee.cs.oswego.edu/pub/misc/malloc.c
Http://gee.cs.oswego.edu/pub/misc/malloc.h
2) view all exported function symbols through nm, and connect the symbols with \ |
NM malloc. o | C ++ filt | grep-w-I t | awk '{print $3}' | tr '\ n',' | SED's /, the result is as follows: add_segment \ | bulk_free \ | calloc \ | change_mparam \ | percent \ | free \ | percent \ | ialloc \ | independent_calloc \ | percent \ | init_bins \ | percent \ | init_top \ | internal_bulk_free \ | internal_mallinfo \ | Alibaba \ | internal_memalign \ | mallinfo \ | malloc \ | malloc_footprint \ | Alibaba \ | malloc_stats \ | malloc_trim \ | Alibaba \ | mallopt \ | memalign \ | mmap_alloc \ | mmap_resize \ | posix_memalign \ | prepend_alloc \ | pvalloc \ | realloc \ | prop \ | percent \ | sys_alloc \ | sys_trim \ | percent \ | tmalloc_small \ | try_realloc_chunk \ | valloc \ |
3) Go to GDB to debug your program and execute the following command:
The symbol string connected by \ | in the Rb
RB add_segment \ | bulk_free \ | calloc \ | change_mparam \ | percent \ | free \ | percent \ | ialloc \ | independent_calloc \ | percent \ | init_bins \ | init_mparams \ | init_top \ | internal_bulk_free \ | internal_mallinfo \ | Alibaba \ | internal_memalign \ | mallinfo \ | malloc \ | Alibaba \ | malloc_stats \ | malloc_trim \ | Alibaba \ | mallopt \ | memalign \ | mmap_alloc \ | mmap_resize \ | posix_memalign \ | prepend_alloc \ | pvalloc \ | realloc \ | identifier \ | sys_alloc \ | sys_trim \ | identifier \ | tmalloc_small \ | try_realloc_chunk \ | valloc
Note: RB uses regular expressions to batch break points on all matching symbols.
I am very satisfied with the following results:
1389vstux8d0dbxpprtpwzpqo8yeora3knwiqk2mnoigys5ocmi label: GDB
Breakpoint
Batch 1389vstux8d0dbxpprtpwzpqo8yeora3knwiqk2mnoigys5ocmi how to use GDB to break a breakpoint on all functions of a file? Sometimes, you want to clear the code execution sequence of a module and break points on each function of the module. if you look for every function from the source code and break a breakpoint in GDB, the efficiency is very low. After research, find the following method.
1) The first step is to compile the source code as. O.
Here we use Doug Lea's malloc. C source code as an example.
Download the malloc. C source code:
Http://gee.cs.oswego.edu/pub/misc/malloc.c
Http://gee.cs.oswego.edu/pub/misc/malloc.h
2) view all exported function symbols through nm, and connect the symbols with \ |
NM malloc. o | C ++ filt | grep-w-I t | awk '{print $3}' | tr '\ n',' | SED's /, the result is as follows: add_segment \ | bulk_free \ | calloc \ | change_mparam \ | percent \ | free \ | percent \ | ialloc \ | independent_calloc \ | percent \ | init_bins \ | percent \ | init_top \ | internal_bulk_free \ | internal_mallinfo \ | Alibaba \ | internal_memalign \ | mallinfo \ | malloc \ | malloc_footprint \ | Alibaba \ | malloc_stats \ | malloc_trim \ | Alibaba \ | mallopt \ | memalign \ | mmap_alloc \ | mmap_resize \ | posix_memalign \ | prepend_alloc \ | pvalloc \ | realloc \ | prop \ | percent \ | sys_alloc \ | sys_trim \ | percent \ | tmalloc_small \ | try_realloc_chunk \ | valloc \ |
3) Go to GDB to debug your program and execute the following command:
The symbol string connected by \ | in the Rb
RB add_segment \ | bulk_free \ | calloc \ | change_mparam \ | percent \ | free \ | percent \ | ialloc \ | independent_calloc \ | percent \ | init_bins \ | init_mparams \ | init_top \ | internal_bulk_free \ | internal_mallinfo \ | Alibaba \ | internal_memalign \ | mallinfo \ | malloc \ | Alibaba \ | malloc_stats \ | malloc_trim \ | Alibaba \ | mallopt \ | memalign \ | mmap_alloc \ | mmap_resize \ | posix_memalign \ | prepend_alloc \ | pvalloc \ | realloc \ | identifier \ | sys_alloc \ | sys_trim \ | identifier \ | tmalloc_small \ | try_realloc_chunk \ | valloc
Note: RB uses regular expressions to batch break points on all matching symbols.
I am very satisfied with the following results:
1389vstux8d0dbxpprtpwzpqo8yeora3knwiqk2mnoigys5ocmi