Bug 28605 - internal-error: Should not be able to create a lazy value with an enclosing type
Summary: internal-error: Should not be able to create a lazy value with an enclosing type
Status: NEW
Alias: None
Product: gdb
Classification: Unclassified
Component: c++ (show other bugs)
Version: 11.1
: P2 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-11-18 13:04 UTC by Roman Nikulenkov
Modified: 2023-01-30 23:24 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:
Last reconfirmed: 2022-04-02 00:00:00


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Roman Nikulenkov 2021-11-18 13:04:11 UTC
Crash in gdb/dwarf2/loc.c:1730: internal-error: Should not be able to create a lazy value with an enclosing type

It's happens randomly during debug under QtCreator Linux Mangaro XFCE.
Full text from QtCreator debugger log:
>&"python theDumper.fetchVariables({\"autoderef\":1,\"context\":\"\",\"displaystringlimit\":300,\"dyntype\":1,\"expanded\":[\"watch\",\"return\",\"local\",\"inspect\"],\"fancy\":1,\"formats\":{},\"nativemixed\":0,\"partialvar\":\"\",\"passexceptions\":0,\"qobjectnames\":1,\"resultvarname\":\"\",\"stringcutoff\":10000,\"timestamps\":0,\"token\":37,\"typeformats\":{},\"watchers\":[]})\n"
>~"../../gdb/dwarf2/loc.c:1730: internal-error: Should not be able to create a lazy value with an enclosing type\nA problem internal to GDB has been detected,\nfurther debugging may prove unreliable."
Comment 1 Roman Nikulenkov 2021-11-25 07:52:24 UTC
on the same code version 10.2 works without any issues
Comment 2 Tom Tromey 2022-02-19 16:40:17 UTC
I think we'd need more information to try to fix this bug.
One thing that might be useful is a stack trace showing
the path taken by gdb to the error.

The very best thing would be a small C++ test case and a sequence
of commands that can be used to reproduce the crash.  (I realize
this is probably hard though)

I somewhat suspect that the assertion is in error, as the code
says:

  if (from != nullptr)
    {
      from_contents = value_contents (from).data ();
      v_contents = nullptr;
    }
  else
    {
      if (value_type (v) != value_enclosing_type (v))
	internal_error (__FILE__, __LINE__,
			_("Should not be able to create a lazy value with "
			  "an enclosing type"));

... but when I look at this I don't see anything that's obviously
checking for a lazy value.

However, looking at the most recent patch in this area, I see the
assertion goes back a ways.  So I'm not certain that the check
is wrong, and I wonder what really changed.
Comment 3 Tom Tromey 2022-10-21 17:05:29 UTC
See https://sourceware.org/pipermail/gdb-patches/2022-October/192547.html
There are other threads in earlier months as well.
Comment 4 Tom Tromey 2023-01-30 23:24:18 UTC
That patch landed but I tend to think we should clear the
enclosing type when modifying a value's type.