Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp7102135ybi; Thu, 13 Jun 2019 09:34:50 -0700 (PDT) X-Google-Smtp-Source: APXvYqzjcRLi4zkSc1PRLgeOxahxCqoksPjTPmlothYXxQSr+tfUtRGCE35nYYkGclVs77swQX6Q X-Received: by 2002:a65:418d:: with SMTP id a13mr12224417pgq.332.1560443690357; Thu, 13 Jun 2019 09:34:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560443690; cv=none; d=google.com; s=arc-20160816; b=FGTvdL1IfIritxVCJitDb12dTacXw+3jodDVzCTQ+23kFAVqKc7ZZsRXQivOa64Ks9 o+Y//CKhg5k740aEPm2NPm1mxJliAq3ue+W653IxU6oaJtI2/YkN2s/VY/a5gYsXipvh PeNuPDTRp4UOBixN/QyunzC6fp1OSXigVmg8wvBr3U8Hb22huP6LTS6SKVqIW3bcZv4C 0S+ph15qhKDb6ijTGm2EG8ip23H0vHpRftLM9Q00Sqm/MG9TtEHrk1Y/K3eJnAu97ZPl vaiaxAbt1CPy0ooiCIoPvbjbzUiBI9AWZbtPRERB2A+P1nvXLaotxH9EklVw5mKc5Gx8 nU8g== 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=x7HLKRclBYkI4l8xezabyIsI1B9pbvnD70ysiff/Q9I=; b=rPmYzQCjihbgRNFBdbrfSSix7AUAG6BncQVTHYs7LlFnvkAvhnx9B7MaxCHBkkcmWZ NI624hsTTIoIIVfjNwOUtHRm+p9ZSWy3JF+EmPE3lnfKKBa0Ame+Wzzv9Ax36IVVoNtE cMdEaWsk5tXDC5YvXM7QyGs6x+om2i5lBjJr2FNTjyHIl2brKhprDZyWM0zFWVCIk7fB 2gsmKxoGBArth5TloQYUnvwDfmH2eaxlLnagh/pkfNzljUvLE544Fi2xDlz3h1bTFZXp TIRiWDlgXdOMbYdt6jw684BdoU3Z/w4iTlqh/u1NZvCekCuD95IDrwCN1nLeFEUR6i5l KRAg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=i2mhSEu3; 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 v204si153630pgb.80.2019.06.13.09.34.35; Thu, 13 Jun 2019 09:34:50 -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=i2mhSEu3; 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 S1733053AbfFMQe1 (ORCPT + 99 others); Thu, 13 Jun 2019 12:34:27 -0400 Received: from mail-ot1-f52.google.com ([209.85.210.52]:38021 "EHLO mail-ot1-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730775AbfFMHwY (ORCPT ); Thu, 13 Jun 2019 03:52:24 -0400 Received: by mail-ot1-f52.google.com with SMTP id d17so18064767oth.5 for ; Thu, 13 Jun 2019 00:52: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=x7HLKRclBYkI4l8xezabyIsI1B9pbvnD70ysiff/Q9I=; b=i2mhSEu3HULgbyY3/yHZx3wJfp9kSeVS6V90pgxEo1RvXXcUN2VbDcaukTCsYRJzlE eRz7XH+tRZJFjQaE5xBGY0gWA6cjEoSogRGArWjPbNilUgg35eQnVsBuLrgs2NtjXLJh w+xq5wE4Z6Sc/NAHILr8fPixyTflU0YR2cEEi0n8bo/6GESlRZ6f8ZiVmR0RxizFoeGB NKvM+7fe5os65B7BpoQv8nggL16sa3ceXec1kyI7HDzQPj2nLIdNy4VEZve+YODOGcuR 2ZJ/x1vEJR8L5k67sCIOG22Hz3J0CIV8aIW0rEHhELpxhyO9XzRMURwa3KPSb/81MZ80 sCfA== 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=x7HLKRclBYkI4l8xezabyIsI1B9pbvnD70ysiff/Q9I=; b=VAxv3k3Am1Xlm7oQhkR9CIJZoU8j1o5x/R2C/pEHW6kb1Sojto0D5hJt0jojPZ/Srd ccypZ56ThLSZkChN1j8pXnANm6Fy+4ATwSs14V4jMm4x0XmxYlZrf9I4IjN2QQ244wn1 K4gwmskfkvSRoqm9qdxmgoXs/xZqsrceUv4BEeUIjSR71DfCeQ7CiLZG9iNqAFTK/t14 rHTOtgGeecvwFdeaS55WxkU8zpv9cUu9qu4N0orcMm7P9VtltZHpPcOiToFVfONELQ5F GmW58BoHx+XEv/Dk0krrfQgPCLsluMLDJ3Y2r++pQHu/KjlXGnJgBtitzibZM2tKN58P 31dw== X-Gm-Message-State: APjAAAUwS8bFVVkrTEYe/S+c/ktNJSHaSLaQs0N5kNqYvZwRT6xzcIKU zfoBCRBrvrR6IDN6sR9qO9muJgTXJgmSYX96VAvfr6PhvFw= X-Received: by 2002:a9d:3f62:: with SMTP id m89mr43725442otc.128.1560412343351; Thu, 13 Jun 2019 00:52:23 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Shyam Saini Date: Thu, 13 Jun 2019 13:22:12 +0530 Message-ID: Subject: Re: Pause a process execution from external program To: Pintu Agarwal 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 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? > 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 ? Thanks a lot, Shyam