* [PATCH 1/2] Fix regcache::cooked_read_test selftest for mep
@ 2019-12-03 6:20 Simon Marchi
2019-12-03 6:20 ` [PATCH 2/2] Fix doc of AVR-specific command "info io_registers" Simon Marchi
2019-12-04 17:49 ` [PATCH 1/2] Fix regcache::cooked_read_test selftest for mep Tom Tromey
0 siblings, 2 replies; 5+ messages in thread
From: Simon Marchi @ 2019-12-03 6:20 UTC (permalink / raw)
To: gdb-patches; +Cc: Simon Marchi
When running the regcache::cooked_read_test selftest in an all targets
build, I get the following internal error:
/home/simark/src/binutils-gdb/gdb/thread.c:95: internal-error: thread_info* inferior_thread(): Assertion `tp' failed.
The stack trace is the followiing:
#9 0x000055fe25584a52 in internal_error (file=0x55fe27a25fe0 "/home/simark/src/binutils-gdb/gdb/thread.c", line=95, fmt=0x55fe27a25c80 "%s: Assertion `%s' failed.")
at /home/simark/src/binutils-gdb/gdb/gdbsupport/errors.c:55
#10 0x000055fe260674bc in inferior_thread () at /home/simark/src/binutils-gdb/gdb/thread.c:95
#11 0x000055fe25c62f0f in get_current_regcache () at /home/simark/src/binutils-gdb/gdb/regcache.c:372
#12 0x000055fe2594fcf1 in current_options () at /home/simark/src/binutils-gdb/gdb/mep-tdep.c:873
#13 0x000055fe2594ff08 in mep_register_name (gdbarch=0x62100056f510, regnr=152) at /home/simark/src/binutils-gdb/gdb/mep-tdep.c:958
#14 0x000055fe25950112 in mep_register_reggroup_p (gdbarch=0x62100056f510, regnum=152, group=0x55fe2924d540 <save_group>) at /home/simark/src/binutils-gdb/gdb/mep-tdep.c:1029
#15 0x000055fe2555ad87 in gdbarch_register_reggroup_p (gdbarch=0x62100056f510, regnum=152, reggroup=0x55fe2924d540 <save_group>) at /home/simark/src/binutils-gdb/gdb/gdbarch.c:3622
#16 0x000055fe25c61d45 in reg_buffer::save(gdb::function_view<register_status (int, unsigned char*)>) (this=0x7ffc61a0ed90, cooked_read=...)
at /home/simark/src/binutils-gdb/gdb/regcache.c:247
#17 0x000055fe2552ac60 in readonly_detached_regcache::readonly_detached_regcache(gdbarch*, gdb::function_view<register_status (int, unsigned char*)>) (this=0x7ffc61a0ed90,
gdbarch=0x62100056f510, cooked_read=...) at /home/simark/src/binutils-gdb/gdb/regcache.h:444
#18 0x000055fe25c61867 in readonly_detached_regcache::readonly_detached_regcache (this=0x7ffc61a0ed90, src=...) at /home/simark/src/binutils-gdb/gdb/regcache.c:212
#19 0x000055fe25c6a5ca in selftests::cooked_read_test (gdbarch=0x62100056f510) at /home/simark/src/binutils-gdb/gdb/regcache.c:1613
The problems is that mep's code ends up calling inferior_thread, which
calls find_thread_ptid. find_thread_ptid searches for a thread by ptid
in the thread list of the inferior that is expected to contain that
thread.
However, the thread list of the mock inferior set up in cooked_read_test
is never initialized. So find_thread_ptid doesn't find the thread,
which is an unexpected situation for inferior_thread.
This is failing since this commit:
080363310650c93ad8e93018bcb6760ba5d32d1c
Per-inferior thread list, thread ranges/iterators, down with ALL_THREADS, etc.
Fix it by putting the mock thread in the thread list of the mock
inferior in cooked_read_test.
gdb/ChangeLog:
* regcache.c (cooked_read_test): Initialize thread list of
mock_inferior.
---
gdb/regcache.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/gdb/regcache.c b/gdb/regcache.c
index 2e8b52ee751e..f0f7730f3e4c 100644
--- a/gdb/regcache.c
+++ b/gdb/regcache.c
@@ -1535,6 +1535,7 @@ cooked_read_test (struct gdbarch *gdbarch)
mock_inferior.gdbarch = gdbarch;
mock_inferior.aspace = &mock_aspace;
thread_info mock_thread (&mock_inferior, mock_ptid);
+ mock_inferior.thread_list = &mock_thread;
/* Add the mock inferior to the inferior list so that look ups by
target+ptid can find it. */
--
2.24.0
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 2/2] Fix doc of AVR-specific command "info io_registers"
2019-12-03 6:20 [PATCH 1/2] Fix regcache::cooked_read_test selftest for mep Simon Marchi
@ 2019-12-03 6:20 ` Simon Marchi
2019-12-04 17:49 ` Tom Tromey
2019-12-04 17:49 ` [PATCH 1/2] Fix regcache::cooked_read_test selftest for mep Tom Tromey
1 sibling, 1 reply; 5+ messages in thread
From: Simon Marchi @ 2019-12-03 6:20 UTC (permalink / raw)
To: gdb-patches; +Cc: Simon Marchi
Running the selftests on an all-targets build, I get:
Running selftest help_doc_invariants.
help doc broken invariant: command 'info io_registers' help doc first line is not terminated with a '.' character
Self test failed: self-test failed at /home/simark/src/binutils-gdb/gdb/unittests/help-doc-selftests.c:95
Add a period at the end of the doc of that command, and make it a bit
nicer in general.
gdb/ChangeLog:
* avr-tdep.c (_initialize_avr_tdep): Improve help of command
"info io_registers".
---
gdb/avr-tdep.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/gdb/avr-tdep.c b/gdb/avr-tdep.c
index 6d11ee1618cc..61a0a5dd52ea 100644
--- a/gdb/avr-tdep.c
+++ b/gdb/avr-tdep.c
@@ -1629,5 +1629,5 @@ _initialize_avr_tdep (void)
io_registers' to signify it is not available on other platforms. */
add_info ("io_registers", avr_io_reg_read_command,
- _("query remote avr target for io space register values"));
+ _("Query remote AVR target for I/O space register values."));
}
--
2.24.0
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] Fix regcache::cooked_read_test selftest for mep
2019-12-03 6:20 [PATCH 1/2] Fix regcache::cooked_read_test selftest for mep Simon Marchi
2019-12-03 6:20 ` [PATCH 2/2] Fix doc of AVR-specific command "info io_registers" Simon Marchi
@ 2019-12-04 17:49 ` Tom Tromey
2019-12-04 18:48 ` Simon Marchi
1 sibling, 1 reply; 5+ messages in thread
From: Tom Tromey @ 2019-12-04 17:49 UTC (permalink / raw)
To: Simon Marchi; +Cc: gdb-patches
>>>>> "Simon" == Simon Marchi <simon.marchi@polymtl.ca> writes:
Simon> gdb/ChangeLog:
Simon> * regcache.c (cooked_read_test): Initialize thread list of
Simon> mock_inferior.
Seems fine.
Thanks.
Tom
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 2/2] Fix doc of AVR-specific command "info io_registers"
2019-12-03 6:20 ` [PATCH 2/2] Fix doc of AVR-specific command "info io_registers" Simon Marchi
@ 2019-12-04 17:49 ` Tom Tromey
0 siblings, 0 replies; 5+ messages in thread
From: Tom Tromey @ 2019-12-04 17:49 UTC (permalink / raw)
To: Simon Marchi; +Cc: gdb-patches
>>>>> "Simon" == Simon Marchi <simon.marchi@polymtl.ca> writes:
Simon> gdb/ChangeLog:
Simon> * avr-tdep.c (_initialize_avr_tdep): Improve help of command
Simon> "info io_registers".
Thanks, this looks good to me.
Tom
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH 1/2] Fix regcache::cooked_read_test selftest for mep
2019-12-04 17:49 ` [PATCH 1/2] Fix regcache::cooked_read_test selftest for mep Tom Tromey
@ 2019-12-04 18:48 ` Simon Marchi
0 siblings, 0 replies; 5+ messages in thread
From: Simon Marchi @ 2019-12-04 18:48 UTC (permalink / raw)
To: Tom Tromey; +Cc: gdb-patches
On 2019-12-04 12:49 p.m., Tom Tromey wrote:
>>>>>> "Simon" == Simon Marchi <simon.marchi@polymtl.ca> writes:
>
> Simon> gdb/ChangeLog:
>
> Simon> * regcache.c (cooked_read_test): Initialize thread list of
> Simon> mock_inferior.
>
> Seems fine.
> Thanks.
>
> Tom
>
Thanks, I pushed both patches.
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2019-12-04 18:48 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-03 6:20 [PATCH 1/2] Fix regcache::cooked_read_test selftest for mep Simon Marchi
2019-12-03 6:20 ` [PATCH 2/2] Fix doc of AVR-specific command "info io_registers" Simon Marchi
2019-12-04 17:49 ` Tom Tromey
2019-12-04 17:49 ` [PATCH 1/2] Fix regcache::cooked_read_test selftest for mep Tom Tromey
2019-12-04 18:48 ` Simon Marchi
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).