public inbox for gdb@sourceware.org
 help / color / mirror / Atom feed
* Using gdb to debug Segmentation fault on linux
@ 2007-10-02 23:46 ying lcs
  2007-10-03  6:17 ` Jim Blandy
  2007-10-03  9:41 ` Baurzhan Ismagulov
  0 siblings, 2 replies; 3+ messages in thread
From: ying lcs @ 2007-10-02 23:46 UTC (permalink / raw)
  To: gdb

Hi,

I am trying to use gdb to debug a segmentation fault on linux:
I get this backtrace dump, but I don't see what's wrong and why i get
a segmentation fault.

The address of 'this' looks correct.  So I would need some help in how
to proceed in troubleshooting this problem:

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1218548816 (LWP 25361)]
0x08067623 in RTPStream::SendRTCPSR (this=0x83a1520, inTime=@0x1b9a5b58,
    inAppendBye=0) at RTCPUtilitiesLib/RTCPSRPacket.h:123
123         ((UInt32*)&fSenderReportBuffer)[(fSenderReportWithServerInfoSize
>> 2) + 1] = htonl(inSSRC);
(gdb)
(gdb) bt
#0  0x08067623 in RTPStream::SendRTCPSR (this=0x83a1520, inTime=@0x1b9a5b58,
    inAppendBye=0) at RTCPUtilitiesLib/RTCPSRPacket.h:123
#1  0x08067d40 in RTPStream::Write (this=0x83a1520, inBuffer=0x839d688,
    inLen=45, outLenWritten=0x0, inFlags=Variable "inFlags" is not available.
) at Server.tproj/RTPStream.cpp:1093
#2  0x0804c47f in QTSSCallbacks::QTSS_Write (inStream=0x83a1520,
    inBuffer=0x839d688, inLen=45, outLenWritten=0x0, inFlags=5)
    at Server.tproj/QTSSCallbacks.cpp:343
#3  0x080a28b6 in QTSSFileModuleDispatch (inRole=1936027236,
    inParamBlock=0xb75e6360)
    at APIModules/QTSSFileModule/QTSSFileModule.cpp:1569
#4  0x080608ed in RTPSession::Run (this=0x83945b0)
    at Server.tproj/QTSSModule.h:92
#5  0x080eb1c3 in TaskThread::Entry (this=0x8361258) at Task.cpp:179
#6  0x080e82af in OSThread::_Entry (inThread=0x8361258) at OSThread.cpp:254
#7  0x00106341 in start_thread () from /lib/tls/libpthread.so.0
#8  0x00c966fe in clone () from /lib/tls/libc.so.6

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Using gdb to debug Segmentation fault on linux
  2007-10-02 23:46 Using gdb to debug Segmentation fault on linux ying lcs
@ 2007-10-03  6:17 ` Jim Blandy
  2007-10-03  9:41 ` Baurzhan Ismagulov
  1 sibling, 0 replies; 3+ messages in thread
From: Jim Blandy @ 2007-10-03  6:17 UTC (permalink / raw)
  To: ying lcs; +Cc: gdb


"ying lcs" <yinglcs at gmail.com> writes:
> I am trying to use gdb to debug a segmentation fault on linux:
> I get this backtrace dump, but I don't see what's wrong and why i get
> a segmentation fault.
>
> The address of 'this' looks correct.  So I would need some help in how
> to proceed in troubleshooting this problem:

Knowing nothing about your code, I couldn't really suggest an
approach.  I don't even know whether fSenderReportBuffer is a field of
this, or a global variable, or what.  Could one of those identifiers
possibly be a reference created by dereferencing a bad pointer?  If
you disassemble the machine code at that line, does that help?

But please don't answer those questions.  :) Your post was closer to
being a request for help debugging your program than it was a question
about GDB per se, so it's a bit off-topic.  But if you have a question
specifically about GDB, please feel free to ask.

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Using gdb to debug Segmentation fault on linux
  2007-10-02 23:46 Using gdb to debug Segmentation fault on linux ying lcs
  2007-10-03  6:17 ` Jim Blandy
@ 2007-10-03  9:41 ` Baurzhan Ismagulov
  1 sibling, 0 replies; 3+ messages in thread
From: Baurzhan Ismagulov @ 2007-10-03  9:41 UTC (permalink / raw)
  To: gdb

Hello Ying,

On Tue, Oct 02, 2007 at 06:46:22PM -0500, ying lcs wrote:
> Program received signal SIGSEGV, Segmentation fault.
> [Switching to Thread -1218548816 (LWP 25361)]
> 0x08067623 in RTPStream::SendRTCPSR (this=0x83a1520, inTime=@0x1b9a5b58,
>     inAppendBye=0) at RTCPUtilitiesLib/RTCPSRPacket.h:123
> 123         ((UInt32*)&fSenderReportBuffer)[(fSenderReportWithServerInfoSize
> >> 2) + 1] = htonl(inSSRC);

First, you need to understand what SIGSEGV is. See, e.g.,
http://en.wikipedia.org/wiki/SIGSEGV .

Second, you need to understand what exactly caused it. "p
&((UInt32*)&fSenderReportBuffer)[(fSenderReportWithServerInfoSize >> 2)
+ 1]" at the gdb prompt might give a hint (compare it with the value of
fSenderReportBuffer and sizeof fSenderReportBuffer).

Only when these two are clear it would make sense to look at the bt,
which may or may not help.

With kind regards,
-- 
Baurzhan Ismagulov
http://www.kz-easy.com/

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2007-10-03  9:41 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-10-02 23:46 Using gdb to debug Segmentation fault on linux ying lcs
2007-10-03  6:17 ` Jim Blandy
2007-10-03  9:41 ` Baurzhan Ismagulov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).