gdb problem viewing variables


 
Thread Tools Search this Thread
Operating Systems HP-UX gdb problem viewing variables
# 1  
Old 11-21-2007
gdb problem viewing variables

Hi,

I don't know if this is HP-UX specific, but I'll take my chances with this forum. Smilie

I'm using WDB 5.7 on HP Itanium 11.23.
'file' on my executable shows:
ELF-32 executable object file - IA64

The problem is with viewing the contents of the variables.
Following is a sequence that demonstrates this:
Code:
HP gdb 5.7 for HP Itanium (32 or 64 bit) and target HP-UX 11.2x.
Copyright 1986 - 2001 Free Software Foundation, Inc.
Hewlett-Packard Wildebeest 5.7 (based on GDB) is covered by the
GNU General Public License. Type "show copying" to see the conditions to
change it and/or distribute copies. Type "show warranty" for warranty/support.
..
(gdb) stop in main
Breakpoint 1 at 0x400c5b0:1: file loader.cpp, line 902 from loader.
(gdb) run
Starting program: loader

Breakpoint 1, main (argc=Error accessing memory address 0xd08: Bad address.
) at loader.cpp:902
902      ll=new LclsLC_Library;
(gdb) print argc
Error accessing memory address 0xd08: Bad address.
(gdb) print &argc
$1 = (int *) 0xd08
(gdb) p ll
Error accessing memory address 0xcec: Bad address.
(gdb) p &ll
$1 = (LclsLC_Library **) 0xcec
(gdb)

See that both the parameter 'argc' and the local variable ll have a problem.

Now if I put a breakpoint in a function called by main, and then go up in the stack to main, I CAN see argc. See in the following sequence:
Code:
Breakpoint 2, Test (ll=Error accessing memory address 0xd28: Bad address.
) at loader.cpp:716
716      long lv,c,err = 0,j,k,ccv;
(gdb) where
#0  Test (ll=Error accessing memory address 0xd28: Bad address.
) at loader.cpp:716
#1  0x400c8a0:0 in main (argc=0, argv=0x7ffff9b8) at loader.cpp:911
(gdb) up
#1  0x400c8a0:0 in main (argc=0, argv=0x7ffff9b8) at loader.cpp:911
911      Test(ll,ts);
(gdb) p argc
$5 = 0
(gdb) p &argc
$6 = (int *) 0x7efff220
(gdb)

You may notice though that when I'm in the subprocedure I can't view the parameters of this subprocedure, such as ll .

Any ideas?

Thanks,

RO
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Programming

GDB problem accessing static variables in C

Hi, Can anyone explain this please..... This is on AIX with GDB (tried a few versions). It only happens when program compiled in 64 bit and only with static variables.... A simple test program... ### snip #include <stdio.h> main() { static int n; n = 6; printf("hello %d\n", n);... (0 Replies)
Discussion started by: bagpussnz
0 Replies

2. UNIX for Dummies Questions & Answers

GDB Debugging Problem

I have added some code in my file. I have created executable rpm file of our code and also I have created debuginfo and debugsource files and installed all three. But when I debug in gdb I see the the code changes in soucre file. But the break point does not hit at that place as if it did not... (1 Reply)
Discussion started by: rupeshkp728
1 Replies

3. Programming

Can't debug: assert error with gdb (no problem without)

I'm sorry if the title is really criptic, but I don't know how to phrase my problem. I know I can't really ask for a solution, and I normally wouldn't but this is really escaping my abilities. Antefacts. I developed a program using the zeromq messaging library. I got to a point where the... (11 Replies)
Discussion started by: erupter
11 Replies

4. Programming

ddd/gdb debugger problem

I hope this is the right thread - not sure if it belongs in the Linux forum. Anyway, I'm having an issue with ddd and gdb. When using ddd to run gdb, there are extra parameters being appended, and my program is picking them up. I'm running on Ubuntu 11.04... Here's my command line entry - ... (1 Reply)
Discussion started by: jalburger
1 Replies

5. UNIX for Advanced & Expert Users

HP-UX: Problem viewing directory with BDF...

Hi all, When I use BDF command on this particular server, it outputs mostly normal stuff. However, there is one directory it can't read at all. Also, it doesn't seem to exist. When I BDF my file system with a small panic script (it happens even if you use just the bdf command): As you... (17 Replies)
Discussion started by: zixzix01
17 Replies

6. Programming

gdb: problem while debug an executable file

I created one file (test.cpp)and complied it and get the executable file(test) and run it.It is giving the out put but when I am trying to debug that executable.I am getting the error -- please tell me the solutions?? Thanks in advance ..... (2 Replies)
Discussion started by: smartgupta
2 Replies

7. Programming

GNU GDB compile problem

I have to compile gnu-gdb 6.7 on HP-UX 11.11 with /usr/local/pa64/bin/gcc 64-bit compiler, but I'm having some problems during "make": ser-tcp.c: In function `net_open': ser-tcp.c:207: warning: passing arg 5 of `getsockopt' from incompatible pointer type make: *** Error 1 make: Leaving... (8 Replies)
Discussion started by: untamed
8 Replies

8. Shell Programming and Scripting

problem with variables

hi all , i wanted to know if someone knows how can i use a variable inside another variable e.g. #!/bin/csh foreach test(1 2 3) set sta_$test = "2" ##now its the problem i want to echo the new var #$sta_$test , each time with anothe num ($test = 1... (2 Replies)
Discussion started by: udi
2 Replies

9. UNIX for Dummies Questions & Answers

Problem Viewing Text Files In NT/Samba

I have a problem viewing text files in NT(Samba) with files stored on a Unix Box. The unix box is actually my FTP server where various OS's FTP to it. The text file is ftp'd from IBM to the Unix Box and viewed in NT. The problem is that the return carriage does not register in the text file. I... (1 Reply)
Discussion started by: cwong
1 Replies
Login or Register to Ask a Question