Re: [RFC PATCH 0/3] Pretty-printing for errno

Pedro Alves
2017-07-13T02:30:47Z

On 06/30/2017 07:11 PM, Pedro Alves wrote:
> On 06/30/2017 06:27 PM, Zack Weinberg wrote:
>> Pedro Alves wrote:
>>> The next problem is that without debug info for __errno_location,
>>> gdb has no clue of its prototype, only that its a function, and so
>>> it assumes that it has type "int()", i.e., that it returns int,
>>> while in reality it returns int * / __error_t *. (Falling back
>>> to assuming "int" is IMO not the best idea, but I don't know
>>> the history behind it.)
>>
>> Probably because that's the pre-C89 legacy default function signature?
>
> Yes, most likely.

FYI, shortly after this discussion, yet another user showed up
on #gdb confused by "p getenv("PATH") returning weird negative
integer numbers [because he had no debug info for getenv...], so I
decided to do something about it. I've now sent a patch series
that stops GDB from assuming no-debug-info symbols have
type int:

[PATCH 00/13] No-debug-info debugging improvements
https://sourceware.org/ml/gdb-patches/2017-07/msg00112.html

Comments welcome.

Thanks,
Pedro Alves