Local/remote debugging feature parity

GDBserver supports features native debugging does not support. Native debugging supports features GDBserver does not support.

The aim of this project is bridging the gap between both worlds.

A secondary goal of this project is making it possible to share a single target backend between native debugging and GDBserver (on GNU/Linux at first).

Neither target backend is a superset of the other currently, so we can't just drop one of them. The headed direction is making the GDBserver backend support all of GDB's native backend's features (and more), and then drop GDB's.

See also the Common project.

1. Getting the code / Helping

Discussions are held on the main GDB mailing lists. Patches should be posted to the gdb-patches mailing list. Work is being committed directly to the mainline (i.e., there's no special feature branch).

For testing, run the testsuite using the native-extended-gdbserver.exp board file under src/gdb/testsuite/boards/ and compare the results to the results of a native test run. The native-extended-gdbserver.exp board file tests GDB against a GDBserver running on the local host (the board file takes care of spawning GDBserver), and has GDB connect to GDBserver in extended-remote mode, which allows "run" "attach", etc., just like when debugging with the native target. Ideally, the results between both runs would be identical.

2. TODO/Feature comparison

Feature

Native

GDBserver

Status

PR

Owner

Notes

follow fork/exec

X

7.10/7.11

fixed

PR13584

Don

target extended-remote forks in 7.10; target remote and execs in 7.11

inferior IO

X

tracepoints

X

fast tracepoints / IPA

X

mixed multi-arch

7.6

7.7

fixed

PR14823

Pedro

Before 7.7, although GDBserver supported biarch, when debugging multiple processes, they had to be of the same arch.

set inferior env (set environment)

X

8.1

fixed

Sergio

Exposed by solib-nodir.exp, testenv.exp

set inferior cwd (cd/pwd)

X

fixed

Sergio

Exposed by solib-nodir.exp

use shell to start program

X

8.1

fixed

Sergio

wildcard expansion, variable replacement and I/O redirection

catch syscall

X

7.11

fixed

PR13585

Josh/Philippe

attach auto-load exec

X

7.10

fixed

target_pid_to_exec_file

TARGET_WAITKIND_NO_RESUMED / graceful leader-exits

X

7.11

fixed

PR14618

Pedro

leader-exit.exp, no-unwaited-for-left.exp, non-ldr-exc-*.exp. See here and here.

chain of pending signals

X

PR9381 ?

can access memory of running thread

X

can set breakpoints, inspect globals, etc.

static libthread_db / no-libthread_db

X

attach to stopped process

X

7.5

fixed

PR9684

Pedro

attach-stopped.exp

attach to signalled process

X

7.5

fixed

Pedro

attach-into-signal.exp

checkpoint

X

the "checkpoint" command is marked as experimental, and can't handle multi-threaded processes anyway, so low priority

thread name reporting

X

7.11

fixed

?

Simon

gdb.threads/names.exp

3. Other TODOs/Issues

Feature

Status

PR

Owner

Notes

info threads output different between native/remote.

in-progress

thread names / PR14817

Pedro

gdbserver doesn't extract pthread ids out of thread_db. There's no way for gdbserver to affect target_pid_to_str's output. E.g., native "Thread 0x7ffff70e6140 (LWP 211048)" vs gdbserver "Thread 211048.211048".

attach output is different native/remote

done

Pedro

Revealed by several tests failing (extended-remote).

We can't flip non-stop mode on after "target extended-remote".

All non-stop tests fail with the current extended-remote board file due to this. Affected tests: gdb.python/py-evsignal.exp gdb.python/py-evthreads.exp

PR12967

gdb.python/py-evsignal.exp and gdb.python/py-evthreads.exp use non-stop, if they don't, then we trip on PR12967.

gdbserver: Unexpected missing PT_PHDR

done

Pedro

with break-interp.exp, we see a lot of "gdbserver: Unexpected missing PT_PHDR" in the gdb.log. Maybe harmless?

the annota2.exp and annota3.exp fail with the extended-remote board.

gcore.exp system-core.exp float.exp fail on native, but pass with gdbserver.

done

Pedro

AVX/xsave related. Patch posted here.

signal other than SIGSTOP on CLONE events

done

Pedro

gdbserver/linux-low.c:stopped_pids list doesn't hold the lwp's status. It is assumed that the status is a SIGSTOP. That's not always true, and, GDB/linux-nat.c:stopped_pids does store the lwp's status.

"[Thread debugging using libthread_db enabled]" "Using host libthread_db library "/lib64/libthread_db.so.1"."

Should we forward such messages back to gdb?

Finding new threads in the inferior

Native GNU/Linux debugging adds new threads to the thread list as the program creates them "The [New Thread foo] messages". Remote debugging can't do that, and it's arguable whether we shouldn't even stop native debugging from doing that, as it hinders inferior performance.

Finding new threads in the inferior, part 2

fixed in 7.9

Pedro

With remote targets (and gdbserver), even after the program stops, the user still needed to do "info threads" to pull an updated thread list. GDB now pulls the list itself, just before presenting a stop to the user.

Ctrl-C handling

In non-stop mode, Ctrl-C sends SIGINT when debugging natively, and SIGSTOP when debugging remotely. As a data point, the "interrupt" command sends SIGSTOP if non-stop, natively and remotely.

remote: support is incomplete

PR15651 PR16622

15651 and 16622 document some issues with remote: support. At the least, IWBN if "target remote ...; file remote:foo; set remote exec-file foo; start" worked. Even better if we could remove the need for remote exec-file.

$pdir doesn't work with gdbserver

PR17258

A value of $pdir for LIBTHREAD_DB_SEARCH_PATH is ignored by gdbserver


OngoingWork

None: LocalRemoteFeatureParity (last edited 2023-09-25 19:22:02 by PedroAlves)

All content (C) 2008 Free Software Foundation. For terms of use, redistribution, and modification, please see the WikiLicense page.