- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Help me learn "adb"
Operating System - HP-UX
1758400
Members
2779
Online
108869
Solutions
Forums
Categories
Company
Local Language
юдл
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Forums
Discussions
юдл
back
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
Discussion Boards
Discussion Boards
Discussion Boards
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Topic Options
- 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
тАО04-28-2006 08:11 PM
тАО04-28-2006 08:11 PM
Help me learn "adb"
Hey every one
I was so confused with the output from adb when I used it to debug a C program.
"arg?,sp,ret?,dp"
My god.
What does that mean!
I know it's hard to make me understand the usage of adb in several words,but can you give me a sample of using adb to debug a simple C program?
And can you supply me some excellent documents to help me?
Thanks a lot in advanced!
I was so confused with the output from adb when I used it to debug a C program.
"arg?,sp,ret?,dp"
My god.
What does that mean!
I know it's hard to make me understand the usage of adb in several words,but can you give me a sample of using adb to debug a simple C program?
And can you supply me some excellent documents to help me?
Thanks a lot in advanced!
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-28-2006 08:49 PM
тАО04-28-2006 08:49 PM
Re: Help me learn "adb"
No one can help me?
Then I have to change my question
Here is my code:
int ints[]= {1,2,3,4,5,6,7,8,9,0};
int ival;
main()
{
register int i;
for(i=0;i<10;i++)
{ ival = ints[i];
sqr(ival);
printf("sqr of %d is %d\n",ints[i],ival);
}
}
sqr(x)
int *x;
{
*x *= *x;
}
I took it wrong on purpose
and when I invoked adb and pressed $c
it output:
sqr(1) from main+44
data address not found
while according my adb document from www.hp.com
it should have output:
sqr() from main+30
main() from _start+18
_start() from $START$+30
and I press $r it output:
pcoqh 3AE7 sqr+13
pcoqt 3AEB sqr+17
rp 3A87 main+47
arg0 1 arg1 7A00050C arg2 7A000514 arg3 800001F
sp 7A000670 ret0 0 ret1 445AD900 dp 400011C0
r1 400011C0 r3 7A000000 r4 1 r5 7A00050C
r6 7A000514 r7 7A0005F0 r8 80000A4 r9 40007C20
r10 40013420 r11 0 r12 14 r13 240
r14 34 r15 80000B4 r16 7A000280 r17 0
r18 0 r19 0 r20 1 r21 7A000630
r22 0 r31 3A87 sar 18 sr0 0xB574000
sr1 0 sr2 0 sr3 0 sr4 0xB574000
while it should have output:
pcoqh 0xD2B sqr+7
pcoqt 0xD2F sqr+0xB
rp 0xCEB main+33
arg0 1 arg1 68023130 arg2 68023138 arg3 0
sp 68023250 ret0 0 ret1 4E dp
r1 40001800 r3 0 r4 40010954 r5
r6 68023644 r7 499E r8 0 r9 3
r10 0xFFF88000 r11 1880 r12 4000 r13 0xA
r14 0xFFFFB400 r15 2A000 r16 29C00 r17 25000
r18 1BB58 r19 1 r20 1513EF8 r21
r22 0 r31 1 sar 12 sr0 122
sr1 0 sr2 0 sr3 0 sr4 122
sqr+4?
sqr+4: 0xE601095 = ldws 0(r19),r21
1
sqr,3?ia
sqr:
sqr: or arg0,r0,r19
sqr+4: ldws 0(r19),r21
sqr+8: ldws 0(r19),arg1
sqr+0c:
What's wrong
Then I have to change my question
Here is my code:
int ints[]= {1,2,3,4,5,6,7,8,9,0};
int ival;
main()
{
register int i;
for(i=0;i<10;i++)
{ ival = ints[i];
sqr(ival);
printf("sqr of %d is %d\n",ints[i],ival);
}
}
sqr(x)
int *x;
{
*x *= *x;
}
I took it wrong on purpose
and when I invoked adb and pressed $c
it output:
sqr(1) from main+44
data address not found
while according my adb document from www.hp.com
it should have output:
sqr() from main+30
main() from _start+18
_start() from $START$+30
and I press $r it output:
pcoqh 3AE7 sqr+13
pcoqt 3AEB sqr+17
rp 3A87 main+47
arg0 1 arg1 7A00050C arg2 7A000514 arg3 800001F
sp 7A000670 ret0 0 ret1 445AD900 dp 400011C0
r1 400011C0 r3 7A000000 r4 1 r5 7A00050C
r6 7A000514 r7 7A0005F0 r8 80000A4 r9 40007C20
r10 40013420 r11 0 r12 14 r13 240
r14 34 r15 80000B4 r16 7A000280 r17 0
r18 0 r19 0 r20 1 r21 7A000630
r22 0 r31 3A87 sar 18 sr0 0xB574000
sr1 0 sr2 0 sr3 0 sr4 0xB574000
while it should have output:
pcoqh 0xD2B sqr+7
pcoqt 0xD2F sqr+0xB
rp 0xCEB main+33
arg0 1 arg1 68023130 arg2 68023138 arg3 0
sp 68023250 ret0 0 ret1 4E dp
r1 40001800 r3 0 r4 40010954 r5
r6 68023644 r7 499E r8 0 r9 3
r10 0xFFF88000 r11 1880 r12 4000 r13 0xA
r14 0xFFFFB400 r15 2A000 r16 29C00 r17 25000
r18 1BB58 r19 1 r20 1513EF8 r21
r22 0 r31 1 sar 12 sr0 122
sr1 0 sr2 0 sr3 0 sr4 122
sqr+4?
sqr+4: 0xE601095 = ldws 0(r19),r21
sqr,3?ia
sqr:
sqr: or arg0,r0,r19
sqr+4: ldws 0(r19),r21
sqr+8: ldws 0(r19),arg1
sqr+0c:
What's wrong
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-29-2006 06:27 AM
тАО04-29-2006 06:27 AM
Re: Help me learn "adb"
There are several things wrong with your code. First, adb is difficult to use; you should instead use the symbolic debuggger, gbg. If you compile your code with the -g option, then the debugger data is added to your objects and gdb (or xdb) can point to the exact line in the source code which triggered the dump.
Your call to the function sqr is bad. It needs a pointer:
WRONG:
sqr(ival);
RIGHT:
sqr(&ival);
OR BETTER:
sqr(&(ints[i]));
Moreover, you would also receive an F in my C Class for this:
sqr(x)
int *x
{
*x *= *x;
}
Note that there is no function type -- which implies int but you don't return a value; you should have declared sqr to be a void function and always include a return even if the type is void.
void sqr(x)
int *x;
{
*x *= *x;
return;
}
Your call to the function sqr is bad. It needs a pointer:
WRONG:
sqr(ival);
RIGHT:
sqr(&ival);
OR BETTER:
sqr(&(ints[i]));
Moreover, you would also receive an F in my C Class for this:
sqr(x)
int *x
{
*x *= *x;
}
Note that there is no function type -- which implies int but you don't return a value; you should have declared sqr to be a void function and always include a return even if the type is void.
void sqr(x)
int *x;
{
*x *= *x;
return;
}
If it ain't broke, I can fix that.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО04-29-2006 03:44 PM
тАО04-29-2006 03:44 PM
Re: Help me learn "adb"
Hey,Mr. stephenson.
I'm not so poor at C programming as you thought.
I said I made it wrong on purpose to generate a core file so I can debug it with adb according to the official document.
I will considerate your advice about subtituting gdb for adb.
Thanks a lot
I'm not so poor at C programming as you thought.
I said I made it wrong on purpose to generate a core file so I can debug it with adb according to the official document.
I will considerate your advice about subtituting gdb for adb.
Thanks a lot
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
News and Events
Support
© Copyright 2024 Hewlett Packard Enterprise Development LP