Re: [4/7] Adjust the ttrace target (HP-UX) to always register the main thread

John David Anglin
2008-08-08T16:41:06Z

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: text/plain; charset=US-ASCII, Size: 7200 bytes --]

> ( I haven't touched the hpux-thread.c target, as it is still
> waiting for someone to rewrite it as a thread_stratum target, and
> remove its dependency on deprecated_child_ops. That is, it's dead broken
> code currently. While we're on to it, does anyone still care for
> HP-UX / ptrace (not ttrace) ? )

Yes, but I may be the only one. I tried a quick hack to get this
working awhile ago but didn't have the time to do it prperly.

> I have no means to test this. Can anybody with HP-UX access check
> if I didn't break anything? This patch only depends on patch 1 of
> the series.

> + delete_thread_silent (ptid_build (pid, lwpid, 0);

There's a typo in this line. With this fixed, things build. However,

# gdb/gdb main
GNU gdb (GDB) 6.8.50.20080807-cvs
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "hppa2.0w-hp-hpux11.11".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
(gdb) break main
Breakpoint 1 at 0x2b20: file main.c, line 4.
(gdb) r
Starting program: /xxx/gnu/gdb/objdir/main
Segmentation fault (core dumped)
# gdb -c core gdb/gdb
GNU gdb (GDB) 6.8.50.20080807-cvs
Copyright (C) 2008 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "hppa2.0w-hp-hpux11.11".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>...
Reading symbols from /usr/lib/dld.sl...done.
Loaded symbols for /usr/lib/dld.sl
Reading symbols from /xxx/gnu/gdb/objdir/gdb/gdb...done.
Loaded symbols for gdb/gdb
Reading symbols from /usr/lib/libxpdl.1...done.
Loaded symbols for /usr/lib/libxpdl.1
Reading symbols from /usr/lib/libxcurses.1...done.
Loaded symbols for /usr/lib/libxcurses.1
Reading symbols from /usr/lib/libm.2...done.
Loaded symbols for /usr/lib/libm.2
Reading symbols from /usr/lib/libc.2...done.
Loaded symbols for /usr/lib/libc.2
Reading symbols from /usr/lib/libdld.2...done.
Loaded symbols for /usr/lib/libdld.2
Reading symbols from /opt/graphics/OpenGL/lib/libogltls.sl...done.
Loaded symbols for /opt/graphics/OpenGL/lib/libogltls.sl

warning: Private mapping of shared library text was not specified
by the executable; setting a breakpoint in a shared library which
is not privately mapped will not work. See the HP-UX 11i v3 chatr
manpage for methods to privately map shared library text.
Unable to write __dld_flags.
(gdb) bt
#0 0x000c9960 in inf_ttrace_delete_dying_threads_callback (info=0x4007bdb0,
arg=0x0) at ../../src/gdb/inf-ttrace.c:828
#1 0x0008b640 in iterate_over_threads (
callback=@0x4001a712: 0xc9940 <inf_ttrace_delete_dying_threads_callback>,
data=0x0) at ../../src/gdb/thread.c:338
#2 0x000c98e0 in inf_ttrace_resume (ptid=
{pid = 0, lwp = 16961, tid = 7024758}, step=1073949720,
signal=TARGET_SIGNAL_0) at ../../src/gdb/inf-ttrace.c:854
#3 0x000a3390 in target_resume (ptid={pid = 0, lwp = 16961, tid = 7024758},
step=0, signal=TARGET_SIGNAL_0) at ../../src/gdb/target.c:1789
#4 0x00087f88 in resume (step=0, sig=TARGET_SIGNAL_0)
at ../../src/gdb/infrun.c:1123
#5 0x000c6db8 in startup_inferior (ntraps=1074249136)
at ../../src/gdb/fork-child.c:470
#6 0x000c8e8c in inf_ttrace_him (pid=16961) at ../../src/gdb/inf-ttrace.c:634
#7 0x000c7338 in fork_inferior (
exec_file_arg=0x4241 "g\220??\033.X??.X\017\206;\234\017\232;\234~?-ÃšÂ¾?-?6\225\001?6\225q??Dg??G?.?/?.?/ÃŸÂ±?U\235??T]?\213?5Ã—Â³?5*?\033P??\033Qp\027??p\020????\205???\204)??wq??wq4r??4r??M?h2M?h2\217?s\b\217?s\bV??HV??p0???0?U???Xb8?Xc?u6??r6?\002Sq?\002Sq\216??\225\217??\225\217MÃŠÂ±MMÃŠÂ¿MaX??b???]?*?-?*Ã‚Â¦?Y??"..., allargs=0x40077520 "", env=0x4004f998,
traceme_fun=@0x4001a6ea: 0xc8c30 <inf_ttrace_me>,
init_trace_fun=@0x4001a6f2: 0xc8d40 <inf_ttrace_him>,
pre_trace_fun=@0x4001a6fa: 0xc8b24 <inf_ttrace_prepare>,
shell_file_arg=0x0) at ../../src/gdb/fork-child.c:409
#8 0x000c8a34 in inf_ttrace_create_inferior (exec_file=0x4007bdb0 "",
allargs=0x0, env=0x82ded040, from_tty=134217759)
at ../../src/gdb/inf-ttrace.c:651
#9 0x000a1684 in find_default_create_inferior (
exec_file=0x400673d0 "/xxx/gnu/gdb/objdir/main", allargs=0x40077520 "",
env=0x4004f998, from_tty=1) at ../../src/gdb/target.c:2079
#10 0x0003a934 in run_command_1 (args=0x7eff0e03 "?@", from_tty=1,
tbreak_at_main=1074230560) at ../../src/gdb/infcmd.c:565
#11 0x0004ada4 in do_cfunc (c=0x4007bdb0, args=0x0, from_tty=-2099326912)
at ../../src/gdb/cli/cli-decode.c:60
#12 0x0004afc0 in cmd_func (cmd=0x4007bdb0, args=0x0, from_tty=-2099326912)
at ../../src/gdb/cli/cli-decode.c:1672
#13 0x00043474 in execute_command (p=0x40036b11 "", from_tty=1)
at ../../src/gdb/top.c:457
#14 0x0008f2fc in command_handler (command=0x1 "")
at ../../src/gdb/event-top.c:516
#15 0x00090490 in command_line_handler (rl=0x400672f0 "r")
at ../../src/gdb/event-top.c:747
#16 0x001a5354 in rl_callback_read_char ()
at ../../src/readline/callback.c:205
#17 0x0008f4bc in rl_callback_read_char_wrapper (client_data=0x4007bdb0)
at ../../src/gdb/event-top.c:178
#18 0x0008fcb8 in stdin_event_handler (error=1074249136, client_data=0x0)
at ../../src/gdb/event-top.c:433
#19 0x0008edac in handle_file_event (event_file_desc=0)
at ../../src/gdb/event-loop.c:732
#20 0x0008de88 in process_event () at ../../src/gdb/event-loop.c:341
#21 0x0008ea64 in gdb_do_one_event (data=0x4007bdb0)
at ../../src/gdb/event-loop.c:378
#22 0x0003ea10 in catch_errors (
func=@0x40018f72: 0x2b340 <captured_command_loop>, func_args=0x0,
errstring=0x7eff0008 "main", mask=134217759)
at ../../src/gdb/exceptions.c:509
#23 0x000e6624 in tui_command_loop (data=0x4007bdb0)
at ../../src/gdb/tui/tui-interp.c:153
#24 0x0003f09c in current_interp_command_loop ()
at ../../src/gdb/interps.c:289
#25 0x0002b364 in captured_command_loop (data=0x4007bdb0)
at ../../src/gdb/main.c:99
#26 0x0003ea10 in catch_errors (func=0x40019028 <_crt_errno+2168>,
func_args=0x1,
errstring=0x79000 "\b\034\002C?^\020\005\b\034\002Z?\037\036?\f?\020\223", mask=134217759) at ../../src/gdb/exceptions.c:509
#27 0x0002ad38 in captured_main (data=0x40032a04) at ../../src/gdb/main.c:831
#28 0x0003ea10 in catch_errors (func=0, func_args=0x0,
errstring=0x206050 "console", mask=134217759)
at ../../src/gdb/exceptions.c:509
#29 0x0002a1d0 in gdb_main (args=0x4007bdb0) at ../../src/gdb/main.c:840
#30 0x0002a190 in main (argc=1074249136, argv=0x0) at ../../src/gdb/gdb.c:33

(gdb) p info->private
$2 = (struct private_thread_info *) 0x0