aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)AuthorFilesLines
2022-01-03Automatic date update in version.inGDB Administrator1-1/+1
2022-01-02Automatic date update in version.inGDB Administrator1-1/+1
2022-01-01Automatic date update in version.inGDB Administrator1-1/+1
2021-12-31Automatic date update in version.inGDB Administrator1-1/+1
2021-12-30Automatic date update in version.inGDB Administrator1-1/+1
2021-12-29Automatic date update in version.inGDB Administrator1-1/+1
2021-12-28Automatic date update in version.inGDB Administrator1-1/+1
2021-12-27Automatic date update in version.inGDB Administrator1-1/+1
2021-12-26Automatic date update in version.inGDB Administrator1-1/+1
2021-12-25Automatic date update in version.inGDB Administrator1-1/+1
2021-12-24Automatic date update in version.inGDB Administrator1-1/+1
2021-12-23gdb/remote: handle attach when stop packet lacks thread-idAndrew Burgess4-52/+101
Bug PR gdb/28405 reports a regression when using attach with an extended-remote target. In this case the target is not including a thread-id in the stop packet it sends back after the attach. The regression was introduced with this commit: commit 8f66807b98f7634c43149ea62e454ea8f877691d Date: Wed Jan 13 20:26:58 2021 -0500 gdb: better handling of 'S' packets The problem is that when GDB processes the stop packet, it sees that there is no thread-id and so has to "guess" which thread the stop should apply to. In this case the target only has one thread, so really, there's no guessing needed, but GDB still runs through the same process, this shouldn't cause us any problems. However, after the above commit, GDB now expects itself to be more internally consistent, specifically, only a thread that GDB thinks is resumed, can be a candidate for having stopped. It turns out that, when GDB attaches to a process through an extended-remote target, the threads of the process being attached too, are not, initially, marked as resumed. And so, when GDB tries to figure out which thread the stop might apply too, it finds no threads in the processes marked resumed, and so an assert triggers. In extended_remote_target::attach we create a new thread with a call to add_thread_silent, rather than remote_target::remote_add_thread, the reason is that calling the latter will result in a call to 'add_thread' rather than 'add_thread_silent'. However, remote_target::remote_add_thread includes additional actions (i.e. calling remote_thread_info::set_resumed and set_running) which are missing from extended_remote_target::attach. These missing calls are what would serve to mark the new thread as resumed. In this commit I propose that we add an extra parameter to remote_target::remote_add_thread. This new parameter will force the new thread to be added with a call to add_thread_silent. We can now call remote_add_thread from the ::attach method, the extra actions (listed above) will now be performed, and the thread will be left in the correct state. Additionally, in PR gdb/28405, a segfault is reported. This segfault triggers when 'set debug remote 1' is used before trying to reproduce the original assertion failure. The cause of this is in remote_target::select_thread_for_ambiguous_stop_reply, where we do this: remote_debug_printf ("first resumed thread is %s", pid_to_str (first_resumed_thread->ptid).c_str ()); remote_debug_printf ("is this guess ambiguous? = %d", ambiguous); gdb_assert (first_resumed_thread != nullptr); Notice that when debug printing is on we dereference first_resumed_thread before we assert that the pointer is not nullptr. This is the cause of the segfault, and is resolved by moving the assert before the debug printing code. I've extended an existing test, ext-attach.exp, so that the original test is run multiple times; we run in the original mode, as normal, but also, we now run with different packets disabled in gdbserver. In particular, disabling Tthread would trigger the assertion as it was reported in the original bug. I also run the test in all-stop and non-stop modes now for extra coverage, we also run the tests with target-async enabled, and disabled. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=28405 This is a cherry pick of commit b622494ee378fd0a490 with a minor edit in gdb.server/ext-attach.exp to disable some tests that fail due to unrelated bugs. Those unrelated bugs have been fixed in the master branch. gdb/ChangeLog: PR gdb/28405 * remote.c (remote_target::remote_add_thread): Add new silent_p argument, use as needed. (remote_target::remote_notice_new_inferior): Pass additional argument to remote_add_thread. (remote_target::remote_notice_new_inferior): Likewise. (extended_remote_target::attach): Call remote_add_thread instead of add_thred_silent directly. (remote_target::select_thread_for_ambiguous_stop_reply): Move assert earlier, before we use the thing we're asserting is not nullptr. gdb/testsuite/ChangeLog: PR gdb/28405 * gdb.server/ext-attach.exp (run_test): New proc containing all of the old code for running the core of the test. This proc is then called multiple times from the global scope.
2021-12-23Automatic date update in version.inGDB Administrator1-1/+1
2021-12-22Automatic date update in version.inGDB Administrator1-1/+1
2021-12-21Automatic date update in version.inGDB Administrator1-1/+1
2021-12-20Automatic date update in version.inGDB Administrator1-1/+1
2021-12-19Automatic date update in version.inGDB Administrator1-1/+1
2021-12-18Automatic date update in version.inGDB Administrator1-1/+1
2021-12-17Automatic date update in version.inGDB Administrator1-1/+1
2021-12-16Automatic date update in version.inGDB Administrator1-1/+1
2021-12-15Automatic date update in version.inGDB Administrator1-1/+1
2021-12-14Automatic date update in version.inGDB Administrator1-1/+1
2021-12-13Automatic date update in version.inGDB Administrator1-1/+1
2021-12-12Automatic date update in version.inGDB Administrator1-1/+1
2021-12-11PR gdb/28480: Improve ambiguous member detectionBruno Larsen5-0/+73
Basic ambiguity detection assumes that when 2 fields with the same name have the same byte offset, it must be an unambiguous request. This is not always correct. Consider the following code: class empty { }; class A { public: [[no_unique_address]] empty e; }; class B { public: int e; }; class C: public A, public B { }; if we tried to use c.e in code, the compiler would warn of an ambiguity, however, since A::e does not demand an unique address, it gets the same address (and thus byte offset) of the members, making A::e and B::e have the same address. however, "print c.e" would fail to report the ambiguity, and would instead print it as an empty class (first path found). The new code solves this by checking for other found_fields that have different m_struct_path.back() (final class that the member was found in), despite having the same byte offset. The testcase gdb.cp/ambiguous.exp was also changed to test for this behavior. gdb/ChangeLog: PR gdb/28480 * valops.c (struct_field_searcher::update_result): Improve ambiguous member detection. gdb/testsuite/ChangeLog: PR gdb/28480 Pushed by Joel Brobecker <brobecker@adacore.com> * gdb.cp/ambiguous.cc: Add code to permit ambiguous member testing. * gdb.cp/ambiguous.exp: Add ambiguous member test. (cherry picked from commit a41ad3474ceacba39e11c7478154c0e553784a01)
2021-12-11Automatic date update in version.inGDB Administrator1-1/+1
2021-12-10Automatic date update in version.inGDB Administrator1-1/+1
2021-12-09Automatic date update in version.inGDB Administrator1-1/+1
2021-12-08Automatic date update in version.inGDB Administrator1-1/+1
2021-12-07Automatic date update in version.inGDB Administrator1-1/+1
2021-12-06Automatic date update in version.inGDB Administrator1-1/+1
2021-12-05Automatic date update in version.inGDB Administrator1-1/+1
2021-12-04Automatic date update in version.inGDB Administrator1-1/+1
2021-12-03Automatic date update in version.inGDB Administrator1-1/+1
2021-12-02Automatic date update in version.inGDB Administrator1-1/+1
2021-12-01Automatic date update in version.inGDB Administrator1-1/+1
2021-11-30Automatic date update in version.inGDB Administrator1-1/+1
2021-11-29Allow DW_ATE_UTF for Rust charactersTom Tromey4-13/+75
The Rust compiler plans to change the encoding of a Rust 'char' type to use DW_ATE_UTF. You can see the discussion here: https://github.com/rust-lang/rust/pull/89887 However, this fails in gdb. I looked into this, and it turns out that the handling of DW_ATE_UTF is currently fairly specific to C++. In particular, the code here assumes the C++ type names, and it creates an integer type. This comes from commit 53e710acd ("GDB thinks char16_t and char32_t are signed in C++"). The message says: Both places need fixing. But since I couldn't tell why dwarf2read.c needs to create a new type, I've made it use the per-arch built-in types instead, so that the types are only created once per arch instead of once per objfile. That seems to work fine. ... which is fine, but it seems to me that it's also correct to make a new character type; and this approach is better because it preserves the type name as well. This does use more memory, but first we shouldn't be too concerned about the memory use of types coming from debuginfo; and second, if we are, we should implement type interning anyway. Changing this code to use a character type revealed a couple of oddities in the C/C++ handling of TYPE_CODE_CHAR. This patch fixes these as well. I filed PR rust/28637 for this issue, so that this patch can be backported to the gdb 11 branch. (cherry picked from commit 1c0e43634cfdd0ad7ef9ac3dd7d208dddeb80f5e)
2021-11-29Automatic date update in version.inGDB Administrator1-1/+1
2021-11-28Automatic date update in version.inGDB Administrator1-1/+1
2021-11-27Automatic date update in version.inGDB Administrator1-1/+1
2021-11-26Automatic date update in version.inGDB Administrator1-1/+1
2021-11-25Automatic date update in version.inGDB Administrator1-1/+1
2021-11-24Automatic date update in version.inGDB Administrator1-1/+1
2021-11-23Automatic date update in version.inGDB Administrator1-1/+1
2021-11-22Automatic date update in version.inGDB Administrator1-1/+1
2021-11-21Automatic date update in version.inGDB Administrator1-1/+1
2021-11-20Automatic date update in version.inGDB Administrator1-1/+1
2021-11-19Automatic date update in version.inGDB Administrator1-1/+1
2021-11-18Automatic date update in version.inGDB Administrator1-1/+1