Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH] Update more types for section index change
@ 2024-09-13  2:11 Tom Tromey
  2024-09-13  4:41 ` Kevin Buettner
  0 siblings, 1 reply; 3+ messages in thread
From: Tom Tromey @ 2024-09-13  2:11 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

Commit f89276a2f3e ("change type of `general_symbol_info::m_section`
to int") did what it says in the title -- changed the type of the
section index from short to int.  However, it seems incomplete, in
that there are uses of the section index that use the type 'short'.

This patch fixes the ones I found, first by searching for
"short.*sect" and then by looking at all the callers of section_index
(and then functions called with the resulting value) just to try to be
more sure.
---
 gdb/coff-pe-read.c | 3 +--
 gdb/ctfread.c      | 2 +-
 gdb/mdebugread.c   | 4 ++--
 gdb/minsyms.c      | 3 +--
 gdb/psymtab.c      | 2 +-
 gdb/psymtab.h      | 2 +-
 6 files changed, 7 insertions(+), 9 deletions(-)

diff --git a/gdb/coff-pe-read.c b/gdb/coff-pe-read.c
index ed5e533a362..bb85b000ca9 100644
--- a/gdb/coff-pe-read.c
+++ b/gdb/coff-pe-read.c
@@ -176,7 +176,6 @@ add_pe_forwarded_sym (minimal_symbol_reader &reader,
 {
   enum minimal_symbol_type msymtype;
   int forward_dll_name_len = strlen (forward_dll_name);
-  short section;
 
   std::string forward_qualified_name = string_printf ("%s!%s",
 						      forward_dll_name,
@@ -215,7 +214,7 @@ add_pe_forwarded_sym (minimal_symbol_reader &reader,
   unrelocated_addr vma = unrelocated_addr (msymbol.value_address ()
 					   - objfile->text_section_offset ());
   msymtype = msymbol.minsym->type ();
-  section = msymbol.minsym->section_index ();
+  int section = msymbol.minsym->section_index ();
 
   /* Generate a (hopefully unique) qualified name using the first part
      of the dll name, e.g. KERNEL32!AddAtomA.  This matches the style
diff --git a/gdb/ctfread.c b/gdb/ctfread.c
index 9eb9537ef41..ee7c30f7d87 100644
--- a/gdb/ctfread.c
+++ b/gdb/ctfread.c
@@ -1460,7 +1460,7 @@ ctf_psymtab_type_cb (ctf_id_t tid, void *arg)
 {
   struct ctf_context *ccp;
   uint32_t kind;
-  short section = -1;
+  int section = -1;
 
   ccp = (struct ctf_context *) arg;
 
diff --git a/gdb/mdebugread.c b/gdb/mdebugread.c
index ab4d509e02a..f1211be108c 100644
--- a/gdb/mdebugread.c
+++ b/gdb/mdebugread.c
@@ -3368,7 +3368,7 @@ parse_partial_symbols (minimal_symbol_reader &reader,
 	      char *sym_name;
 	      enum address_class theclass;
 	      unrelocated_addr minsym_value;
-	      short section = -1;
+	      int section = -1;
 
 	      (*swap_sym_in) (cur_bfd,
 			      ((char *) debug_info->external_sym
@@ -3616,7 +3616,7 @@ parse_partial_symbols (minimal_symbol_reader &reader,
 	      enum address_class theclass;
 	      SYMR *psh;
 	      CORE_ADDR svalue;
-	      short section;
+	      int section;
 
 	      gdb_assert (ext_ptr->ifd == f_idx);
 
diff --git a/gdb/minsyms.c b/gdb/minsyms.c
index b5c4b95f1ba..33eb9072e5f 100644
--- a/gdb/minsyms.c
+++ b/gdb/minsyms.c
@@ -1594,7 +1594,6 @@ find_solib_trampoline_target (const frame_info_ptr &frame, CORE_ADDR pc)
 CORE_ADDR
 minimal_symbol_upper_bound (bound_minimal_symbol minsym)
 {
-  short section;
   struct obj_section *obj_section;
   CORE_ADDR result;
   struct minimal_symbol *iter, *msymbol;
@@ -1616,7 +1615,7 @@ minimal_symbol_upper_bound (bound_minimal_symbol minsym)
     = (minsym.objfile->per_bfd->msymbols.get ()
        + minsym.objfile->per_bfd->minimal_symbol_count);
   msymbol = minsym.minsym;
-  section = msymbol->section_index ();
+  int section = msymbol->section_index ();
   for (iter = msymbol + 1; iter != past_the_end; ++iter)
     {
       if ((iter->unrelocated_address ()
diff --git a/gdb/psymtab.c b/gdb/psymtab.c
index 0df3dc8ecbb..e25c3ab33ec 100644
--- a/gdb/psymtab.c
+++ b/gdb/psymtab.c
@@ -1082,7 +1082,7 @@ void
 partial_symtab::add_psymbol (std::string_view name, bool copy_name,
 			     domain_enum domain,
 			     enum address_class theclass,
-			     short section,
+			     int section,
 			     psymbol_placement where,
 			     unrelocated_addr coreaddr,
 			     enum language language,
diff --git a/gdb/psymtab.h b/gdb/psymtab.h
index 508e77810d2..a81526cddee 100644
--- a/gdb/psymtab.h
+++ b/gdb/psymtab.h
@@ -349,7 +349,7 @@ struct partial_symtab
   void add_psymbol (std::string_view name,
 		    bool copy_name, domain_enum domain,
 		    enum address_class theclass,
-		    short section,
+		    int section,
 		    psymbol_placement where,
 		    unrelocated_addr coreaddr,
 		    enum language language,
-- 
2.45.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Update more types for section index change
  2024-09-13  2:11 [PATCH] Update more types for section index change Tom Tromey
@ 2024-09-13  4:41 ` Kevin Buettner
  2024-09-13 11:38   ` Simon Marchi
  0 siblings, 1 reply; 3+ messages in thread
From: Kevin Buettner @ 2024-09-13  4:41 UTC (permalink / raw)
  To: Tom Tromey; +Cc: gdb-patches

On Thu, 12 Sep 2024 20:11:54 -0600
Tom Tromey <tom@tromey.com> wrote:

> Commit f89276a2f3e ("change type of `general_symbol_info::m_section`
> to int") did what it says in the title -- changed the type of the
> section index from short to int.  However, it seems incomplete, in
> that there are uses of the section index that use the type 'short'.
> 
> This patch fixes the ones I found, first by searching for
> "short.*sect" and then by looking at all the callers of section_index
> (and then functions called with the resulting value) just to try to be
> more sure.
> ---
>  gdb/coff-pe-read.c | 3 +--
>  gdb/ctfread.c      | 2 +-
>  gdb/mdebugread.c   | 4 ++--
>  gdb/minsyms.c      | 3 +--
>  gdb/psymtab.c      | 2 +-
>  gdb/psymtab.h      | 2 +-
>  6 files changed, 7 insertions(+), 9 deletions(-)

LGTM.

Approved-by: Kevin Buettner <kevinb@redhat.com>


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] Update more types for section index change
  2024-09-13  4:41 ` Kevin Buettner
@ 2024-09-13 11:38   ` Simon Marchi
  0 siblings, 0 replies; 3+ messages in thread
From: Simon Marchi @ 2024-09-13 11:38 UTC (permalink / raw)
  To: Kevin Buettner, Tom Tromey; +Cc: gdb-patches

On 9/13/24 12:41 AM, Kevin Buettner wrote:
> On Thu, 12 Sep 2024 20:11:54 -0600
> Tom Tromey <tom@tromey.com> wrote:
> 
>> Commit f89276a2f3e ("change type of `general_symbol_info::m_section`
>> to int") did what it says in the title -- changed the type of the
>> section index from short to int.  However, it seems incomplete, in
>> that there are uses of the section index that use the type 'short'.
>>
>> This patch fixes the ones I found, first by searching for
>> "short.*sect" and then by looking at all the callers of section_index
>> (and then functions called with the resulting value) just to try to be
>> more sure.
>> ---
>>  gdb/coff-pe-read.c | 3 +--
>>  gdb/ctfread.c      | 2 +-
>>  gdb/mdebugread.c   | 4 ++--
>>  gdb/minsyms.c      | 3 +--
>>  gdb/psymtab.c      | 2 +-
>>  gdb/psymtab.h      | 2 +-
>>  6 files changed, 7 insertions(+), 9 deletions(-)
> 
> LGTM.
> 
> Approved-by: Kevin Buettner <kevinb@redhat.com>

LGTM as well, thanks.

Approved-By: Simon Marchi <simon.marchi@efficios.com>

Simon

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-09-13 11:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-09-13  2:11 [PATCH] Update more types for section index change Tom Tromey
2024-09-13  4:41 ` Kevin Buettner
2024-09-13 11:38   ` Simon Marchi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox