Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Jan Vrany via Gdb <gdb@sourceware.org>
To: GDB mailing list <gdb@sourceware.org>
Cc: Simon Marchi <simark@simark.ca>
Subject: Re: Question re symbols, symtabs and blocks
Date: Tue, 03 Sep 2024 12:38:36 +0000	[thread overview]
Message-ID: <9a101660b4b7b4abcddb49940f1fdf975fd7d1d4.camel@vrany.io> (raw)
In-Reply-To: <fe9958d1-7c44-403f-b3bc-851552a0526e@simark.ca>

On Thu, 2024-08-29 at 10:41 -0400, Simon Marchi wrote:


> 
> On 2024-08-28 06:08, Jan Vrany via Gdb wrote:
> 
> > Hi,
> > 
> > in GDB, are there any constraints for blocks belonging to
> > to particular symtab? Like: must each blocks' start and end address
> > be within its superblocks' start and end address?
> 
> 
> This is how my mental model works, that children blocks must be
entirely
> within their parents (even considering that blocks may be
> non-contiguous), but I don't have proof of that.  It's just what
would
> make sense to me.


Thanks, it makes sense.



> 
> > Also, must blocks of different symtabs be always disjunct
> > (meaning, their start-end ranges must not overlap)?
> 
> 
> What kind of symtab are you talking about? "struct symtab" or "struct
> compunit_symtab"?  I don't think that blocks care about "struct
symtab".


Sorry. I meant compunit_symtab.


> However, blocks are part of a blockvector, and each compunit_symtab
has
> its own blockvector.  So my intuition is that blocks belonging to
> different compunit_symtabs should be disjoint, as compilation unit
> address ranges are typically disjoints.  

> But then I don't know if there

> are weird cases, 


Yeah, I have somewhat weird use case where I have an  
executable that contains a static buffer which  
is at runtime filled with with JIT-compiled code.  
In order to debug that jitted code, I create  
compunit_symtab, block, symtab, linetable and  
all that and for example "b jitted_function" but   
"disass jitted_function" disassembles the whole  
buffer. But looking at code more closely, it seems  
"disass" uses different way to figure out what range  
to disassemble.

Anyways, I'll try to rework the code to add blocks for  
jitted code to the existing compunit_symtab rather than  
creating new one.

Thanks!

Jan


> for instance I don't know how LTO affects this, if
> compilation units start sharing some code.
> 
> Simon






      reply	other threads:[~2024-09-03 12:39 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-28 10:08 Jan Vrany via Gdb
2024-08-29 14:41 ` Simon Marchi via Gdb
2024-09-03 12:38   ` Jan Vrany via Gdb [this message]

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=9a101660b4b7b4abcddb49940f1fdf975fd7d1d4.camel@vrany.io \
    --to=gdb@sourceware.org \
    --cc=jan@vrany.io \
    --cc=simark@simark.ca \
    /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