Hi, I have define "char buffer[100]" in a C code. Trying to view the location of buffer in GDB, I see this (gdb) p &buffer[0] $1 = 0x7ffff7dd43e0 "" (gdb) x/30x 0x7ffff7dd43e0 0x7ffff7dd43e0 :    0x00000000    0x00000000    0x00000000    0x00000000 0x7ffff7dd43f0 :    0x00000000    0x00000000    0x00000000    0x00000000 0x7ffff7dd4400 <_dl_open_hook>:    0x00000000    0x00000000    0xffb51dd2    0xa7d1a586 0x7ffff7dd4410 <__vdso_getcpu>:    0xf5b51dd2    0xa7d1a586    0xffffdf28    0x00007fff 0x7ffff7dd4420 <__libc_argc>:    0x00000002    0x00000000    0x00000000    0x00000000 0x7ffff7dd4430 <__gconv_alias_db>:    0x00000000    0x00000000    0x00000000    0x00000000 0x7ffff7dd4440 <__gconv_modules_db>:    0x00000000    0x00000000    0x00000000    0x00000000 0x7ffff7dd4450 <__gconv_path_envvar>:    0x00000000    0x00000000 (gdb) p &buffer[99] $2 = 0x7ffff7dd4443 <__gconv_modules_db+3> "" (gdb) Why I don't see and similar things? Regards, Mahmood From gdb-return-46502-listarch-gdb=sources.redhat.com@sourceware.org Fri Jul 06 11:15:40 2018 Return-Path: Delivered-To: listarch-gdb@sources.redhat.com Received: (qmail 60353 invoked by alias); 6 Jul 2018 11:15:39 -0000 Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org Delivered-To: mailing list gdb@sourceware.org Received: (qmail 60117 invoked by uid 89); 6 Jul 2018 11:15:25 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-2.1 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,HTML_MESSAGE,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy=H*c:PHrt, H*RU:74.6.131.42, H*r:ip*74.6.131.42, Hx-spam-relays-external:74.6.131.42 X-HELO: sonic303-3.consmr.mail.bf2.yahoo.com Received: from sonic303-3.consmr.mail.bf2.yahoo.com (HELO sonic303-3.consmr.mail.bf2.yahoo.com) (74.6.131.42) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 06 Jul 2018 11:15:23 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t30875707; bh=+ICGq2jEUtXmsvF9xyTfTeCjwc3DbBVA4zAWywkNJY4=; hÚte:From:Reply-To:To:Subject:References:From:Subject; b=CqCbClKpGFo7/sF4YYcnspeI91Yjnglaie6on8o590BgQ8/qAnEt81GejXTlsMg1RkkTQmJeHguSqBVTv+hXSjD962oTSbEmW+HjN1TdVRoqoXh8fy4Ge62CicKF0bNI5Ldm2YXrVPo8rBAqyZZ7Rj0MwEjZSiBL4siYAIaReh6xV9/lfJYCXIzy2x6qrDahvJhk/0C7vym3gjs8v77XESaxGS9iSxlsUIKI5qjIQVY0MO+u5Dj3t7U5OuR+OUwdvb8xCF2GSQXkafivgVpI3d7us/gyI/Blnqmpj4RQialQwjWWgn8b2Yq59H0Ee1MtQ0/rqUFmasE5+8awpmwxYQ=Received: from sonic.gate.mail.ne1.yahoo.com by sonic303.consmr.mail.bf2.yahoo.com with HTTP; Fri, 6 Jul 2018 11:15:07 +0000 Date: Fri, 06 Jul 2018 11:15:00 -0000 From: "Mahmood Naderan via gdb" Reply-To: Mahmood Naderan Reply-To: Mahmood Naderan To: "gdb@sourceware.org" Message-ID: <1839186466.17059.1530875705518@mail.yahoo.com> Subject: debugging a callq command MIME-Version: 1.0 References: <1839186466.17059.1530875705518.ref@mail.yahoo.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes X-SW-Source: 2018-07/txt/msg00014.txt.bz2 Content-length: 2712 Hi, Trying to debug an assembly code with gdb, I see that a call function to a valid address exists but the control won't go to the target address. As you can see, the first instruction is a jmp to 0x7fffffffde7d and there, it will call 0x7fffffffde70. However, the next instruction is something else while the program receives seg fault. (gdb) nexti 0x00007fffffffde6e in ?? () 1: x/20i $pc => 0x7fffffffde6e:    jmp    0x7fffffffde7d    0x7fffffffde70:    pop    %rsi    0x7fffffffde71:    xor    %ecx,%ecx    0x7fffffffde73:    mov    $0x21,%cl    0x7fffffffde75:    xorb   $0x35,(%rsi)    0x7fffffffde78:    rex.RX loop 0x7fffffffde75    0x7fffffffde7b:    jmp    0x7fffffffde82    0x7fffffffde7d:    callq  0x7fffffffde70    0x7fffffffde82:    pop    %rdi    0x7fffffffde83:    jae    0x7fffffffdef2 (gdb) nexti 0x00007fffffffde6e in ?? () 1: x/20i $pc => 0x7fffffffde6e:    jmp    0x7fffffffde7d    0x7fffffffde70:    pop    %rsi    0x7fffffffde71:    xor    %ecx,%ecx    0x7fffffffde73:    mov    $0x21,%cl    0x7fffffffde75:    xorb   $0x35,(%rsi)    0x7fffffffde78:    rex.RX loop 0x7fffffffde75    0x7fffffffde7b:    jmp    0x7fffffffde82    0x7fffffffde7d:    callq  0x7fffffffde70    0x7fffffffde82:    pop    %rdi    0x7fffffffde83:    jae    0x7fffffffdef2 (gdb) nexti Program received signal SIGSEGV, Segmentation fault. 0x00007fffffffde8c in ?? () 1: x/20i $pc => 0x7fffffffde8c:    out    %eax,$0x5f    0x7fffffffde8e:    ds insl (%dx),%es:(%rdi)    0x7fffffffde90:    addr32 pop %rbp    0x7fffffffde92:    sbb    0x46(%rdi),%cl    0x7fffffffde95:    pop    %rbp    0x7fffffffde96:    pop    %rbp    0x7fffffffde97:    sbb    0x5c(%rdi),%dl What is happening there? Any idea? Regards, Mahmood From gdb-return-46503-listarch-gdb=sources.redhat.com@sourceware.org Fri Jul 06 11:31:08 2018 Return-Path: Delivered-To: listarch-gdb@sources.redhat.com Received: (qmail 57426 invoked by alias); 6 Jul 2018 11:30:59 -0000 Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org Delivered-To: mailing list gdb@sourceware.org Received: (qmail 56158 invoked by uid 89); 6 Jul 2018 11:30:29 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-2.8 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS autolearn=ham version=3.3.2 spammyºldwin, baldwin, sk:decr_af, sk:decr_pc X-HELO: mx1.redhat.com Received: from mx3-rdu2.redhat.com (HELO mx1.redhat.com) (66.187.233.73) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 06 Jul 2018 11:30:28 +0000 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 9AE16E9003; Fri, 6 Jul 2018 11:30:18 +0000 (UTC) Received: from [127.0.0.1] (ovpn04.gateway.prod.ext.ams2.redhat.com [10.39.146.4]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6D9857C21; Fri, 6 Jul 2018 11:30:17 +0000 (UTC) Subject: Re: RISC-V: decr_pc_after_break causing problems To: John Baldwin , Palmer Dabbelt , Jim Wilson , andrew.burgess@embecosm.com References: <95eb8848-182b-dab4-f9dc-298269885f53@FreeBSD.org> Cc: gdb@sourceware.org From: Pedro Alves Message-ID: Date: Fri, 06 Jul 2018 11:30:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.8.0 MIME-Version: 1.0 In-Reply-To: <95eb8848-182b-dab4-f9dc-298269885f53@FreeBSD.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-SW-Source: 2018-07/txt/msg00015.txt.bz2 Content-length: 299 On 07/05/2018 11:54 PM, John Baldwin wrote: > FWIW, my preference would be for the decr_after_pc_break match the hardware > which from my understanding of the thread means it should always be zero. Mine too, FWIW. PC adjustment is a source of trouble in ports that need it. Thanks, Pedro Alves