public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH 1/2] Don't create _Complex type name if there is no target type name
       [not found] <20201006154928.3298-1-ssbssa.ref@yahoo.de>
@ 2020-10-06 15:49 ` Hannes Domani
  2020-10-06 15:49   ` [PATCH 2/2] Remove gdb_assert for TYPE_CODE_METHOD in stabs reader Hannes Domani
  2020-10-22 17:21   ` [PATCH 1/2] Don't create _Complex type name if there is no target type name Tom Tromey
  0 siblings, 2 replies; 7+ messages in thread
From: Hannes Domani @ 2020-10-06 15:49 UTC (permalink / raw)
  To: gdb-patches

This causes gdb to crash in strlen.

Happens if init_complex_type is called for a type created by
dbx_init_float_type in stabsread.c.

gdb/ChangeLog:

2020-10-06  Hannes Domani  <ssbssa@yahoo.de>

	* gdbtypes.c (init_complex_type): Check target type name.
---
 gdb/gdbtypes.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c
index b7c8ec8e64..a40ae5f30e 100644
--- a/gdb/gdbtypes.c
+++ b/gdb/gdbtypes.c
@@ -3283,7 +3283,7 @@ init_complex_type (const char *name, struct type *target_type)
 
   if (TYPE_MAIN_TYPE (target_type)->flds_bnds.complex_type == nullptr)
     {
-      if (name == nullptr)
+      if (name == nullptr && target_type->name () != nullptr)
 	{
 	  char *new_name
 	    = (char *) TYPE_ALLOC (target_type,
-- 
2.27.0


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

* [PATCH 2/2] Remove gdb_assert for TYPE_CODE_METHOD in stabs reader
  2020-10-06 15:49 ` [PATCH 1/2] Don't create _Complex type name if there is no target type name Hannes Domani
@ 2020-10-06 15:49   ` Hannes Domani
  2020-10-22 17:21     ` Tom Tromey
  2020-10-22 17:21   ` [PATCH 1/2] Don't create _Complex type name if there is no target type name Tom Tromey
  1 sibling, 1 reply; 7+ messages in thread
From: Hannes Domani @ 2020-10-06 15:49 UTC (permalink / raw)
  To: gdb-patches

It's possible to come across TYPE_CODE_UNDEF at this point in
read_member_functions, which according to a comment in read_type
is used for forward references.

gdb/ChangeLog:

2020-10-06  Hannes Domani  <ssbssa@yahoo.de>

	* stabsread.c (read_member_functions): Remove gdb_assert.
---
 gdb/stabsread.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/gdb/stabsread.c b/gdb/stabsread.c
index d2ff54a47b..a7f4ee0a8c 100644
--- a/gdb/stabsread.c
+++ b/gdb/stabsread.c
@@ -2331,9 +2331,6 @@ read_member_functions (struct stab_field_info *fip, const char **pp,
 	  /* These are methods, not functions.  */
 	  if (new_sublist->fn_field.type->code () == TYPE_CODE_FUNC)
 	    new_sublist->fn_field.type->set_code (TYPE_CODE_METHOD);
-	  else
-	    gdb_assert (new_sublist->fn_field.type->code ()
-			== TYPE_CODE_METHOD);
 
 	  /* If this is just a stub, then we don't have the real name here.  */
 	  if (TYPE_STUB (new_sublist->fn_field.type))
-- 
2.27.0


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

* Re: [PATCH 1/2] Don't create _Complex type name if there is no target type name
  2020-10-06 15:49 ` [PATCH 1/2] Don't create _Complex type name if there is no target type name Hannes Domani
  2020-10-06 15:49   ` [PATCH 2/2] Remove gdb_assert for TYPE_CODE_METHOD in stabs reader Hannes Domani
@ 2020-10-22 17:21   ` Tom Tromey
  2020-10-22 17:40     ` Hannes Domani
  1 sibling, 1 reply; 7+ messages in thread
From: Tom Tromey @ 2020-10-22 17:21 UTC (permalink / raw)
  To: Hannes Domani via Gdb-patches

>>>>> "Hannes" == Hannes Domani via Gdb-patches <gdb-patches@sourceware.org> writes:

I didn't see a review of this.

Hannes> This causes gdb to crash in strlen.
Hannes> Happens if init_complex_type is called for a type created by
Hannes> dbx_init_float_type in stabsread.c.

Hannes> gdb/ChangeLog:

Hannes> 2020-10-06  Hannes Domani  <ssbssa@yahoo.de>

Hannes> 	* gdbtypes.c (init_complex_type): Check target type name.

This is ok, thanks.

Tom

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

* Re: [PATCH 2/2] Remove gdb_assert for TYPE_CODE_METHOD in stabs reader
  2020-10-06 15:49   ` [PATCH 2/2] Remove gdb_assert for TYPE_CODE_METHOD in stabs reader Hannes Domani
@ 2020-10-22 17:21     ` Tom Tromey
  0 siblings, 0 replies; 7+ messages in thread
From: Tom Tromey @ 2020-10-22 17:21 UTC (permalink / raw)
  To: Hannes Domani via Gdb-patches

>>>>> "Hannes" == Hannes Domani via Gdb-patches <gdb-patches@sourceware.org> writes:

Hannes> It's possible to come across TYPE_CODE_UNDEF at this point in
Hannes> read_member_functions, which according to a comment in read_type
Hannes> is used for forward references.

Hannes> gdb/ChangeLog:

Hannes> 2020-10-06  Hannes Domani  <ssbssa@yahoo.de>

Hannes> 	* stabsread.c (read_member_functions): Remove gdb_assert.

Ok.  Thanks for the patch.

Tom

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

* Re: [PATCH 1/2] Don't create _Complex type name if there is no target type name
  2020-10-22 17:21   ` [PATCH 1/2] Don't create _Complex type name if there is no target type name Tom Tromey
@ 2020-10-22 17:40     ` Hannes Domani
  2020-10-22 17:46       ` Tom Tromey
  0 siblings, 1 reply; 7+ messages in thread
From: Hannes Domani @ 2020-10-22 17:40 UTC (permalink / raw)
  To: Hannes Domani via Gdb-patches, Tom Tromey, Joel Brobecker

 Am Donnerstag, 22. Oktober 2020, 19:21:43 MESZ hat Tom Tromey <tom@tromey.com> Folgendes geschrieben:

> >>>>> "Hannes" == Hannes Domani via Gdb-patches <gdb-patches@sourceware.org> writes:
>
> I didn't see a review of this.
>
> Hannes> This causes gdb to crash in strlen.
> Hannes> Happens if init_complex_type is called for a type created by
> Hannes> dbx_init_float_type in stabsread.c.
>
> Hannes> gdb/ChangeLog:
>
> Hannes> 2020-10-06  Hannes Domani  <ssbssa@yahoo.de>
>
> Hannes>     * gdbtypes.c (init_complex_type): Check target type name.
>
> This is ok, thanks.

Pushed both, thanks.

I'm not sure how relevant stabs nowadays is, but this crash is a regression
since gdb 9, and the fix is very simple, so maybe we should merge it to
gdb 10 as well?


Hannes

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

* Re: [PATCH 1/2] Don't create _Complex type name if there is no target type name
  2020-10-22 17:40     ` Hannes Domani
@ 2020-10-22 17:46       ` Tom Tromey
  2020-10-22 18:20         ` Hannes Domani
  0 siblings, 1 reply; 7+ messages in thread
From: Tom Tromey @ 2020-10-22 17:46 UTC (permalink / raw)
  To: Hannes Domani; +Cc: Hannes Domani via Gdb-patches, Tom Tromey, Joel Brobecker

Hannes> I'm not sure how relevant stabs nowadays is, but this crash is a regression
Hannes> since gdb 9, and the fix is very simple, so maybe we should merge it to
Hannes> gdb 10 as well?

I think it would be fine.

stabs should not generally be used.
I'm curious what you're using it for.

Tom

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

* Re: [PATCH 1/2] Don't create _Complex type name if there is no target type name
  2020-10-22 17:46       ` Tom Tromey
@ 2020-10-22 18:20         ` Hannes Domani
  0 siblings, 0 replies; 7+ messages in thread
From: Hannes Domani @ 2020-10-22 18:20 UTC (permalink / raw)
  To: Tom Tromey; +Cc: Hannes Domani via Gdb-patches, Joel Brobecker

 Am Donnerstag, 22. Oktober 2020, 19:46:21 MESZ hat Tom Tromey <tom@tromey.com> Folgendes geschrieben:

> Hannes> I'm not sure how relevant stabs nowadays is, but this crash is a regression
> Hannes> since gdb 9, and the fix is very simple, so maybe we should merge it to
> Hannes> gdb 10 as well?
>
> I think it would be fine.

I pushed this to gdb-10-branch as well, thanks.


> stabs should not generally be used.
> I'm curious what you're using it for.

At my workplace we still need it for long-term support of some older customer
servers.


Hannes

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

end of thread, other threads:[~2020-10-22 18:21 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20201006154928.3298-1-ssbssa.ref@yahoo.de>
2020-10-06 15:49 ` [PATCH 1/2] Don't create _Complex type name if there is no target type name Hannes Domani
2020-10-06 15:49   ` [PATCH 2/2] Remove gdb_assert for TYPE_CODE_METHOD in stabs reader Hannes Domani
2020-10-22 17:21     ` Tom Tromey
2020-10-22 17:21   ` [PATCH 1/2] Don't create _Complex type name if there is no target type name Tom Tromey
2020-10-22 17:40     ` Hannes Domani
2020-10-22 17:46       ` Tom Tromey
2020-10-22 18:20         ` Hannes Domani

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).