Consider the following code:
#include <stdio.h>
#include <ctype.h>
char* Mstrupr(char* szCad);
int main()
{
char szCadena[] = "This string should print well.";
printf("%s\n", Mstrupr(szCadena));
printf("%s\n", Mstrupr("This string should fail."));
return 0;
}
char* Mstrupr(char* szCad)
{
int i;
for (i=0; szC...
Hi,
what is meaning
* Terminating app due to uncaught exception 'NSRangeException', reason: '* -[NSMutableArray objectAtIndex:]: index 1 beyond bounds [0 .. 0]'
so that i can solve my problem
thanks
...
How to break with GDB at object destruction if there is no destructor?
...
Hi Everyone,
I am writing a program that runs some unit tests on code that that been written by my colleagues. I am using the Google C++ testing framework. I run a function that spawns 3 threads, and then runs for 30 seconds. After it runs, the program exits with status 0. This is not the expected behavior, obviously. I know it doesn't ...
How do you call operator<<(std::ostream &os, const ClassX &x) from inside gdb ?
In other words, how do you print an object in gdb ?
call std::cout<<x or call operator<<(std::cout, x) don't seems to work for me!
Any ideas?
...
There is one very useful gdb "script" called poor man's profiler. It calls this command:
gdb -ex "set pagination 0" -ex "thread apply all bt" --batch -p $pid
It works well for most linux processes, but don't work for nginx web server.
Normal output:
# gdb -ex "set pagination 0" -ex "thread apply all bt" -batch -p 5286
Using host lib...
I've got a SIGSEGV I'm trying to track down in my code, but I'm getting strange backtraces like this out of GDB:
#1 0x00407d15 in print_banner (msg=0x2e2e2e2e <Address 0x2e2e2e2e out of bounds>)
at ../include/test_util.hh:20
#2 0x2e2e2e2e in ?? ()
#3 0x2e2e2e2e in ?? ()
#4 0x2e2e2e2e in ?? ()
#5 0x2e2e2e2e in ?? ()
#6 0x2e2e2e...
Hi,
I'm playing with gdb within xcode debugging an iphone app.
Supposedly, I should be able to use the following command:
info malloc <0xaddress>
see
http://www.friday.com/bbum/2010/01/10/using-malloc-to-debug-memory-misuse-in-cocoa/
and http://stackoverflow.com/questions/2910861/strange-gdb-error-unable-to-trace/2911197#2911197
I...
I have big process running. It spawns two threads. I want to debug those two threads separately. But there is only one gdb prompt. How to do this? Means I want to parallely see the execution of the threads.
...
Hi,
I have a timing bug in my application which only occurs when I use valgrind, because valgrind slows down the process so much.
(it's actually a boost::weak_ptr-exception that I cannot localize)
Now I wonder how to reproduce the bug with gdb. I don't see a way to combine gdb + valgrind.
Thanks.
...
I love using GDB withing emacs. And I most like the configuration that I get with "gdb-many-windows", as seen here:
gdb-many-windows
That said, it's not perfect. I'd like to add a frame for showing the currently running threads. Does anyone know if it's possible to customize the configuration that "gdb-many-windows" gives you? Or, if I...
When I use set logging on in gdb, the output to the log file has a different format than what I see on the terminal screen. The logfile is not very readable. How can I get the log file in a readable format?
Output to screen is fine:
(gdb) p foo
$1 = {
static npos = 18446744073709551615,
_M_dataplus = {
<std::allocator<char>> = ...
Dear all!
Is it possible to find out the stack size (= number of frames in the stack) in a gdb script and use it as a condition in a command list? (By gdb script I mean a list of commands that can be given to gdb as "gdb --command='gdb_script' executable")
And is it possible to have conditions within command lists? I'm looking for some...
I'm using Qt Creator on Ubuntu to develop C. Whenever I run with the debugger, I get the message warning: GDB: Failed to set controlling terminal: Invalid argument. This happens even with a hello world program. How can I solve this?
...
Hi all
is there an easy way to visualize non linear(non contiguous) data structures like linked list or binary trees of a program in gnu debugger(gdb)....
to visualize an array of structures we can simply use....
print *array@len
if more indirection is needed we can also use
print **array@len
but above works for only linear data ...
Hello. Could anyone please give me a quick overview/point me to documentation of a way to inspect the stack (and heap?) of a C program? I thought this should be done with GDB, but if there are other more straighforward alternatives, then that should be fine as well.
Thanks.
...
I have device which is running linux with svga library for user interface. I tried to debug it by using GDB, but I got black screen when I initiated graphic by launching svga library. Any body knows how I can make it work? Thanks.
...
suppose the following is the asm code
8048deb: e8 41 05 00 00 call 8049331 <explode_bomb>
8048df0: 03 73 f4 add -0xc(%ebx),%esi
8048df3: 83 c3 04 add $0x4,%ebx
8048df6: 8d 45 f8 lea -0x8(%ebp),%eax
8048df9: 39 c3 cmp ...
Guys, how can i access value of 0x14(%edx)?
Thank you
...
Hello there - I am trying to understand how to accomplish some basic debugging stuff with gdb
I want to check the length of this control (UILabel)
if I type the following in the console I get nothing, what's the proper way to do it?
(gdb) po self.mylabel.frame.size.width
There is no member named frame.
or if I try without self:
(gdb...