public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug macros/30239] New: gdb can't print '__INT_MAX__' in '<limits.h>' when debugging c program,but lldb can
@ 2023-03-17 11:16 czgf2v at 163 dot com
2023-03-17 14:22 ` [Bug macros/30239] " ssbssa at sourceware dot org
2023-03-17 15:16 ` tromey at sourceware dot org
0 siblings, 2 replies; 3+ messages in thread
From: czgf2v at 163 dot com @ 2023-03-17 11:16 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=30239
Bug ID: 30239
Summary: gdb can't print '__INT_MAX__' in '<limits.h>' when
debugging c program,but lldb can
Product: gdb
Version: 12.1
Status: UNCONFIRMED
Severity: normal
Priority: P2
Component: macros
Assignee: unassigned at sourceware dot org
Reporter: czgf2v at 163 dot com
Target Milestone: ---
Flags: security?
my current software version
```bash
$ cpp --version
cpp (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0
$ gcc --version
gcc (Ubuntu 11.3.0-1ubuntu1~22.04) 11.3.0
```
recently, I upgrade ubuntu from 20 to 22, then the possible bug occurs.
basic.c
```cpp
#include <stddef.h>
#include <stdlib.h>
#include <stdio.h>
#include <assert.h>
#include <limits.h>
int main(int argc, char* argv[]){
int* basic = malloc(sizeof(int));
*basic = INT_MIN;
*basic = INT_MAX;
*basic+=1;
free(basic);
return 0;
}
```
I compiled by `gcc -gdwarf-5 -g3 -ggdb3 basic.c -o basic` similar to this
[issue](https://sourceware.org/bugzilla/show_bug.cgi?id=29725)
but run gdb `gdb ./basic -ex 'br 11' -ex 'r' -ex 'p __INT_MAX__' -ex 'p
INT_MAX'`
output
```
No symbol "__INT_MAX__" in current context.
No symbol "INT_MAX" in current context.
```
in ubuntu 20 I can get "__INT_MAX__" printed but I forgot my env info like
software version in ubuntu 20.
but in `lldb ./basic -o 'breakpoint set -l 11' -o 'r' -o 'p INT_MIN'` with
`(int) $0 = -2147483648` output
with `cpp` `INT_MAX` is truly defined
```bash
$ cpp -dM basic.c | grep INT_MAX
#define __WINT_MAX__ 0xffffffffU
#define INT_MAX __INT_MAX__
#define INT_MIN (-INT_MAX - 1)
#define __INT_MAX__ 0x7fffffff
#define UINT_MAX (INT_MAX * 2U + 1U)
```
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug macros/30239] gdb can't print '__INT_MAX__' in '<limits.h>' when debugging c program,but lldb can
2023-03-17 11:16 [Bug macros/30239] New: gdb can't print '__INT_MAX__' in '<limits.h>' when debugging c program,but lldb can czgf2v at 163 dot com
@ 2023-03-17 14:22 ` ssbssa at sourceware dot org
2023-03-17 15:16 ` tromey at sourceware dot org
1 sibling, 0 replies; 3+ messages in thread
From: ssbssa at sourceware dot org @ 2023-03-17 14:22 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=30239
Hannes Domani <ssbssa at sourceware dot org> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |ssbssa at sourceware dot org
--- Comment #1 from Hannes Domani <ssbssa at sourceware dot org> ---
I'm pretty sure that's the same as PR29606, which is already fixed in gdb-13.
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Bug macros/30239] gdb can't print '__INT_MAX__' in '<limits.h>' when debugging c program,but lldb can
2023-03-17 11:16 [Bug macros/30239] New: gdb can't print '__INT_MAX__' in '<limits.h>' when debugging c program,but lldb can czgf2v at 163 dot com
2023-03-17 14:22 ` [Bug macros/30239] " ssbssa at sourceware dot org
@ 2023-03-17 15:16 ` tromey at sourceware dot org
1 sibling, 0 replies; 3+ messages in thread
From: tromey at sourceware dot org @ 2023-03-17 15:16 UTC (permalink / raw)
To: gdb-prs
https://sourceware.org/bugzilla/show_bug.cgi?id=30239
Tom Tromey <tromey at sourceware dot org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|UNCONFIRMED |RESOLVED
CC| |tromey at sourceware dot org
Resolution|--- |DUPLICATE
--- Comment #2 from Tom Tromey <tromey at sourceware dot org> ---
(In reply to Hannes Domani from comment #1)
> I'm pretty sure that's the same as PR29606, which is already fixed in gdb-13.
Agreed. Also I tried it on Fedora 36 with a newer gdb & it works for me.
*** This bug has been marked as a duplicate of bug 29606 ***
--
You are receiving this mail because:
You are on the CC list for the bug.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-03-17 15:16 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-17 11:16 [Bug macros/30239] New: gdb can't print '__INT_MAX__' in '<limits.h>' when debugging c program,but lldb can czgf2v at 163 dot com
2023-03-17 14:22 ` [Bug macros/30239] " ssbssa at sourceware dot org
2023-03-17 15:16 ` tromey at sourceware dot org
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).