From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-f54.google.com (mail-wr1-f54.google.com [209.85.221.54]) by sourceware.org (Postfix) with ESMTPS id 07602384BC33 for ; Thu, 28 Jan 2021 18:27:07 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 07602384BC33 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=palves.net Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=alves.ped@gmail.com Received: by mail-wr1-f54.google.com with SMTP id q7so6371386wre.13 for ; Thu, 28 Jan 2021 10:27:06 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:from:to:references:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=dL2kFtc0e1RbstPK6nu7Mj4bww+4Xa6yNTMiac7WLOE=; b=J9GSfMWWDlv7DCvN0TqHxC9ACFZUW4o3kD9zRTjzFZZcmA7RDzih2d6j9It8yAv2/7 JPba9q8xYweG5MpzatJ5feNG6L47kmenHZBc0vdfUfryYVJdvP6A+cyjpK/WRmV6OhMS T9YAmszTaKaWnysniZerIFvEGSNyA3Rsk2ReEAWL9PyLXZmKrwL2STYokYzNM/ZCAEcD w6E6hksva9xRV3UCG3ik2pz4vyBCTw1244jGtO25Agq6C5/iiFPaU+ZwQifUebgbC9wi NALKLrcuZURamCKD3JT5OYsAi+lX6qENLD22XNAjJjwdPFyBBq54cMPATzW+LPMliPh+ 5uPQ== X-Gm-Message-State: AOAM533djOPJEUqKk1TYFZOAGtdd1sJBywGhxsjlxMc7xsocsJwvlCFd MmFll/cordm+FXdpHZET8LCRkGpzdsthKA== X-Google-Smtp-Source: ABdhPJzEwJ8T2YvBMUPpLC/MxKQzu7CZlBdunYCvqMX2UZ/zbBG/7iaWlqibIrc6/zempJIhtfyTKQ== X-Received: by 2002:a05:6000:188c:: with SMTP id a12mr410472wri.105.1611858425507; Thu, 28 Jan 2021 10:27:05 -0800 (PST) Received: from ?IPv6:2001:8a0:f91f:e900:642f:5bb0:6cba:b1bd? ([2001:8a0:f91f:e900:642f:5bb0:6cba:b1bd]) by smtp.gmail.com with ESMTPSA id g12sm6564435wmh.14.2021.01.28.10.27.03 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 28 Jan 2021 10:27:04 -0800 (PST) Subject: Re: How to display instructions around the current instuction? From: Pedro Alves To: gdb@sourceware.org References: Message-ID: <8ff04714-9feb-d13a-98e3-cede442e0eb8@palves.net> Date: Thu, 28 Jan 2021 18:27:03 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.6.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gdb@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 28 Jan 2021 18:27:08 -0000 On 27/01/21 23:12, Peng Yu via Gdb wrote: > Hi, > > The following command will disply instructions below the current > instructions. Is there a way to display around the current instruction > (e.g., 5 instructions above and 5 instructions below)? > > display/10i $rip > >From gdb/NEWS: ~~~~ *** Changes in GDB 7.12 * GDB now supports a negative repeat count in the 'x' command to examine memory backward from the given address. For example: ... (gdb) x/-5i 0x0000000000400580 0x40056a : mov %edi,-0x4(%rbp) 0x40056d : mov %rsi,-0x10(%rbp) 0x400571 : mov $0x40061c,%esi 0x400576 : mov $0x2a,%edi 0x40057b : callq 0x400536 ~~~~ There's also this: ~~~~ (gdb) help set disassemble-next-line Set whether to disassemble next source line or insn when execution stops. If ON, GDB will display disassembly of the next source line, in addition to displaying the source line itself. If the next source line cannot be displayed (e.g., source is unavailable or there's no line info), GDB will display disassembly of next instruction instead of showing the source line. If AUTO, display disassembly of next instruction only if the source line cannot be displayed. If OFF (which is the default), never display the disassembly of the next source line. (gdb) ~~~~