468,457 Members | 1,590 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,457 developers. It's quick & easy.

Does gdb show C++ source code?


I am running gdb on a C++ executable. The code that I wrote looks like
this:

itr = doc.GetFieldIterator();

while (itr.HasNext()) {
Field field = itr.Current();
// Console.WriteLine("Field name: {0}", field.GetName());
// printf("Field name: %s\n", (char *)field.GetName());
printf("Hola %d\n", i);
itr.Next();
i++;
}
However, gdb shows some very different code:

new_allocator() throw() { }
int i = 1;
inline Iterator() : mp_impl(0) {}
new_allocator() throw() { }
basic_string<_CharT, _Traits, _Alloc__str(__lhs);
inline PDFDoc::PDFDoc (const char* filepath) {
basic_string<_CharT, _Traits, _Alloc__str(__lhs);
{ return strlen(__s); }
Is there any way I can have gdb display higher level code?

TIA,

-RFH

Mar 6 '08 #1
11 3128
On Mar 6, 4:01 pm, Ramon F Herrera <ra...@conexus.netwrote:
I am running gdb on a C++ executable. The code that I wrote looks like
this:

itr = doc.GetFieldIterator();

while (itr.HasNext()) {
Field field = itr.Current();
// Console.WriteLine("Field name: {0}", field.GetName());
// printf("Field name: %s\n", (char *)field.GetName());
printf("Hola %d\n", i);
itr.Next();
i++;
}

However, gdb shows some very different code:

new_allocator() throw() { }
int i = 1;
inline Iterator() : mp_impl(0) {}
new_allocator() throw() { }
basic_string<_CharT, _Traits, _Alloc__str(__lhs);
inline PDFDoc::PDFDoc (const char* filepath) {
basic_string<_CharT, _Traits, _Alloc__str(__lhs);
{ return strlen(__s); }

Is there any way I can have gdb display higher level code?

TIA,

-RFH
Consult a GDB newsgroup, forum, after first consulting the manual. The
question is off topic here.
Mar 6 '08 #2
On Mar 6, 6:07 pm, Christopher <cp...@austin.rr.comwrote:
On Mar 6, 4:01 pm, Ramon F Herrera <ra...@conexus.netwrote:
I am running gdb on a C++ executable. The code that I wrote looks like
this:
itr = doc.GetFieldIterator();
while (itr.HasNext()) {
Field field = itr.Current();
// Console.WriteLine("Field name: {0}", field.GetName());
// printf("Field name: %s\n", (char *)field.GetName());
printf("Hola %d\n", i);
itr.Next();
i++;
}
However, gdb shows some very different code:
new_allocator() throw() { }
int i = 1;
inline Iterator() : mp_impl(0) {}
new_allocator() throw() { }
basic_string<_CharT, _Traits, _Alloc__str(__lhs);
inline PDFDoc::PDFDoc (const char* filepath) {
basic_string<_CharT, _Traits, _Alloc__str(__lhs);
{ return strlen(__s); }
Is there any way I can have gdb display higher level code?
TIA,
-RFH
Consult a GDB newsgroup, forum, after first consulting the manual. The
question is off topic here.

There is no such thing as a gdb newsgroup.

Are you saying that C++ developers do not know anything about gdb and
its applicability to C++ code?

I am sure a lot of people would like to disagree.

-RFH

Mar 6 '08 #3
Ramon F Herrera wrote:
On Mar 6, 6:07 pm, Christopher <cp...@austin.rr.comwrote:
Consult a GDB newsgroup, forum, after first consulting the manual.
The question is off topic here.


There is no such thing as a gdb newsgroup.
There are gcc newsgroups. You'd also probably be ok in
comp.unix.programmer, although I couldn't say for certain. I'd review
their FAQ if available.
Are you saying that C++ developers do not know anything about gdb and
its applicability to C++ code?
No, he's saying it's off-topic here. Please review the FAQ for
topicality guidelines.
I am sure a lot of people would like to disagree.
Some would. That's irrelevant. The group consensus is that
platform-specific topics, including tools such as compilers and
debuggers, are off-topic here.


Brian
Mar 6 '08 #4
On Mar 6, 7:23 pm, Christopher <cp...@austin.rr.comwrote:
Consult a GDB newsgroup, forum, after first consulting the manual. The
question is off topic here.
There is no such thing as a gdb newsgroup.
Not my problem. Learn how to research for information.
And your opinions are not my problem, either.

YOU ARE the one off topic, here. You have obvious control issues. Any
psychiatrist will tell you that.

Haven't you heard of a newsgroup called comp.lang.c++.MODERATED? Apply
for a moderator position there, and stop barking.

Oh, now I realize: You have the *need* to bark. See shrink advice
above.

-RFH

Mar 6 '08 #5
Ramon F Herrera wrote:
On Mar 6, 7:23 pm, Christopher <cp...@austin.rr.comwrote:
>>>Consult a GDB newsgroup, forum, after first consulting the manual. The
question is off topic here.
There is no such thing as a gdb newsgroup.
>Not my problem. Learn how to research for information.

And your opinions are not my problem, either.

YOU ARE the one off topic, here. You have obvious control issues. Any
psychiatrist will tell you that.

Haven't you heard of a newsgroup called comp.lang.c++.MODERATED? Apply
for a moderator position there, and stop barking.

Oh, now I realize: You have the *need* to bark. See shrink advice
above.
No, the FAQ for the group says you're off-topic. See
http://www.parashift.com/c++-faq-lit...t.html#faq-5.9

Also, if there weren't a bunch of off-topic grouches, the signal to
noise ratio for this group would be awful, and it would devolve into yet
another Windows programming group.
Mar 7 '08 #6
There is a lesson for you to learn, Chris:

Just because you don't know the answer to something, it doesn't mean
it is off topic.

-RFH

Mar 7 '08 #7
Ramon F Herrera wrote:
There is a lesson for you to learn, Chris:

Just because you don't know the answer to something, it doesn't mean
it is off topic.
And *YOU* need to learn to RTFFAQ. In particular, section 5.

http://www.parashift.com/c++-faq-lite/how-to-post.html
Mar 7 '08 #8
On Mar 6, 5:59 pm, Ramon F Herrera <ra...@conexus.netwrote:
There is a lesson for you to learn, Chris:

Just because you don't know the answer to something, it doesn't mean
it is off topic.

-RFH
It took me 5 seconds to Google the answer before I made my first
reply. I also happen to have a GDB cheat sheet in front of me
containing the answer as well, which was written after reading the
manual for GDB online at their website. That is something you should
be doing instead of trolling here. Again, learn how to research before
you learn how to program.
You are correct, there are lots of things I do not know that _are_ on
topic. I might even ask about some of those in this group *gasp*.
However, the use of your choice in debuggers is not one of them.
Mar 7 '08 #9
On Mar 6, 2:01*pm, Ramon F Herrera <ra...@conexus.netwrote:
I am running gdb on a C++ executable. The code that I wrote looks like
this:

itr = doc.GetFieldIterator();

while (itr.HasNext()) {
* * Field field = itr.Current();
* * // Console.WriteLine("Field name: {0}", field.GetName());
* * // printf("Field name: %s\n", (char *)field.GetName());
* * printf("Hola %d\n", i);
* * itr.Next();
* * i++;
* * }

However, gdb shows some very different code:

new_allocator() throw() { }
int * * * * * * i = 1;
inline Iterator() : mp_impl(0) {}
new_allocator() throw() { }
basic_string<_CharT, _Traits, _Alloc__str(__lhs);
inline PDFDoc::PDFDoc (const char* filepath) {
basic_string<_CharT, _Traits, _Alloc__str(__lhs);
{ return strlen(__s); }

Is there any way I can have gdb display higher level code?

TIA,

-RFH
If you are using gcc, try "g++ -g file.cpp" I think that does what
you are looking for
Mar 7 '08 #10
ha*************@gmail.com wrote:

If you are using gcc

How about not validating the moron's bad behavior?


Brian
Mar 7 '08 #11
In article <ac789454-f21b-4537-9e4d-5522c23596b0
@m3g2000hsc.googlegroups.com>, ra***@conexus.net says...

[ ... ]
YOU ARE the one off topic, here. You have obvious control issues. Any
psychiatrist will tell you that.

Haven't you heard of a newsgroup called comp.lang.c++.MODERATED? Apply
for a moderator position there, and stop barking.
....and Mr. Herrera's posts suffer the death of a thousand plonks!

--
Later,
Jerry.

The universe is a figment of its own imagination.
Mar 9 '08 #12

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by bayram guzer | last post: by
15 posts views Thread by amit.man | last post: by
13 posts views Thread by Seb | last post: by
reply views Thread by NPC403 | last post: by
1 post views Thread by subhajit12345 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.