Sponsored Content
Operating Systems HP-UX gdb problem viewing variables Post 302146542 by rimon on Wednesday 21st of November 2007 04:35:24 AM
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
 

9 More Discussions You Might Find Interesting

1. 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

2. 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

3. 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

4. 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

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

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

7. 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

8. 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

9. 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
execstack(8)						      System Manager's Manual						      execstack(8)

NAME
execstack - tool to set, clear, or query executable stack flag of ELF binaries and shared libraries SYNOPSIS
execstack [OPTION...] [FILES] DESCRIPTION
execstack is a program which sets, clears, or queries executable stack flag of ELF binaries and shared libraries. Linux has in the past allowed execution of instructions on the stack and there are lots of binaries and shared libraries assuming this behaviour. Furthermore, GCC trampoline code for e.g. nested functions requires executable stack on many architectures. To avoid breaking binaries and shared libraries which need executable stack, ELF binaries and shared libraries now can be marked as requiring executable stack or not requiring it. This marking is done through the p_flags field in the PT_GNU_STACK program header entry. If the marking is missing, kernel or dynamic linker need to assume it might need executable stack. The marking is done automatically by recent GCC versions (objects using trampolines on the stack are marked as requiring executable stack, all other newly built objects are marked as not requiring it) and linker collects these markings into marking of the whole binary or shared library. The user can override this at assembly time (through --execstack or --noexecstack assembler options), at link time (through -z execstack or -z noexecstack linker options) and using the execstack tool also on an already linker binary or shared library. This tool is especially useful for third party shared libraries where it is known that they don't need executable stack or testing proves it. OPTIONS
-s --set-execstack Mark binary or shared library as requiring executable stack. -c --clear-execstack Mark binary or shared library as not requiring executable stack. -q --query Query executable stack marking of binaries and shared libraries. For each file it prints either - when executable stack is not required, X when executable stack is required or ? when it is unknown whether the object requires or doesn't require executable stack (the marking is missing). -V Print execstack version and exit. -? --help Print help message. --usage Print a short usage message. ARGUMENTS
Command line arguments should be names of ELF binaries and shared libraries which should be modified or queried. EXAMPLES
# execstack -s ~/lib/libfoo.so.1 will mark ~/lib/libfoo.so.1 as requiring executable stack. # execstack -c ~/bin/bar will mark ~/bin/bar as not requiring executable stack. # execstack -q ~/lib/libfoo.so.1 ~/bin/bar will query executable stack marking of the given files. SEE ALSO
ld.so(8). BUGS
execstack doesn't support yet marking of executables if they do not have PT_GNU_STACK program header entry nor they have room for program segment header table growth. AUTHORS
Jakub Jelinek <jakub@redhat.com>. 28 October 2003 execstack(8)
All times are GMT -4. The time now is 06:33 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy