From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 70504 invoked by alias); 16 Jan 2020 14:54:00 -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 70496 invoked by uid 89); 16 Jan 2020 14:54:00 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-6.0 required=5.0 tests=AWL,BAYES_50,SPF_SOFTFAIL autolearn=no version=3.3.1 spammy=HTo:U*gdb, HX-Spam-Relays-External:2607, 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 14:53:50 +0000 Received: from fencepost.gnu.org ([2001:470:142:3::e]:57424) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1is6Wq-0004W2-EQ for gdb@sourceware.org; Thu, 16 Jan 2020 09:53:48 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:54411) by fencepost.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1is6Wp-0003Jy-Ob for gdb@gnu.org; Thu, 16 Jan 2020 09:53:48 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1is6Wo-0004RP-M0 for gdb@gnu.org; Thu, 16 Jan 2020 09:53:47 -0500 Received: from mail-qv1-xf34.google.com ([2607:f8b0:4864:20::f34]:35884) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1is6Wo-0004Pn-Fw for gdb@gnu.org; Thu, 16 Jan 2020 09:53:46 -0500 Received: by mail-qv1-xf34.google.com with SMTP id m14so9165839qvl.3 for ; Thu, 16 Jan 2020 06:53:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-language:content-transfer-encoding; bh=5NKd0oAJM+Na80e4unbHom/ddZUEQiOXNg3loF5Vnlk=; b=bwqp4HA1jiGJivCwfRPuk/ucxkRzWxCYXOVOgMWFJXFBevYJuljHpKdeFNZttv2wfg ZpoAwGMAQ+2BBd+rrWG+5bqf4J2XrzuZXeAKeUQO4BGvkgl/1BB97rP5ZnxWKzUkFOLF hGfiVeT59kSe3qdlApxKiIDvTXnzAY8g6v4yjb36iBC8mHUdB4A0D0wyM0c/GBd4K7nO t2hZ580TJFUbHYkg20dzd8MHimOwzIK3jsNYGIWFLLu2fYrZ/FSuu2qzOwlo5jZ7emc5 JzlfGjUVgwS8FjQY6kVgJZq24muUAbLXREL46PP6W8c7nSBdwHpbmgsDGrnm74CMoh2N IJlQ== Received: from [192.168.0.185] ([191.34.153.145]) by smtp.gmail.com with ESMTPSA id l49sm11518868qtk.7.2020.01.16.06.53.43 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 16 Jan 2020 06:53:44 -0800 (PST) Subject: Re: How to set a breakpoint on imported Win32 function? To: Ruslan Kabatsayev , gdb@gnu.org References: From: Luis Machado Message-ID: <4d48b93e-6ae7-2f27-1b2e-9e06899bec6d@linaro.org> Date: Thu, 16 Jan 2020 14:54:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.2.2 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2607:f8b0:4864:20::f34 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/msg00021.txt.bz2 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?