From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 75143 invoked by alias); 16 Jan 2020 18:14:16 -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 75073 invoked by uid 89); 16 Jan 2020 18:14:15 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-4.5 required=5.0 tests=AWL,BAYES_50,SPF_SOFTFAIL autolearn=no version=3.3.1 spammy=HX-Spam-Relays-External:2607, HX-Spam-Relays-External:f8b0, H*RU:2607, H*RU:f8b0 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 18:14:05 +0000 Received: from fencepost.gnu.org ([2001:470:142:3::e]:32909) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1is9ed-0003ak-OE for gdb@sourceware.org; Thu, 16 Jan 2020 13:14:03 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]:33263) by fencepost.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:256) (Exim 4.82) (envelope-from ) id 1is9ec-0005W3-Qu for gdb@gnu.org; Thu, 16 Jan 2020 13:14:03 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1is9eb-0003Wp-Lq for gdb@gnu.org; Thu, 16 Jan 2020 13:14:02 -0500 Received: from mail-qk1-x72f.google.com ([2607:f8b0:4864:20::72f]:33487) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1is9eb-0003WE-Er for gdb@gnu.org; Thu, 16 Jan 2020 13:14:01 -0500 Received: by mail-qk1-x72f.google.com with SMTP id d71so20070242qkc.0 for ; Thu, 16 Jan 2020 10:14:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=wQ+dYI7JnWb+j7O4OGxFXE0q8Lah3TsEl3zcq6qsu6Y=; b=ZkpumK0AYnI1XSzbpEWknkvNeMaVjx3L6sC2+5yLy4eMud7gDAKYwxCR8BYyLUHFIc 5kNntkOBQtRcdX0qCFRxcUmcw1yWkIry0zymc9RBcX7p5mqIoaC0lkO+QfTbjDkn1p7k 7dcUzneGmizgdVnacuU/nmGML9AEVtEz1Mii+iqIQRVRDmV5FRvQkoWL5mMDa+zx58fz pVIDtDJ8yaepbJ9/ye3yif/PCDcMCJbXz0b7qq0VwrJdEtsZxeYnqF2MlhbaeXWFEJ/n NYYgHS/cL7ozJ4SbyYouOL5eIJd1XkJpweWB2S1LiOdGJ8CdWcg/3VatZevsnxanhww6 0hMw== Received: from [192.168.0.185] ([191.34.153.145]) by smtp.gmail.com with ESMTPSA id f26sm11460873qtv.77.2020.01.16.10.13.57 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 16 Jan 2020 10:13:59 -0800 (PST) Subject: Re: How to set a breakpoint on imported Win32 function? To: Ruslan Kabatsayev Cc: gdb@gnu.org, Eli Zaretskii References: <4d48b93e-6ae7-2f27-1b2e-9e06899bec6d@linaro.org> From: Luis Machado Message-ID: <98c5e02a-9310-268d-3a0f-abe71b2dd47f@linaro.org> Date: Thu, 16 Jan 2020 18:14: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::72f 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/msg00023.txt.bz2 On 1/16/20 2:16 PM, Ruslan Kabatsayev wrote: > 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? > I'm not well versed in GDB on Windows, so i'm not so sure. It could be both. I've cc-ed Eli, who tends to touch more mingw stuff.