Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: markus.t.metzger@intel.com
Cc: gdb-patches@sourceware.org, markus.t.metzger@gmail.com
Subject: Re: [PATCH 1/3] record, btrace: add record-btrace target
Date: Wed, 27 Feb 2013 19:43:00 -0000	[thread overview]
Message-ID: <20130227193824.GA27661@host2.jankratochvil.net> (raw)
In-Reply-To: <20130227073731.GA1378@host2.jankratochvil.net>

On Wed, 27 Feb 2013 08:37:31 +0100, Jan Kratochvil wrote:
[...]
> > +/* Check if we should skip this file when generating the function call
> > +   history.
> > +   Update the recorded function segment.  */
> 
> I do not see a reason for this functionality.  There really may be a valid one
> but I do not see it.  Could you provide an example in the comment when it is
> useful?  I cannot much review it when I do not see what is it good for.
> 
> 
> > +
> > +static int
> > +btrace_function_skip_file (struct btrace_function *bfun,
> > +			   const char *filename)


Probably if one does:

file.c:
void func(void)
{
#include "file.def"
}

Then we want a single output line for file.c:func() without another output
line for file.def:func().  (It is not tested by the testsuite; OK.)

Therefore you apparently do not want to include the line numbers range of
file.def:func() into the range of lines of file.c:func(), that makes sense.

So my comments are valid, just use filename_cmp and compare symtab_to_fullname
of both symtabs (this is sub-optimal, comparing two source files for
equivalence can be made cheaper than finding out their full pathname; but that
is an optimization for another patch).





> > +{
> > +  /* Update the filename in case we didn't get it from the function symbol.  */
> > +  if (bfun->filename == NULL)
> > +    {
> > +      DEBUG_CALL ("file: '%s'", filename);
> > +
> > +      bfun->filename = filename;
> > +      return 0;
> > +    }
> > +
> > +  /* Check if we're still in the same file.  */
> > +  if (compare_filenames_for_search (bfun->filename, filename))
> > +    return 0;
> 
> Use filename_cmp for full pathnames.  Therefore always use symtab_to_fullname.
> The result of symtab_to_fullname call as 'const char *fullname'.
> 
> 
> > +
> > +  /* We switched files, but not functions.  Skip this file.  */
> > +  DEBUG_CALL ("ignoring file '%s' for %s in %s.", filename,
> > +	      bfun->function, bfun->filename);
> > +  return 1;
> > +}


[...]
> > +  /* Let's see if we have source correlation, as well.  */
> > +  line = find_pc_line (ip, 0);
> 
> Such variable is commonly called 'sal' (source-and-line) in GDB.
> 
> 
> > +  if (line.symtab != NULL)
> > +    {
> > +      const char *filename;
> > +
> > +      /* Without a filename, we ignore this instruction.  */
> > +      filename = symtab_to_filename_for_display (line.symtab);
> > +      if (filename == NULL)
> > +	return;
> 
> As you have non-NULL symtab here you always have non-NULL filename.
> 
> You should use symtab_to_fullname here as discussed elsewhere.
> 
> 
> > +
> > +      /* Do this check first to make sure we get a filename even if we don't
> > +	 have line information.  */
> > +      if (btrace_function_skip_file (bfun, filename))
> 
> But I do not see a reason for this function as written at
> btrace_function_skip_file.
> 
> 
> > +	return;
> > +
> > +      if (line.line == 0)
> > +	return;
> > +
> > +      btrace_function_update_lines (bfun, line.line, ip);
> > +    }
> > +}


Jan


  reply	other threads:[~2013-02-27 19:38 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-02-25 16:15 [PATCH 0/3] target record-btrace markus.t.metzger
2013-02-25 16:16 ` [PATCH 3/3] doc, record: document record changes markus.t.metzger
2013-02-26 17:24   ` Eli Zaretskii
2013-03-01 14:07     ` Metzger, Markus T
2013-03-01 14:26       ` Eli Zaretskii
2013-03-01 14:48         ` Metzger, Markus T
2013-03-01 15:12           ` Eli Zaretskii
2013-03-01 15:21             ` Metzger, Markus T
2013-03-02  9:46               ` Eli Zaretskii
2013-02-25 16:16 ` [PATCH 1/3] record, btrace: add record-btrace target markus.t.metzger
2013-02-27  7:38   ` Jan Kratochvil
2013-02-27 19:43     ` Jan Kratochvil [this message]
2013-02-28 17:17     ` Metzger, Markus T
2013-03-01  9:26       ` Jan Kratochvil
2013-02-25 16:16 ` [PATCH 2/3] record-btrace, disas: omit pc prefix markus.t.metzger
2013-02-27  7:59   ` Jan Kratochvil
2013-02-28  7:45     ` Metzger, Markus T
2013-02-28  7:56       ` Jan Kratochvil
2013-02-28  8:45         ` Metzger, Markus T
2013-02-28  8:54           ` Jan Kratochvil

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=20130227193824.GA27661@host2.jankratochvil.net \
    --to=jan.kratochvil@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=markus.t.metzger@gmail.com \
    --cc=markus.t.metzger@intel.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