- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: gdb stops in a command file if there is an err...
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-29-2013 08:45 AM - edited 07-29-2013 10:25 PM
07-29-2013 08:45 AM - edited 07-29-2013 10:25 PM
In my real gdb script while analyzing a core file I try to dereference a pointer and get "Error in sourced command file: Cannot access memory at address " and then my gdb script stops. What I want is just to go on executing my gdb script without stopping. Is it possible?
This is a test program and a test gdb script that demonstrates my problem. In this situation the pointer has NULL value but in a real situation the pointer will like have not null invalid value.
This is test C program:
#include <stdio.h> struct my_struct { int v1; int v2; }; int main() { my_struct *p; printf("%d %d\n", p->v1, p->v2); return 0; }
This is a test gdb script:
>cat analyze.gdb p p->v1 q
And this is demonstration of the problem (what I want from gdb here is to get this error message and then go processing quit command):
>gdb ./a.out ./core.25847 -x ./analyze.gdb HP gdb 6.1 for HP Itanium (32 or 64 bit) and target HP-UX 11iv2 and 11iv3. Copyright 1986 - 2009 Free Software Foundation, Inc. Hewlett-Packard Wildebeest 6.1 (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. .. Core was generated by `a.out'. Program terminated with signal 11, Segmentation fault. SEGV_ACCERR - Invalid Permissions for object #0 0x4000000000000d60:1 in main () at main.cpp:11 11 printf("%d %d\n", p->v1, p->v2); ./analyze.gdb:1: Error in sourced command file: Cannot access memory at address 0x0 (gdb)
P.S. This thread has been moved from HP-UX > General > to HP-UX > languages. -Hp forum moderator
Solved! Go to Solution.
- Tags:
- gdb
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-29-2013 09:46 AM - edited 07-29-2013 07:36 PM
07-29-2013 09:46 AM - edited 07-29-2013 07:36 PM
SolutionI'm not sure if there is a variable that will allow it to continue. Did you look at the list of them?
I didn't see any obvious variable or command line option.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-30-2013 11:37 PM - edited 07-30-2013 11:38 PM
07-30-2013 11:37 PM - edited 07-30-2013 11:38 PM
Re: gdb stops in a command file if there is an error. How to continue executing the command file?
Just to note. GNU gdb on Linux can handle this type of errors in a simple Python script. Hope it would be possible with HP wdb also in future.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-31-2013 12:22 AM
07-31-2013 12:22 AM
Re: gdb stops in a command file if there is an error. How to continue executing the command file?
>GNU gdb on Linux can handle this type of errors
Is there a particular option or variable setting to enable this?
I.e. if they implement this in WDB, they should match.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-31-2013 12:53 AM - edited 07-31-2013 01:00 AM
07-31-2013 12:53 AM - edited 07-31-2013 01:00 AM
Re: gdb stops in a command file if there is an error. How to continue executing the command file?
I found a way to handle the error with python. Look for ignore_errors.py.
In a simplified way it looks like:
>cat ./analyze.v2.gdb
python
def my_ignore_errors(arg):
try:
gdb.execute("print \"" + "Executing: " + arg + "\"")
gdb.execute (arg)
except:
gdb.execute("print \"" + "ERROR: " + arg + "\"")
pass
my_ignore_errors("p p")
my_ignore_errors("p p->v1")
gdb.execute("quit")
And then:
gdb -silent ./a.out -x ./analyze.v2.gdb -c ./core.1090