segmentation fault

John
2004-06-10T21:08:03Z

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=us-ascii, Size: 1444 bytes --]

Hi all:

I encounter a segmentation fault probelm. When I use
"gdb core", gdb shows that the program stops at the
following line of my code:
sprintf(pt_->buffer() + offset,

I think that line cause segmentation fault.
I want to set a breakpoint at that line and run the
code to see what happens before segmetation fault. How
can I make the program stop right before segmentation
fault happens?
I also attach some information from gdb.

Thanks a lot.

John

---------------------------------------------------------------------------------
Loaded symbols for /lib/ld-linux.so.2
#0  0x4026ecef in vfprintf () from /lib/libc.so.6
(gdb) bt
#0  0x4026ecef in vfprintf () from /lib/libc.so.6
#1  0xbfffdd04 in ?? ()
#2  0x40286fcb in vsprintf () from /lib/libc.so.6
#3  0x4027492d in sprintf () from /lib/libc.so.6
#4  0x0812226b in CMUTrace::format_mac_common(Packet*,
char const*, int) (this=0x97528b8, p=0x12ef75a0,
why=0x82cc85c "---", offset=0)
at trace/cmu-trace.cc:228
.........

(gdb) frame 4
#4  0x0812226b in CMUTrace::format_mac_common(Packet*,
char const*, int) (this=0x97528b8, p=0x12ef75a0,
why=0x82cc85c "---", offset=0)
at trace/cmu-trace.cc:228
228             sprintf(pt_->buffer() + offset,
Current language:  auto; currently c++
(gdb)

__________________________________
Do you Yahoo!?
Friends. Fun. Try the all-new Yahoo! Messenger.