This is the mail archive of the gdb-prs@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug tdep/17903] New: gdb cannot determine executable when attaching to processes on Solaris


https://sourceware.org/bugzilla/show_bug.cgi?id=17903

            Bug ID: 17903
           Summary: gdb cannot determine executable when attaching to
                    processes on Solaris
           Product: gdb
           Version: 7.8
            Status: NEW
          Severity: normal
          Priority: P2
         Component: tdep
          Assignee: unassigned at sourceware dot org
          Reporter: ro at TechFak dot Uni-Bielefeld.DE
              Host: *-*-solaris2.*

When attaching to a running process, gdb cannot determine the executable on
Solaris, thus has no symbol information.  Linux is different here:

ro@fozzie 148 > gdb 
GNU gdb (GDB) 7.8
[...]
This GDB was configured as "x86_64-unknown-linux-gnu".
[...]
(gdb) attach 2092
Attaching to process 2092
Reading symbols from /usr/local/bin/bash...done.
[...]
0x0000003231abc2fc in waitpid () from /lib64/libc.so.6
(gdb) where
#0  0x0000003231abc2fc in waitpid () from /lib64/libc.so.6
#1  0x000000000043d23b in waitchld (wpid=<optimized out>, block=1)
    at jobs.c:3093
#2  0x000000000043ec3b in wait_for (pid=26784) at jobs.c:2450
#3  0x0000000000430470 in execute_command_internal (command=0x2519600, 
    asynchronous=0, pipe_in=-1, pipe_out=<optimized out>, 
    fds_to_close=<optimized out>) at execute_cmd.c:775
#4  0x000000000042deef in execute_command (command=0x2519600)
    at execute_cmd.c:382
#5  0x000000000041db38 in reader_loop () at eval.c:152
#6  0x000000000041d60b in main (argc=<optimized out>, argv=0x7fffddd4e878, 
    env=0x7fffddd4e888) at shell.c:749

On Solaris, you get far less information instead:

ro@lokon 2721 > gdb
GNU gdb (GDB) 7.8
[...]
This GDB was configured as "i386-pc-solaris2.10".
[...]
(gdb) attach 2032
Attaching to process 2032
[New process 2032]
Retry #1:
Retry #2:
Retry #3:
Retry #4:
0xfe6cbc55 in ?? ()

This happens because Solaris currently doesn't implement the
to_pid_to_exec_file,
although that's certainly feasible:

* On Solaris 10 and beyond, there's /proc/<pid>/path/a.out, the exact
equivalent
  to Linux' /proc/<pid>/exe, it seems.

* Before, there's at least a heuristic available: the execname can be accessed
  via the AT_SUN_EXECNAME auxv entry, but that can be a relative path.  One
  could combine it with /proc/<pid>/cwd, but that's unreliable since the
process
  could have run chdir between exec and attach.

  Rainer

-- 
You are receiving this mail because:
You are on the CC list for the bug.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]