* A problem with debugger dbx
@ 1996-12-12 5:00 legend
1996-12-18 5:00 ` Peter Thompson
0 siblings, 1 reply; 2+ messages in thread
From: legend @ 1996-12-12 5:00 UTC (permalink / raw)
Dear Sir,
I'm a assembly language programmer for Digital UNIX 3.2D. I have a
unexpected problem recently when I debug my executable files using the
traditional debugger under UNIX, dbx. It is listed in the following:
(dbx) li
>[main,0x120001350] lda sp, -352(s0)
[main,0x120001354] ldah gp,8192(r27)
[main,0x120001358] lda gp,28112(g0)
[main,0x12000135c] stq r16,0(sp)
[main,0x120001360] stq r17,312(sp)
[main,0x120001364] stq r16,304(sp)
[main,0x120001368] ldl r1,304(sp)
[main,0x12000136c] cmplt r1,0x2,r2
[main,0x120001370] beq r2,0x1200013e0
[main,0x120001374] ldq r27,032472(gp)
(dbx) patch 0x120001350=0x4421e801
>[main,0x120001350] xor r1, r1, r1
(dbx) 0x120001350/10i
>[main,0x120001350] xor r1, r1, r1
[main,0x120001354] call_pal halt
[main,0x120001358] lda gp,28112(g0)
[main,0x12000135c] stq r16,0(sp)
[main,0x120001360] stq r17,312(sp)
[main,0x120001364] stq r16,304(sp)
[main,0x120001368] ldl r1,304(sp)
[main,0x12000136c] cmplt r1,0x2,r2
[main,0x120001370] beq r2,0x1200013e0
[main,0x120001374] ldq r27,032472(gp)
The problem is that I want to change the instruction 'lda sp, -352(sp)'
at address 0x120001350 to that instruction ' xor r1, r1, r1' ONLY, but
the next intruction at address 0x120001354 is changed to 'call_pal halt'
unexpectedly.
Why ? Is this a bug of Digital UNIX 3.2D ?
Any advice or help is welcome.
Address: 3/F Zhongxi Mansion, 121-123 Jiangsu Road,
Shanghai (200050), China
Tel: 0086-21-62104066
Fax: 0086-21-62106508
E-Mail: legend@public.sta.net.cn
Thanks in advance !!
Best Regards,
Qin Qinghua
^ permalink raw reply [flat|nested] 2+ messages in thread* Re: A problem with debugger dbx
1996-12-12 5:00 A problem with debugger dbx legend
@ 1996-12-18 5:00 ` Peter Thompson
0 siblings, 0 replies; 2+ messages in thread
From: Peter Thompson @ 1996-12-18 5:00 UTC (permalink / raw)
legend@public.sta.net.cn <Qin Qinghua> wrote:
> (dbx) patch 0x120001350=0x4421e801
> >[main,0x120001350] xor r1, r1, r1
>
> (dbx) 0x120001350/10i
> >[main,0x120001350] xor r1, r1, r1
> [main,0x120001354] call_pal halt
> The problem is that I want to change the instruction
> 'lda sp, -352(sp)'
> at address 0x120001350 to that instruction ' xor r1, r1, r1' ONLY,
> but the next intruction at address 0x120001354 is changed to
> 'call_pal halt' unexpectedly.
>
> Why ? Is this a bug of Digital UNIX 3.2D ?
We prefer to think of this as feature (or a consequence). The
problem is that there is no clear way of specifying that what
you want to change is an instruction, which is 32 bits long. By
using the address format to the patch command, dbx expects you to
be changing the quadword, or 64bit value at that address. But you've
only supplied the (needed) 32 bits, so dbx sign extends for
you and it replaces the whole 64 bit area. I know I've answered
this exact question internally, so you may have already been informed
of this, but there is something you can do. Print out the
hex values of both instructions and change the part that you
want. So it would look something like:
(dbx) li
> [main:10, 0x120001310] addq r31, 0x14, r16
[main:10, 0x120001314] ldq r17, -32664(gp)
[main:10, 0x120001318] ldq r27, -32456(gp)
[main:10, 0x12000131c] jsr r26, (r27), 0x11fffec90
[main:10, 0x120001320] ldah gp, 8192(r26)
[main:10, 0x120001324] lda gp, 28080(gp)
[main:11, 0x120001328] ldq r27, -32520(gp)
[main:11, 0x12000132c] jsr r26, (r27), 0x120007160
[main:11, 0x120001330] ldah gp, 8192(r26)
[main:11, 0x120001334] lda gp, 28064(gp)
(dbx) 0x120001310/10X
0000000120001310: a63d806843e29410 6b5b765ca77d8138
0000000120001320: 23bd6db027ba2000 6b5b578ca77d80f8
0000000120001330: 23bd6da027ba2000 a03e0028b01e0028
0000000120001340: 261dfffff4200011 a77d811822107f40
0000000120001350: 27ba20006b5b57df 43e0541023bd6d7c
(dbx) patch 0x120001310 = 0xa63d80684421e801
[main:10, 0x120001310] xor r1, r1, r1
(dbx) 0x120001310/10i
[main:10, 0x120001310] xor r1, r1, r1
[main:10, 0x120001314] ldq r17, -32664(gp)
[main:10, 0x120001318] ldq r27, -32456(gp)
[main:10, 0x12000131c] jsr r26, (r27), 0x11fffec90
[main:10, 0x120001320] ldah gp, 8192(r26)
etc...
PeterT
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~1996-12-18 5:00 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1996-12-12 5:00 A problem with debugger dbx legend
1996-12-18 5:00 ` Peter Thompson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox