Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp7002138ybi; Thu, 13 Jun 2019 08:00:16 -0700 (PDT) X-Google-Smtp-Source: APXvYqxD2riuNs0FkXa/EItVNmCrCBJsvptkAtgVum/Lb4SQ4etiDQs8P9mMj3VaE1coHvI6nhMa X-Received: by 2002:aa7:8555:: with SMTP id y21mr36883757pfn.104.1560438016394; Thu, 13 Jun 2019 08:00:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560438016; cv=none; d=google.com; s=arc-20160816; b=IxJ5NyvmkI4KcFOEPmtZE9YNhbgIzuW0TDGxDSCWAeWxL8QidmFSkN97kO9lOVgfpX dGh8kOQWghqBg8fqdbK2eHEoqGML0aITDfznzPJsggfHndiC8os5tE1pwguT9ur8Zbb1 kERa0SZXxAqLx02Kxq/yfoAOlxIhwDaCMdpbcAX+agaj52/RvdxrciDiJ1c6Dgs4c/V/ 23UzKrG1POa0JIOK4Qi9avrPkFX3W7iWNM1uN8YHXKgWCcd8wEY9XRaTe9XVvsRNoCI/ cJclY+bIhT2yw7N7iynhX2FK4F4jSJtv7OAl+RfvvtYslyzZsVlDCp3qkc3w+jXbL+gm /PMQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=V+yDsP1w6a5l/+u0u89gIJIvGqAKvFSmmikVgpJYGog=; b=C0E09WMwgHMsV0LhCO6P9615XdgUcSm4qRAWLLydefeShMrEzst2AgjcfqZrVx+NYO kgUKDTeCmRw7OfrFJc6bqKksuTxC4D/Y9VquZf6bGnXJ4iykNJkw3bfeUUnowHHjQJiw Q6DSmZ9zThpoI8iDv2r7wHJb3CTeuMX9ZUvsD92pTp6Wn/Cz6cdP3odHMs2oFThgBbia iB26Bo8+SwyMRub6/YmMVEG+1dKYSbvoX9JhiKtSrfJAbFZyRdScRTvJG5atOrzf0abB GUqtStLi1tkWDHlxeGAdwYSTItW6Ci/fAY65iUOVcz4WDKPNfGLXG7NQM2wy9rLUfvYz 0okg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ZtbU3TV6; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z9si15001pjn.2.2019.06.13.07.59.54; Thu, 13 Jun 2019 08:00:16 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ZtbU3TV6; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732720AbfFMO71 (ORCPT + 99 others); Thu, 13 Jun 2019 10:59:27 -0400 Received: from mail-vs1-f44.google.com ([209.85.217.44]:43510 "EHLO mail-vs1-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732608AbfFMOxY (ORCPT ); Thu, 13 Jun 2019 10:53:24 -0400 Received: by mail-vs1-f44.google.com with SMTP id j26so892628vsn.10 for ; Thu, 13 Jun 2019 07:53:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=V+yDsP1w6a5l/+u0u89gIJIvGqAKvFSmmikVgpJYGog=; b=ZtbU3TV6qSNoRMZ2VnMKPMX/QZnnX8rJS1W4M8+Htte8DT5AAsttsM1tHdg8+BHLng oRWe7/VsZa9BRMDJ70ll3bHt6WYPd3jjKXj9UindCIGByvsyyfkJJugAf/EtZxlKAP43 2z4Xdpl+9HknjyJ9A6T+JLEJRaicMDSE2HP6j1369/Km8WOLPZDMOnF+88slRyvZf81z FG85xbJnW9pFc72eAePnMM/robHwdfcvlMgDMTVTTOyGRZxvqLagIN6YV4qx6EuXUNQC fCSTYSpqSrnLUH6EB64cnbFDTLC8wRG9ka3gJ8TSWgHzXRtjgGX9M/eXkfbN+wEx6afE kgkQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=V+yDsP1w6a5l/+u0u89gIJIvGqAKvFSmmikVgpJYGog=; b=HQp+7Jl6t3KL6vxy7t0wihNjtHowpCh5qji6KumJnrsocPxWDXpkUgpTFHMhsSFuwi +4Ra/HRT8q02n90mJLiDR9xW72b8TS3RScD58LIOBYwkiczAL7b6YKJCFWVbjBnvoLCt xlu0jhNWZpxfGU6aDpq46uKJzTADSmVBXmWh2J9rc0yysgEyPKzC33men0YP9dLstr/K c0ImcxlmyVJZQd/TA8v/b7XFuWqKYZkckTVoj7Q72aFUOn5L4Gh7P64UwZTpCUMwNHyl 2JdxTF6BnqDrD7T/jqvFm+VQOnynCLhGIdIPhgdyaXDDMrB0hMLnt4LT2Wdsb324gYP0 IiHQ== X-Gm-Message-State: APjAAAX+t1JteL1MqOR09lQ5xmeaOsVAAWSqmZPAJOMFleT4Ry3Hf0GK g2il55oZrSm/quZ7i7xy6CarPZxA6jmRjesvxvg= X-Received: by 2002:a67:e419:: with SMTP id d25mr19945168vsf.196.1560437602879; Thu, 13 Jun 2019 07:53:22 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Pintu Agarwal Date: Thu, 13 Jun 2019 20:23:11 +0530 Message-ID: Subject: Re: Pause a process execution from external program To: Shyam Saini Cc: Kernelnewbies , open list , pedro@palves.net Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jun 13, 2019 at 1:22 PM Shyam Saini wrote: > > Hi Pintu, > > > > Hi All, > > I was just wondering if this is possible in the Linux world. > > My requirement is: > > For some reason, I want to halt/pause the execution (for some > > specified time) of a running process/thread (at some location), > > without modified the source, may be by firing some events/signals from > > an another external program, by specifying the address location or a > > line number. > > > > Is this possible ? > > May be by using some system call, or other mechanism using the process PID. > > Assume that its a debugging system with all root privileges. > > > > Basically, its just like how "gdb" is able to set the break-point in a > > program, and able to stop its execution exactly at that location. > > I am wondering what mechanism "gdb" uses to do this? > > gdb uses ptrace system call, may you can explore ptrace? > oh thank you so much. Yes, ptrace is going to be very helpful. I will explore more on this and come back if required. > > I tried to check here, but could find the exact place, where this is handled: > > https://github.com/bminor/binutils-gdb/blob/master/gdb/breakpoint.c > > from command line we use ctrl-z to stop execution of a foreground > process but you can program > SIGTSTP signal handler in your application code to do the same. > > is that you want ? > This required source code modification in the target program, so I don't want this. > Thanks a lot, > Shyam