From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ed1-x529.google.com (mail-ed1-x529.google.com [IPv6:2a00:1450:4864:20::529]) by sourceware.org (Postfix) with ESMTPS id 3B1AE3858D35 for ; Mon, 1 May 2023 05:30:44 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 3B1AE3858D35 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-ed1-x529.google.com with SMTP id 4fb4d7f45d1cf-5050497df77so3282336a12.1 for ; Sun, 30 Apr 2023 22:30:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1682919043; x=1685511043; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=fpeTqlxvNSsTe6tH6fAwntigyVM0W1gsOH+gqp0knnk=; b=c4P9DaR3YdR4bL/rxG2k/n7LglAjiyJTeXSjqeGVpKGELZQvtc4j90IVYbbX6o88GP Gx4urMjckDrlyW+boN2Ei5pzR2cdGs+Ozcvb2jMBcoVU14/l2YKdiZ/40OFpi+7kt5Ke BTM/RgPmQZc6l9A9liLTjmhATiD1UIzLI9uzQSJGuCqw18+0sRdt1L+xqNRSoeyg4DYU TBuRIz6sVWT86L6S15yq72HNhkSb18Zk3X88UdSSWtfSw49TkL131ljC9DQM0poPFXMU 3KHYOcaw14QDh9KBJ/RWIzTJcDAH5rUW0C4i8zMPz9mMjBKrtCRwFYP3sp/DbcAkTRbD yPWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1682919043; x=1685511043; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=fpeTqlxvNSsTe6tH6fAwntigyVM0W1gsOH+gqp0knnk=; b=HhUL2r0zuEpLIzU0kCrWpB0xGI9TfNEAg5o9w/Bq6M2knMQdE4KenT4CdX3Cl2eo56 mMoSQtySy7LOHRXGzPhB2kg0i6L19HV8l2UUSgabc2JOwJW1IoER1gmqKf7nWfh4Jv+U rGIMwedh9qrG+D64VWInIRh0UDFDcVqS8GyLX9zJV+lHh/wsoYm9MGH7Zy02OSfDVbOY 1mfbT8ZXxbd2sHH4dVh1W5NhhtMGYGaDvc7fRz1khqT88CbDXrSc+eAtSgkp3y/yJPcf bMY9Gir1sZfVGmzYD7Cf58VTvjLMMu6l3DIvcH7TDa/v6La48SU8NKngRgXTsX0GWWLF DSVg== X-Gm-Message-State: AC+VfDzb0DHx5DBg/lsYEaaO1N4I5RNRjE2Oi7AU15tS1RQQ/ZPzt2W7 cQLQm7vXmMqVbZWRn8uEKXJZkp0Q7jztNJmgSEOKKlmN+YSD9g== X-Google-Smtp-Source: ACHHUZ5alL8DMKAx1i9+UDlntHVFOkjhZhARNZs7BbyKO3FOAn5G1eiuY+dcsnmLMyNQ3796kBbF44rUgvx69W1HiXQ= X-Received: by 2002:a05:6402:20b:b0:506:b24c:284f with SMTP id t11-20020a056402020b00b00506b24c284fmr3882416edv.26.1682919042698; Sun, 30 Apr 2023 22:30:42 -0700 (PDT) MIME-Version: 1.0 References: <00c24cea-f256-3149-dcc7-1bad08e8bef8@arm.com> In-Reply-To: From: Chris Packham Date: Mon, 1 May 2023 17:30:30 +1200 Message-ID: Subject: Re: Problems interrupting remote target on powerpc To: Luis Machado Cc: GDB Mailing list Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-0.3 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,KAM_LOTSOFHASH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On Sat, Apr 29, 2023 at 1:02=E2=80=AFAM Luis Machado = wrote: > > On 4/28/23 12:25, Chris Packham wrote: > > > > > > On Fri, 28 Apr 2023, 9:41 PM Luis Machado, > wrote: > > > > On 4/28/23 10:38, Chris Packham wrote: > > > > > > > > > On Fri, 28 Apr 2023, 9:19 PM Luis Machado, >> wrote: > > > > > > On 4/28/23 10:14, Chris Packham via Gdb wrote: > > > > On Thu, 27 Apr 2023, 4:55 PM Chris Packham, >> wrote: > > > > > > > >> Hi GDB, > > > >> > > > >> I've had a few users report to me issues with interrupti= ng a running > > > >> process after continuing when attached to a remote gdbse= rver running > > > >> on a powerpc target. Everything seems to work properly o= n arm and > > > >> aarch64 so there might be some powerpc or big-endian spe= cific issue > > > >> lurking. > > > >> > > > >> The gdbserver version we're currently using is from gdb-= 11.2 built > > > >> from source and most users have gdb-multiarch 12.1 from = ubuntu 22.04 > > > >> (some might still be using gdb-multiarch 10.2 from a PPA= ). > > > >> > > > >> Does this ring any bells for anyone? I'm going to try an= d get hold of > > > >> a powerpc target to test with to see if I can reproduce = it for myself. > > > >> > > > >> Thanks, > > > >> Chris > > > >> > > > > > > > > Did some digging of my own I can report that indeed thing= s aren't working > > > > well for powerpc. I tried updating gdbserver to 12.1 and = 13.1. 12.1 was > > > > much the same as 11.2. 13.1 reported that it was unable t= o send sigkill > > > > when processing the interrupt command. 13.1 also seems no= t to be able to > > > > respond to the 'info os processes' command from the gdb c= lient > > > > > > > >> > > > > > > What sort of behavior/output do you see? > > > > > > > > > I'll capture some proper output when I'm back in the office but = basically once I 'continue' I can't get the gdb prompt back with Ctrl+C. > > > > > > > Is it a tight loop by any change? Or is gdb trapped in a long seque= nce of instruction-steps? > > > > > > It's a daemon using a g_main_loop() not sure if that counts as a tight = loop. GDB shouldn't be doing any stepping. I'll also give a process that ru= ns and finishes when I get a chance to see if there are issues with that. > > > > Got it. It would be useful to see some of the output with "set debug remo= te 1" and "set debug remote-packet-max-chars -1". It may indicate what's go= ing on. So things get a bit stranger. I tried to replicate my problem using a busybox applet (cat /dev/zero) but I was able to Ctrl-C and continue multiple times. Here's a snippet of debug doing that (gdb) cont Continuing. [remote] Sending packet: $Z0,100040e0,4#d0 [remote] Packet received: OK [remote] Sending packet: $Z0,10036bb8,4#0c [remote] Packet received: OK [remote] Sending packet: $Z0,1003ae68,4#0e [remote] Packet received: OK [remote] Sending packet: $Z0,778e5770,4#f4 [remote] Packet received: OK [remote] Sending packet: $vCont;c:p63a8.-1#e0 [remote] wait: enter [remote] wait: exit ^C[remote] pass_ctrlc: enter [remote] interrupt: enter [remote] interrupt: exit [remote] pass_ctrlc: exit [remote] wait: enter [remote] Packet received: T0201:7fa61a50;40:0fde67f0;thread:p63a8.63a8;co= re:2; [remote] wait: exit [remote] Sending packet: $qXfer:threads:read::0,1000#92 [remote] Packet received: l\n\n\n Program received signal SIGINT, Interrupt. [remote] Sending packet: $z0,100040e0,4#f0 [remote] Packet received: OK [remote] Sending packet: $z0,10036bb8,4#2c [remote] Packet received: OK [remote] Sending packet: $z0,1003ae68,4#2e [remote] Packet received: OK [remote] Sending packet: $z0,778e5770,4#14 [remote] Packet received: OK [remote] Sending packet: $mfde67f0,4#ff [remote] Packet received: 7c000026 [remote] Sending packet: $mfde67ec,4#31 [remote] Packet received: 44000002 [remote] Sending packet: $mfde67f0,4#ff [remote] Packet received: 7c000026 [remote] Sending packet: $mfde67ec,4#31 [remote] Packet received: 44000002 0x0fde67f0 in __GI___libc_write ([remote] Sending packet: $m7fa61a40,40#27 [remote] Packet received: 000000017fa61ab800001000000010007fa61a700002d002fffff00000000000100078287fa= 61ab87fa61ab8000000017fa61a90100078287792e5c800000000 [remote] Sending packet: $g#67 [remote] Packet received: 000000047fa61a50779355c00000001e7fa61ab800001000000010000fde66c00002d002fff= ff000000000007fa61a9024002444100a866800000000000000000000000000000000000000= 0000000000000000000000000077931b78100040e0000000000000000100000003100a00000= 0000000000010000fef37e40000000100000000000000000000000000000000000000000000= 000000000000000000000000000000000000000000000000000000000000000000000000000= 000000000000000000000000000000000000000000000000000000000000000000000000000= 00000000000000000000000000000000000000000000000000000000000000fff8000000000= 000000000000000000000000000000000020000000000000000000000000000000000000000= 000000000000000000000000000000000000000000000000000000000000000000000000000= 000000000000000002008000000000000000000000000000000000000000000000000000000= 0000000080000000000fde67f00002d902240424420fef37e40fde615000000000000000000= 000000100000c00 [remote] Sending packet: $m10007828,4#67 [remote] Packet received: 2c030000 [remote] Sending packet: $m10007824,4#63 [remote] Packet received: 480556bd [remote] Sending packet: $m10007828,4#67 [remote] Packet received: 2c030000 [remote] Sending packet: $m10007824,4#63 [remote] Packet received: 480556bd [remote] Sending packet: $m7fa61a80,40#2b [remote] Packet received: 000000017fa61ab800000000000010007fa61ab010006b2c000000000000000000011000000= 0000000001000010000007fa62ae01000683c0000000000000000 fd=3D0x1e, fd@entry=3D0x1, buf=3Dbuf@entry=3D0x7fa61ab8, nbytes=3Dnbytes@entry=3D0x1000) at ../sysdeps/unix/sysv/linux/write.c:26 26 in ../sysdeps/unix/sysv/linux/write.c Now attempting the same thing on a running daemon (gdb) attach 1285 Attaching to program: /usr/sbin/modbusd, process 1285 [remote] Sending packet: $vAttach;505#a0 [remote] Packet received: T0001:7fc44e50;40:0f69ec74;thread:p505.505;core:2= ; [remote] packet_ok: Packet vAttach (attach) is supported [remote] Sending packet: $qXfer:exec-file:read:505:0,1000#b3 [remote] Packet received: l/usr/sbin/modbusd [remote] Sending packet: $qC#b4 [remote] Packet received: QCp505.505 [remote] Sending packet: $Hgp505.505#81 [remote] Packet received: OK ... lots of output skipped [remote] Packet received: l\n\n\n\n\n\n\n\n\n\n [New Thread 1285.1297] [New Thread 1285.1298] [New Thread 1285.1300] [New Thread 1285.1301] [New Thread 1285.1302] [New Thread 1285.1303] [New Thread 1285.1420] Thread 1 "modbusd" stopped. [remote] Sending packet: $mf69ec74,4#d5 [remote] Packet received: 7c000026 [remote] Sending packet: $mf69ec70,4#d1 [remote] Packet received: 44000002 [remote] Sending packet: $mf69ec74,4#d5 [remote] Packet received: 7c000026 [remote] Sending packet: $mf69ec70,4#d1 [remote] Packet received: 44000002 0x0f69ec74 in __GI___poll ([remote] Sending packet: $m7fc44e40,40#2e [remote] Packet received: 7fc44e700000000077a8cb78100035707fc44e700000000800000001ffffffff10031fb0000= 000080f92609c100358207fc44eb00f834ca8ffffffff7fffffff [remote] Sending packet: $g#67 [remote] Packet received: 000000a77fc44e5077a81aa00000020400000008ffffffff000000380000001800000001000= 000031003e56c7fc44e20440024841003827000000000000000000000000000000000000000= 0000000000000000000000000077a8cb78100035707fc44e780f841e9000000001000000001= 0031fb0000000080f7a37e4fffffffffff80000000000000000000000000000000000000000= 00000000000000000000000000000000000000000000000000003ff553f7000000000000000= 000000000000000000000000000000000000000000000000000000000000000000000000000= 00000000000000000000000000000000000000000000000000000000000000fff8000000000= 000000000000000000000000000000000000000000000000000000000000000000000000000= 000000000000000000000000000000000000000000000000000000000000000000000000000= 000000000000000002000000000000000000000000000000000000000000000000000000000= 0000000001000000010f69ec740002d902940024840f69ec5c0f87c49c20000000820240001= 0031fb000000c00 [remote] Sending packet: $mf834ca8,4#ce [remote] Packet received: 7c7b1b78 [remote] Sending packet: $mf834ca4,4#ca [remote] Packet received: 4e800421 [remote] Sending packet: $mf834ca8,4#ce [remote] Packet received: 7c7b1b78 [remote] Sending packet: $mf834ca4,4#ca [remote] Packet received: 4e800421 [remote] Sending packet: $m7fc44e80,40#32 [remote] Packet received: 7fc44e90000000010f92609c1003582077a8ba88000000007fc451fc7fc45214100358d8100= 358d40f92609c100358d07fc44ed00f835274880024847fc45214 fds=3D0x10031fb0, nfds=3D0x8, timeout=3D0xffffffff) at ../sysdeps/unix/sysv/linux/poll.c:29 29 ../sysdeps/unix/sysv/linux/poll.c: No such file or directory. (gdb) cont Continuing. [remote] Sending packet: $Z0,77a40770,4#e7 [remote] Packet received: OK [remote] Sending packet: $vCont;c:p505.-1#78 [remote] wait: enter [remote] wait: exit ^C[remote] pass_ctrlc: enter [remote] interrupt: enter [remote] interrupt: exit [remote] pass_ctrlc: exit I think one of the key differences is the fact that the 2nd process I connected to has multiple threads. I'm not sure if I've got another (on-busybox) daemon that doesn't use threads.