linux-c-programming.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Holger Kiehl <Holger.Kiehl@dwd.de>
To: Manish Katiyar <mkatiyar@gmail.com>
Cc: linux-c-programming@vger.kernel.org
Subject: Re: Question about core files
Date: Fri, 9 Oct 2009 12:43:25 +0000 (GMT)	[thread overview]
Message-ID: <Pine.LNX.4.64.0910091238000.12677@diagnostix.dwd.de> (raw)
In-Reply-To: <ea11fea30910090515p5c21b577i96078f78b253f6f8@mail.gmail.com>

[-- Attachment #1: Type: TEXT/PLAIN, Size: 3595 bytes --]

On Fri, 9 Oct 2009, Manish Katiyar wrote:

> On Fri, Oct 9, 2009 at 5:39 PM, Holger Kiehl <Holger.Kiehl@dwd.de> wrote:
>> Hello Manish
>>
>> First, sorry for the late responce!
>>
>> On Wed, 7 Oct 2009, Manish Katiyar wrote:
>>
>>> On Wed, Oct 7, 2009 at 7:51 PM, Holger Kiehl <Holger.Kiehl@dwd.de> wrote:
>>>>
>>>> Hello Manish
>>>>
>>>> On Wed, 7 Oct 2009, Manish Katiyar wrote:
>>>>
>>>>> Hi Holger,
>>>>>
>>>>> I don't have the source code, so a bit hard to guess. But you can try
>>>>> to find out which member of your fsa structure is at offset 236 (0xec)
>>>>> and look around those lines in the function where you are accessing
>>>>> that member.
>>>>>
>>>>> I am trying to download the AFD source code, which looks like it will
>>>>> take ages on my slow broadband. Hopefully I can help after that.
>>>>>
>>>> If you download, please take afd-1.4.0-0.20.beta.tar.bz2 because that
>>>> is the one that caused the error. You can get it from:
>>>>
>>>>   ftp://ftp.dwd.de/pub/afd/development/afd-1.4.0-0.20.beta.tar.bz2
>>>>
>>>> You will find the relevant code in src/fd.c.
>>>
>>> Hi Holger,
>>>
>>> (gdb) set $offset = (int)(&((struct filetransfer_status *)0)->host_status)
>>> (gdb) p $offset
>>> $5 = 236
>>> (gdb) p/x 236
>>> $6 = 0xec
>>>
>>> host_status is at offset 236. In the function start_process I can see
>>> that this is used at places by dereferencing below
>>> "fsa[fsa_pos].host_status ".
>>>
>>> At this point my guess would be that you are getting fsa_pos as
>>> something illegal ie.. probably you are trying to access beyond the
>>> array. Since this is an input to the function, you can just check its
>>> value at the start and assert if that is ok and within reasonable
>>> range.
>>>
>>> HTH
>>>
>> Many thanks for finding this out! I think I now, with your help, have a
>> clue where the error could be. Is there a way to find out what value
>> fsa_pos had at that time?
>
> Since it is a runtime variable, probably we can get something by
> looking at the output of "info registers". But you can try putting
>
How can I find which register is fsa_pos?

    (gdb) info registers
    rax            0x7fb48a2c8718   140413389014808
    rbx            0x4acb3bcd       1254833101
    rcx            0x0      0
    rdx            0x7fb48a2c9010   140413389017104
    rsi            0x68     104
    rdi            0x7fb48a3795d8   140413389739480
    rbp            0x0      0x0
    rsp            0x7fffe4906840   0x7fffe4906840
    r8             0x7fb48a346018   140413389529112
    r9             0x0      0
    r10            0x3f     63
    r11            0x25c8   9672
    r12            0x5d     93
    r13            0xbbfe88b9       3154020537
    r14            0xfffffffffffff708       -2296
    r15            0x1      1
    rip            0x404b5f 0x404b5f <start_process+143>
    eflags         0x10207  [ CF PF IF RF ]
    cs             0x33     51
    ss             0x2b     43
    ds             0x0      0
    es             0x0      0
    fs             0x0      0
    gs             0x0      0
    fctrl          0x0      0
    fstat          0x0      0
    ftag           0x0      0
    fiseg          0x0      0
    fioff          0x0      0
    foseg          0x0      0
    fooff          0x0      0
    fop            0x0      0
    mxcsr          0x0      [ ]

> if (fsa_pos <0 ) {
>   printf("going to die ... \n");
>   return
> }
>
> in the start of the function itself and try.
>
Yes, I have already added that. Thanks!

Holger

  reply	other threads:[~2009-10-09 12:43 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-06 14:04 Question about core files Holger Kiehl
2009-10-06 14:41 ` Manish Katiyar
2009-10-07 13:28   ` Holger Kiehl
2009-10-07 13:54     ` Manish Katiyar
2009-10-07 14:21       ` Holger Kiehl
2009-10-07 17:36         ` Manish Katiyar
2009-10-08 18:47           ` Manish Katiyar
2009-10-09 12:09           ` Holger Kiehl
2009-10-09 12:15             ` Manish Katiyar
2009-10-09 12:43               ` Holger Kiehl [this message]
2009-10-10  8:35                 ` Glynn Clements
2009-10-10  9:08                   ` Manish Katiyar
2009-10-10 16:56                   ` Holger Kiehl
2009-10-07  4:45 ` Glynn Clements
2009-10-07 13:43   ` Holger Kiehl
2009-10-08  0:28     ` Glynn Clements
2009-10-09 12:12       ` Holger Kiehl
2009-10-07  4:58 ` vinit dhatrak

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Pine.LNX.4.64.0910091238000.12677@diagnostix.dwd.de \
    --to=holger.kiehl@dwd.de \
    --cc=linux-c-programming@vger.kernel.org \
    --cc=mkatiyar@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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 NNTP newsgroup(s).