[PATCH 5/4] libbacktrace: improve getting debug information for loaded dlls

Björn Schäpers gcc@hazardy.de
Thu Jan 25 19:53:31 GMT 2024


Am 23.01.2024 um 23:37 schrieb Ian Lance Taylor:
> On Thu, Jan 4, 2024 at 2:33 PM Björn Schäpers <gcc@hazardy.de> wrote:
>>
>> Am 03.01.2024 um 00:12 schrieb Björn Schäpers:
>>> Am 30.11.2023 um 20:53 schrieb Ian Lance Taylor:
>>>> On Fri, Jan 20, 2023 at 2:55 AM Björn Schäpers <gcc@hazardy.de> wrote:
>>>>>
>>>>> From: Björn Schäpers <bjoern@hazardy.de>
>>>>>
>>>>> Fixes https://github.com/ianlancetaylor/libbacktrace/issues/53, except
>>>>> that libraries loaded after the backtrace_initialize are not handled.
>>>>> But as far as I can see that's the same for elf.
>>>>
>>>> Thanks, but I don't want a patch that loops using goto statements.
>>>> Please rewrite to avoid that.  It may be simpler to call a function.
>>>>
>>>> Also starting with a module count of 1000 seems like a lot.  Do
>>>> typical Windows programs load that many modules?
>>>>
>>>> Ian
>>>>
>>>>
>>>
>>> Rewritten using a function.
>>>
>>> If that is commited, could you attribute that commit to me (--author="Björn
>>> Schäpers <bjoern@hazardy.de>")?
>>>
>>> Thanks and kind regards,
>>> Björn.
>>
>> I noticed that under 64 bit libraries loaded with LoadLibrary were missing.
>> EnumProcessModules stated the correct number of modules, but did not fill the
>> the HMODULEs, but set them to 0. While trying to investigate I noticed if I do
>> the very same thing from main (in C++) I even got fewer module HMODULEs.
>>
>> So I went a different way. This detects all libraries correctly, in 32 and 64
>> bit. The question is, if it should be a patch on top of the previous, or should
>> they be merged, or even only this solution and drop the EnumProcessModules variant?
> 
> Is there any reason to use both patches?  Seems simpler to just use
> this one if it works.  Thanks.
> 
> Ian

This one needs the tlhelp32 header and its functions, which are (accoridng to 
the microsoft documentation) are only available since Windows XP rsp. Windows 
Server 2003.

If that's no problem, and in my opinion it shouldn't be, then I can basically 
drop patch 4 and rebase this one.

Kind regards,
Björn.


More information about the Gcc mailing list