From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 60557 invoked by alias); 16 Jan 2020 17:17:28 -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 60548 invoked by uid 89); 16 Jan 2020 17:17:28 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=1.7 required=5.0 tests=BAYES_50,FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FROM,SPF_SOFTFAIL autolearn=no version=3.3.1 spammy=HX-Spam-Relays-External:2607, H*RU:f8b0, HX-Spam-Relays-External:f8b0, H*RU:2607 X-HELO: eggs.gnu.org Received: from eggs.gnu.org (HELO eggs.gnu.org) (209.51.188.92) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 16 Jan 2020 17:17:18 +0000 Received: from fencepost.gnu.org ([2001:470:142:3::e]:60273) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1is8lg-000799-Gx for gdb@sourceware.org; Thu, 16 Jan 2020 12:17:16 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:54052) by fencepost.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1is8lg-0003b0-6f for gdb@gnu.org; Thu, 16 Jan 2020 12:17:16 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1is8lf-00078G-2C for gdb@gnu.org; Thu, 16 Jan 2020 12:17:16 -0500 Received: from mail-io1-xd2d.google.com ([2607:f8b0:4864:20::d2d]:46615) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1is8le-00077j-Rm for gdb@gnu.org; Thu, 16 Jan 2020 12:17:15 -0500 Received: by mail-io1-xd2d.google.com with SMTP id t26so22767333ioi.13 for ; Thu, 16 Jan 2020 09:17:14 -0800 (PST) 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=jMT6Em72LEocwYEq1FRt7yOxYu3YF48SyRXH2tW0pEs=; b=ZI+GtQI8HWmE8XnHkLllfls+e6kWPAFsUqTmUuMApc0eeIEHqkeXt0GAAWMW8CD3MV VhlIgbsUwpFWnzeeIO324cjFDfCPUdpoRgAaGTRNcn21Y/ffxf23ciZfr4w9vkdp84y6 h/7zaQtCBuOlMx7/fcFmPBVVoA2kYcJcOMpGy6dqjovCPrt+0iEh0PFoqwwyM8+Fo5IA Y9jQryyOHKXjFQDrXiTuT+niF+1vLHZDCBnJgpwfyEa7qXdQkD7FyB4v+oIAsWYQmB/9 MrXR3K0uEeYSRt8H0/Bd68NgywGJGJ891s/sRSVGnKSmFWlaJ7vBPPn/PWryX0Yxjb3U idTA== MIME-Version: 1.0 References: <4d48b93e-6ae7-2f27-1b2e-9e06899bec6d@linaro.org> In-Reply-To: <4d48b93e-6ae7-2f27-1b2e-9e06899bec6d@linaro.org> From: Ruslan Kabatsayev Date: Thu, 16 Jan 2020 17:17:00 -0000 Message-ID: Subject: Re: How to set a breakpoint on imported Win32 function? To: Luis Machado Cc: gdb@gnu.org Content-Type: text/plain; charset="UTF-8" X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::d2d X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-IsSubscribed: yes X-SW-Source: 2020-01/txt/msg00022.txt.bz2 On Thu, 16 Jan 2020 at 17:53, Luis Machado wrote: > > On 1/15/20 7:42 PM, Ruslan Kabatsayev wrote: > > Hello, > > > > I have a program without any debug info, which has an import table > > with some functions imported by name. E.g. kernel32!ExitProcess is > > imported, and the debugger should know its name and address. > > > > But whenever I run GDB (from mingw-w64) with my test exe and try to > > set breakpoint on ExitProcess, GDB complains that no symbol table is > > loaded and asks if I want it set on future library load. After I agree > > and let the debuggee run, the debuggee exits without any trap > > (although it does exit via this exact function). > > > > OTOH, on Linux I can set a breakpoint on e.g. exit, which gets located > > in /lib/i386-linux-gnu/libc.so.6 for which I don't have any debug > > symbols, and the breakpoint successfully traps. > > > > So, how can I set a breakpoint on an imported function in Windows? Or > > is the handling of PE import table to fill GDB's symbol table not > > implemented? > > > > Thanks, > > Ruslan > > > > Given what you described, i think GDB doesn't know how to properly > locate that symbol. Can you at least see the symbol somewhere, in > disassemble output for example? No, apparently GDB doesn't indeed know about this symbol. The disassembly (both at the call site and in the function itself) simply shows the address, without any hints about symbols. Has this ever worked on Windows GDB? Or was it simply not implemented?