Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8615483
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T05:23:20+00:00 2026-06-12T05:23:20+00:00

I’ve been having this problem for while now, but always seem to put off

  • 0

I’ve been having this problem for while now, but always seem to put off asking this question because it seems like I am doing something wrong… but right now I feel otherwise… taken this code:

#include <string>
#include <iostream>
#include <algorithm>
int main(int argc, char** argv)
{
  if(argc < 2)
  {
    std::cout << "usage: " << argv[0] << " <string>" << std::endl;
    return 1;
  }
  std::string str = argv[1];
  std::reverse(str.begin(), str.end());
  std::cout << str << std::endl;
  return 0;
}

Compiled with the command:

g++ -std=c++11 -Wall main.cpp -o main -O0 -ggdb3

I am using a very recent trunk version of gcc, I the trunk was taken around September 23rd ish… Also note that I am not compiling with optimization!

Now anyway, I start debugging, like this:

gdb --quiet --args ./main string

I set a break point at line 12 (the reverse algorithm)

b 12

then I run the program

run

then I try to print out the string, to see what it is

print str

And this, my dear friends, is what seems strange to me:
The output of that previous command is:

No symbol "str" in current context.

a quick check to the local variables doesn’t show the string either

info locals

all I get is

std::__ioinit = {static _S_refcount = 2, static _S_synced_with_stdio = true}

so I’m wondering, am I at fault, or is the compiler or debugger at fault… this has been a pretty pain in the ass problem for a long time for me… so thanks for even reading this question… 🙂

EDIT: now that it has become clear that there is something wrong with my gcc build, I’m wondering if anyone has come across a bug report or any other case where there seems to a be a problem similar to this… I will also try checking with a recent build of gdb to make sure that there is definitely not a problem with my current debugger (that comes with ubuntu)… does that make sense?

EDIT2: So after compiling gdb v7.5, I got relatively the same result except there were no locals present at all… I guess that means it’s a gcc issue, thanks everyone…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T05:23:21+00:00Added an answer on June 12, 2026 at 5:23 am

    No, even with –quiet it works for me. Maybe there’s something wrong with your setup.

    ~/tmp $ g++ -Wall tmp.cpp -o tmp -O0 -ggdb3
    ~/tmp $ gdb --quiet --args ./tmp string
    Reading symbols from /xxxxxxxx/tmp...done.
    (gdb) b 12
    Breakpoint 1 at 0x400c95: file tmp.cpp, line 12.
    (gdb) run
    Starting program: /xxxxxxxx/tmp string
    Breakpoint 1, main (argc=2, argv=0x7fffffffdc58) at tmp.cpp:12
    12        std::reverse(str.begin(), str.end());
    (gdb) print str
    $1 = "string"
    (gdb) info locals
    str = "string"
    (gdb)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This could be a duplicate question, but I have no idea what search terms
I have a jquery bug and I've been looking for hours now, I can't
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I want to count how many characters a certain string has in PHP, but
For some reason, after submitting a string like this Jack’s Spindle from a text
I have this code to decode numeric html entities to the UTF8 equivalent character.
I have a French site that I want to parse, but am running into

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.