Rocksolid Light

Welcome to Rocksolid Light

mail  files  register  newsreader  groups  login

Message-ID:  

The test of intelligent tinkering is to save all the parts. -- Aldo Leopold


devel / Programming / (C++) My gdb went wrong

SubjectAuthor
o (C++) My gdb went wrongAnonymous

1
(C++) My gdb went wrong

<ae81fb4fa6e81a8aeb6cfa952505f481@news.novabbs.org>

  copy mid

https://news.novabbs.org/devel/article-flat.php?id=627&group=rocksolid.programming#627

  copy link   Newsgroups: rocksolid.programming
Path: i2pn2.org!.POSTED.novabbs-org!not-for-mail
From: Anonymous@news.novabbs.org (Anonymous)
Newsgroups: rocksolid.programming
Subject: (C++) My gdb went wrong
Date: Tue, 4 Jan 2022 16:15:33 +0000
Organization: Rocksolid Light
Message-ID: <ae81fb4fa6e81a8aeb6cfa952505f481@news.novabbs.org>
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 8bit
Injection-Info: i2pn2.org; posting-account="novabbs.org"; posting-host="novabbs-org:10.136.143.187";
logging-data="18622"; mail-complaints-to="usenet@i2pn2.org"
User-Agent: Rocksolid Light (www.novabbs.com/getrslight)
X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on novabbs.org
X-Rslight-Site: $2y$10$bWK6U5fpmFyanmeAVMEgoegt2rHLuJfKcIBTWwr1Ab.ugSneG81n2
 by: Anonymous - Tue, 4 Jan 2022 16:15 UTC

In the following code line 7, q[0] should be 1, but gdb claim that q[0] = 0. Can you plz explain what happened? It's GNU gdb (GDB) 11.1

(gdb) list
1 #include <cstdio>
2 #include <deque>
3
4 int main() {
5 std::deque<int> q;
6 q.push_front(1);
7 printf("%dn", q[0]);
8 return 0;
9 }
(gdb) b 7
Breakpoint 1 at 0x1227: file /tmp/a.cpp, line 7.
(gdb) r
Starting program: /tmp/a

Breakpoint 1, main () at /tmp/a.cpp:7
7 printf("%dn", q[0]);
(gdb) p q[0]
$1 = 0
(gdb) n
1 8 return 0;
quit)
A debugging session is active.

Inferior 1 [process 115399] will be killed.

Quit anyway? (y or n) y

--
Posted on Rocksolid Light

1
server_pubkey.txt

rocksolid light 0.9.81
clearnet tor