aboutsummaryrefslogtreecommitdiff
path: root/gdb/solib-aix.c
diff options
context:
space:
mode:
authorAditya Vidyadhar Kamath <Aditya.Kamath1@ibm.com>2023-02-17 09:07:44 -0600
committerUlrich Weigand <ulrich.weigand@de.ibm.com>2023-02-17 20:12:06 +0100
commit7a2a5ff865bead782393897fc5fde47def30dad4 (patch)
tree09fadd40f5e43094650ca8a122ae5285915791f5 /gdb/solib-aix.c
parentfe0431855aba332f12ef80b0af65d5a6653f9c96 (diff)
downloadgdb-7a2a5ff865bead782393897fc5fde47def30dad4.zip
gdb-7a2a5ff865bead782393897fc5fde47def30dad4.tar.gz
gdb-7a2a5ff865bead782393897fc5fde47def30dad4.tar.bz2
Fix multi-threaded debugging under AIX
Multi-threaded debugging using the libpthdebug debug interface is currently broken due to multiple issues. When debugging a single inferior, we were getting assertion failures in get_aix_thread_info as no tp->priv structure was allocated for the main thread. We fixed this by switching the main thread from a (pid, 0, 0) ptid_t to a (pid, 0, tid) ptid_t and allocaing the tp->priv structure in sync_threadlists. As a result, the switch_to_thread call in pdc_read_data could now fail since the main thread no longer uses (pid, 0, 0). So we replaced the call by only switching inferior_ptid, the current inferior, and the current address space (like proc-service.c). Add similar switching to pdc_write_data where it was missing completely. When debugging multiple inferiors, an additional set of problems prevented correct multi-threaded debugging: First of all, aix-thread.c used to have a number of global variables holding per-inferior information. We switched hese to a per-inferior data structure instead. Also, sync_threadlists was getting confused as we were comparing the list of threads returned by libpthdebug for *one* process with GDB's list of threads for *all* processes. Now we only use he GDB threads of the current inferior instead. We also skip calling pd_activate from pd_enable if that in_initial_library_scan flag is true for the current inferior. Finally, the presence of the thread library in any but the first inferior was not correctly detected due to a bug in solib-aix.c, where the BFD file name for shared library members was changed when the library was loaded for the first time, which caused the library to no longer be recognized by name when loaded a second time.
Diffstat (limited to 'gdb/solib-aix.c')
-rw-r--r--gdb/solib-aix.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/gdb/solib-aix.c b/gdb/solib-aix.c
index 726f072..d7062b4 100644
--- a/gdb/solib-aix.c
+++ b/gdb/solib-aix.c
@@ -610,6 +610,20 @@ solib_aix_bfd_open (const char *pathname)
if (member_name == bfd_get_filename (object_bfd.get ()))
break;
+ std::string s = bfd_get_filename (object_bfd.get ());
+
+ /* For every inferior after first int bfd system we
+ will have the pathname instead of the member name
+ registered. Hence the below condition exists. */
+
+ if (s.find ('(') != std::string::npos)
+ {
+ int pos = s.find ('(');
+ int len = s.find (')') - s.find ('(');
+ if (s.substr (pos+1, len-1) == member_name)
+ return object_bfd;
+ }
+
object_bfd = gdb_bfd_openr_next_archived_file (archive_bfd.get (),
object_bfd.get ());
}