public inbox for frysk@sourceware.org
 help / color / mirror / Atom feed
From: Phil Muldoon <pmuldoon@redhat.com>
To: Kris Van Hees <kris.van.hees@oracle.com>
Cc: frysk@sourceware.org
Subject: Re: Problem with getExe and testInsertedBreakpoint
Date: Thu, 26 Jul 2007 15:00:00 -0000	[thread overview]
Message-ID: <46A8B6DE.6080305@redhat.com> (raw)
In-Reply-To: <20070726132332.GD20459@ca-server1.us.oracle.com>

Kris Van Hees wrote:
> Recently, a problem has surfaced related to getExe() in relation to core
> files and its use in the testInsertedBreakpoint() test.  Specifically,
> the core file seems to store the first 79 characters of the full
> executable pathname only.  
For context here. The executable name is usually stored in two places, 
both in the same note:

eu-readelf -n core.2843

Note segment of 584 bytes at offset 0x294:
  Owner          Data size  Type
  CORE                 124  PRPSINFO
    state: T (84),  zombie: 49,  nice: 48
    flags: 00400000,  uid: 500,  gid: 500
    pid: 2843,  ppid: 2807,  pgrp: 2843,  sid: 2807
    fname: funit-child
     args: 
/home/pmuldoon/frysk_bin/frysk-core/frysk/pkglibdir/funit-child 10000 
--busy-lo


The first is fname, and the second ... assuming no tinkering with the 
args, is arg[0] in the args list.

In the struct elf_prpsinfo, these two are defined as

  char           pr_fname[16];  /* Filename of 
executable                    */
  char           pr_psargs[80]; /* Initial part of arg 
list                  */

So the length is limited in the notes section in the core file. There is 
nothing fcore, or gcore can do to overcome this.

The fcore command uses automatic executable location, which tries to 
find the executable from arg[0], or /usr/bin, or /bin. This is because 
there are two constructors in dead/LinuxHost. One that just takes just a 
core file and tries to find the core file itself (with hopefully 
build-id patches in the future), and one that takes a core file and its 
corresponding executable. From an api point of view, the latter will 
always be more accurate. Perhaps fcore and other core file utilities 
need to utilize the second constructor? Personally I would prefer this 
approach.


> This results in truncation in cases where the
> frysk build tree is located fairly far down a directory hierarchy (which
> is a implicit test in itself), and the testInsertedBreakpoint test tries
> to read the executable using a truncated (and thus invalid) executable
> path name.
>   

The truncation is always going to occur in that case :(
> As far as the test is concerned, I think it might be easiest to simply
> use the (known) path name to the executable name directly because this
> particular test is *not* verifying whether the getExe() processing
> works.  Avoiding this problem altogether in this test will at least
> avoid the current problem.
>   

The second constructor in dead/LinuxHost will satisfy that. Anyway, good 
catch.

Regards

Phil

  parent reply	other threads:[~2007-07-26 15:00 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-26 13:23 Kris Van Hees
2007-07-26 13:58 ` Mark Wielaard
2007-07-26 15:35   ` Phil Muldoon
2007-07-26 18:57     ` Mark Wielaard
2007-07-26 19:32       ` Phil Muldoon
2007-07-27 10:00         ` Mark Wielaard
2007-07-27 13:41           ` Phil Muldoon
2007-07-27 19:04           ` Roland McGrath
2007-07-31  9:57             ` Mark Wielaard
2007-07-31 10:18               ` Roland McGrath
2007-07-26 15:00 ` Phil Muldoon [this message]
2007-07-26 15:03   ` Phil Muldoon

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=46A8B6DE.6080305@redhat.com \
    --to=pmuldoon@redhat.com \
    --cc=frysk@sourceware.org \
    --cc=kris.van.hees@oracle.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 read-only IMAP folder(s) and NNTP newsgroup(s).