From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8980 invoked by alias); 29 Oct 2018 17:28:36 -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 Received: (qmail 8961 invoked by uid 89); 29 Oct 2018 17:28:34 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,KAM_SHORT,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy=H*r:sk:gdb@sou, transfers, listening, online X-HELO: mail-wr1-f41.google.com Received: from mail-wr1-f41.google.com (HELO mail-wr1-f41.google.com) (209.85.221.41) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 29 Oct 2018 17:28:32 +0000 Received: by mail-wr1-f41.google.com with SMTP id 74-v6so1396656wrb.13 for ; Mon, 29 Oct 2018 10:28:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=undo-io.20150623.gappssmtp.com; s=20150623; h=date:from:to:subject:message-id:mime-version:content-disposition :user-agent; bh=VirO9UiAu5tVL2Njq/eHT+YCE/npVIuLaNmlYAEw+jg=; b=BxSNPlNl1xOpO7Fv+pcjm8s2f3HBpTglI648Clm12dkRAuGpro9o5QngVADZeBgIcD gxWqnHc7AX5Jgu55I/YuEWWKgKL8svJFSy65sj3pL0NyFuII3AMcTD6miikmtzLLSV2e /i+b9Cr7/kqIRVXKnEZFnb/lRTKpxmfZof8IUAKdBQlRYMPWg5TYFiOr9Aqw3eQzuv// HwwXJ9gCiHrxUUn2Dday3yfbSIrB/JwbicuZ62ow2PSSyByGW2BzmS5UyhvU5jCIS0tJ iGyaBFxg5Ft6VKf0v2o2yIKBQABZ+3bQJjQB7HA974ZQf1Ml9gxWttQvMOwAeQzWa2Z9 P67g== Return-Path: Received: from undo-autkin ([109.159.206.110]) by smtp.gmail.com with ESMTPSA id k4-v6sm5414677wro.68.2018.10.29.10.28.28 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 29 Oct 2018 10:28:28 -0700 (PDT) Date: Mon, 29 Oct 2018 17:28:00 -0000 From: Andrey Utkin To: gdb@sourceware.org Subject: set sysroot rescans, but only if run twice Message-ID: <20181029172827.GC16467@undo-autkin> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.10.1 (2018-07-13) X-IsSubscribed: yes X-SW-Source: 2018-10/txt/msg00061.txt.bz2 Hi, I would appreciate some explanation of how "set sysroot" is supposed to work. I almost got an impression that it is supposed to rescan "all known binaries" (just like "set solib-search-path"), besides other things. This seems to happen in most of cases, but apparently not in every case. For example, let's create a remote debugging session with localhost, and then set sysroot to / . My expectation was that the backtrace would have all information after "set sysroot /", but it was not the case. However, a second "set sysroot /" did it. "Insanity is repeating the same and expecting different results", right? Say, we attach gdbserver to some trivial process like "sleep": $ sleep 500h & [1] 2757 $ gdbserver --attach :5555 $! Attached; pid = 2757 Listening on port 5555 Remote debugging from host 127.0.0.1 Then we attach to gdbserver: $ gdb GNU gdb (Gentoo 8.2 vanilla) 8.2 Copyright (C) 2018 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-pc-linux-gnu". Type "show configuration" for configuration details. For bug reporting instructions, please see: . Find the GDB manual and other documentation resources online at: . For help, type "help". Type "apropos word" to search for commands related to "word". (gdb) target remote :5555 Remote debugging using :5555 Reading /bin/sleep from remote target... warning: File transfers from remote targets can be slow. Use "set sysroot" to access files locally instead. Reading /bin/sleep from remote target... Reading symbols from target:/bin/sleep...Reading /bin/sleep.debug from remote target... Reading /bin/.debug/sleep.debug from remote target... Reading symbols from /usr/lib/debug/bin//sleep.debug...done. done. Reading /lib64/libc.so.6 from remote target... Reading /lib64/ld-linux-x86-64.so.2 from remote target... Reading symbols from target:/lib64/libc.so.6...done. Reading symbols from target:/lib64/ld-linux-x86-64.so.2...done. Reading /lib64/ld-linux-x86-64.so.2 from remote target... 0x00007f7277f8d495 in __GI___nanosleep (requested_time=requested_time@entry=0x7ffef6d02e40, remaining=remaining@entry=0x0) at ../sysdeps/unix/sysv/linux/nanosleep.c:27 27 ../sysdeps/unix/sysv/linux/nanosleep.c: No such file or directory. (gdb) bt #0 0x00007f7277f8d495 in __GI___nanosleep (requested_time=requested_time@entry=0x7ffef6d02e40, remaining=remaining@entry=0x0) at ../sysdeps/unix/sysv/linux/nanosleep.c:27 #1 0x000056334afe81c3 in rpl_nanosleep (requested_delay=requested_delay@entry=0x7ffef6d02e80, remaining_delay=remaining_delay@entry=0x0) at lib/nanosleep.c:85 #2 0x000056334afe7fbd in xnanosleep (seconds=) at lib/xnanosleep.c:51 #3 0x000056334afe5be8 in main (argc=2, argv=0x7ffef6d02fe8) at src/sleep.c:150 (gdb) file /bin/sleep A program is being debugged already. Are you sure you want to change the file? (y or n) y Load new symbol table from "/bin/sleep"? (y or n) y Reading symbols from /bin/sleep...Load new symbol table from "/usr/lib/debug//bin/sleep.debug"? (y or n) y Reading symbols from /usr/lib/debug//bin/sleep.debug...done. done. (gdb) bt #0 0x00007f7277f8d495 in __GI___nanosleep (requested_time=0x7ffef6d02e40, remaining=0x0) at ../sysdeps/unix/sysv/linux/nanosleep.c:27 #1 0x000056334afe81c3 in ?? () #2 0x00000000001b7740 in ?? () #3 0x0000000000000000 in ?? () (gdb) show remote exec-file (null) (gdb) set remote exec-file /bin/sleep (gdb) bt #0 0x00007f7277f8d495 in __GI___nanosleep (requested_time=0x7ffef6d02e40, remaining=0x0) at ../sysdeps/unix/sysv/linux/nanosleep.c:27 #1 0x000056334afe81c3 in ?? () #2 0x00000000001b7740 in ?? () #3 0x0000000000000000 in ?? () (gdb) set sysroot / (gdb) bt #0 0x00007f7277f8d495 in ?? () #1 0x00007f727845c480 in ?? () #2 0x00007ffef6d02e70 in ?? () #3 0x00000000001b7740 in ?? () #4 0x3e01475224fd8c00 in ?? () #5 0x0000000000000010 in ?? () #6 0x000056334afe81c3 in rpl_nanosleep (requested_delay=requested_delay@entry=0x7ffef6d02e80, remaining_delay=remaining_delay@entry=0x0) at lib/nanosleep.c:85 #7 0x000056334afe7fbd in xnanosleep (seconds=) at lib/xnanosleep.c:51 #8 0x000056334afe5be8 in main (argc=2, argv=0x7ffef6d02fe8) at src/sleep.c:150 (gdb) set sysroot / Reading symbols from /lib64/libc.so.6...done. Reading symbols from /lib64/ld-linux-x86-64.so.2...done. (gdb) bt #0 0x00007f7277f8d495 in __GI___nanosleep (requested_time=requested_time@entry=0x7ffef6d02e40, remaining=remaining@entry=0x0) at ../sysdeps/unix/sysv/linux/nanosleep.c:27 #1 0x000056334afe81c3 in rpl_nanosleep (requested_delay=requested_delay@entry=0x7ffef6d02e80, remaining_delay=remaining_delay@entry=0x0) at lib/nanosleep.c:85 #2 0x000056334afe7fbd in xnanosleep (seconds=) at lib/xnanosleep.c:51 #3 0x000056334afe5be8 in main (argc=2, argv=0x7ffef6d02fe8) at src/sleep.c:150 (gdb)