Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "Ulrich Weigand" <uweigand@de.ibm.com>
To: palves@redhat.com (Pedro Alves)
Cc: philippe.waroquiers@skynet.be (Philippe Waroquiers),
	       gdb-patches@sourceware.org
Subject: Re: [RFAv2 3/3] Make symtab.c better styled.
Date: Tue, 12 Feb 2019 14:04:00 -0000	[thread overview]
Message-ID: <20190212140401.3F628D802C8@oc3748833570.ibm.com> (raw)
In-Reply-To: <b8e6062a-fed7-45a7-8cee-55f82f49dbb0@redhat.com> from "Pedro Alves" at Feb 12, 2019 01:26:56 PM

Pedro Alves wrote:

> So even though function descriptors are data symbols, they're
> basically treated as text/code symbols.  The msymbol_is_function
> function returns true for them, and optionally returns the resolved
> entry address (which is where we place a breakpoint).
> 
> Since these function descriptor symbols represent functions, even though
> they're data symbols in the elf tables, it would seem natural to me to
> print them using the function name style.
> 
> What I'm not sure is whether we'll reach print_msymbol_info with
> data descriptor symbols when we do "info functions".  Seems like
> search_symbols won't consider those symbols when looking for
> functions for "info functions".  So we'd find those symbols only
> with "info variables", and then we'd print them as functions?
> 
> I guess it could be argued that we should fix search_symbols
> / "info functions" to consider function descriptors, and use
> msymbol_is_function in print_msymbol_info to decide whether
> to use function style.  I'm not 100% sure it needs fixing, and whether
> making "info functions" find the descriptors like that is the
> desired behavior.
> 
> It wouldn't be fair to impose "info functions" on PPC64 on you,
> though.
> 
> So if we don't fix that (and assuming it actually needs fixing, I'm
> not sure), then I guess the question is whether we should still
> print function descriptor symbols in function style, via 
> "info variable" or whatever other paths could end up calling
> print_msymbol_info in the future.
> 
> I'm not 100% sure what is preferred here.  Ulrich, thoughts?

In addition to the function descriptor, which is a data symbol,
we also get a function symbol for the actual code entry point,
prefixed with a dot ('.').  This is synthesized by BFD these
days.

I've just checked the current behavior on a ppc64 machine,
and we do indeed see the (synthetic) dot symbol listed under
"info functions" and the function descriptor symbol listed
under "info variables".

  (gdb) info functions
  [...]
  Non-debugging symbols:
  0x0000000010000514  .main

  (gdb) info variables
  [...]
  Non-debugging symbols:
  0x0000000010020088  main

On the other hand, "info symbol main" does dereference the
function descriptor and returns the code entry point:

 (gdb) info symbol main
 .main in section .text of /home/uweigand/a.out

This all is maybe not perfect, but seems reasonable enough to me.
I'm not sure it's worth spending much effort trying to "fix"
anything here.

I haven't followed the patch series in detail, do you think it
would break anything I've outlined above?


Bye,
Ulrich

-- 
  Dr. Ulrich Weigand
  GNU/Linux compilers and toolchain
  Ulrich.Weigand@de.ibm.com


  reply	other threads:[~2019-02-12 14:04 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-01-12 22:28 [RFAv2 0/3] Have GDB " Philippe Waroquiers
2019-01-12 22:28 ` [RFAv2 2/3] Use address style to print addresses in breakpoint information Philippe Waroquiers
2019-01-12 22:28 ` [RFAv2 1/3] Use function_name_style to print Ada and C function names Philippe Waroquiers
2019-01-17 22:21   ` Tom Tromey
2019-01-19 12:11     ` Philippe Waroquiers
2019-01-26  6:21       ` Joel Brobecker
2019-01-26 11:04         ` Philippe Waroquiers
2019-01-29 20:34           ` Philippe Waroquiers
2019-01-12 22:28 ` [RFAv2 3/3] Make symtab.c better styled Philippe Waroquiers
2019-01-17 22:25   ` Tom Tromey
2019-02-07 18:58   ` Pedro Alves
2019-02-09 10:36     ` Philippe Waroquiers
2019-02-12 13:27       ` Pedro Alves
2019-02-12 14:04         ` Ulrich Weigand [this message]
2019-02-12 14:32           ` Pedro Alves
     [not found] <20190212145443.E2799D8028D@oc3748833570.ibm.com>
2019-02-12 15:53 ` Pedro Alves
2019-02-12 18:41   ` Philippe Waroquiers

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=20190212140401.3F628D802C8@oc3748833570.ibm.com \
    --to=uweigand@de.ibm.com \
    --cc=gdb-patches@sourceware.org \
    --cc=palves@redhat.com \
    --cc=philippe.waroquiers@skynet.be \
    /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