1

Is this normal? I swear it was setting only 1 break point until recently. How do I make it only set a breakpoint in my running file and not the source file.

(gdb) break main
Breakpoint 1 at 0x1dbf
Breakpoint 2 at 0x1ed8: file arrays.c, line 17.
warning: Multiple breakpoints were set.
Use the "delete" command to delete unwanted breakpoints.
(gdb) 
Strawberry
  • 66,024
  • 56
  • 149
  • 197
  • possible duplicate of [GDB: warning: Multiple breakpoints were set](http://stackoverflow.com/questions/7330364/gdb-warning-multiple-breakpoints-were-set) – osgx Sep 07 '11 at 08:18

1 Answers1

2

There are multiple main symbols :) Perhaps look at 'info breakpoints' in gdb or

objdump -C -t myprog

to see why/where.

Use cscope to interactively search for declarations.

ctags -R . && grep -w main tags
[ -x /usr/bin/vim ] && vim +'tj main'

Should be helpful as well if you have ctags (and optionally, vim) installed

If all else fails, brute force grep -RIw main . should work. If even that fails, you should find yourself with very strange external header #defines or even a (static) library with a surplus main symbol. To brute force search for the main identifier through the preprocessed sources:

find -name '*.c'    -print0 | xargs -0n1 -iQ cpp -I/usr/include/... -DDEBUG Q Q.ii
find -name '*.c.ii' -print0 | xargs grep -wI main

(replace -I/usr/include/... -DDEBUG with the relevant preprocessor defines)

sehe
  • 374,641
  • 47
  • 450
  • 633