GDB will set bp at a function for RISC-V when step over this function call

"Ge, Lei" <[email protected]>
Newsgroups gmane.comp.gdb.devel
Message-ID <BYAPR11MB26632A15985C8FC698BC961697DD9@BYAPR11MB2663.namprd11.prod.outlook.com>
Hi all,

I have a question about GDB for RISC-V. When step over a function call, GDB will set a bp at this function only for RISC-V. Do you think it is a bug? Thanks.

I use GDB 10.2. Below is test code. Line 9 is a function call of test0. When program stops at main.c:9, then next. From RSP log, we can see that gdb will set bp at the addr of test0 for RISC-V. For other arch, it will not.

1
2       int test0()
3       {
4           return 0;
5       }
6
7       int main (int argc, char * argv[])
8       {
9           test0();
10          return 0;
11      }



(gdb) disassemble test0
Dump of assembler code for function test0:
Sending packet: $m2aaaaaa5c0,40#3d...Packet received: 83b7c7a791c7172500000335a5a38297eff0bff885472300f400a26002644101828069bf411122e4000881473e85226441018280011106ec22e80010aa872330
   0x0000002aaaaaa5e4 <+0>:     addi    sp,sp,-16
   0x0000002aaaaaa5e6 <+2>:     sd      s0,8(sp)
   0x0000002aaaaaa5e8 <+4>:     addi    s0,sp,16
   0x0000002aaaaaa5ea <+6>:     li      a5,0
   0x0000002aaaaaa5ec <+8>:     mv      a0,a5
   0x0000002aaaaaa5ee <+10>:    ld      s0,8(sp)
   0x0000002aaaaaa5f0 <+12>:    addi    sp,sp,16
   0x0000002aaaaaa5f2 <+14>:    ret

(gdb) disassemble main
Dump of assembler code for function main:
   0x0000002aaaaaa5f4 <+0>:     addi    sp,sp,-32
   0x0000002aaaaaa5f6 <+2>:     sd      ra,24(sp)
   0x0000002aaaaaa5f8 <+4>:     sd      s0,16(sp)
   0x0000002aaaaaa5fa <+6>:     addi    s0,sp,32
   0x0000002aaaaaa5fc <+8>:     mv      a5,a0
Sending packet: $m2aaaaaa600,40#0b...Packet received: b4fe2326f4feeff0fffd81473e85e260426405618280397122f84af0171400001304447f171900001309497f3309894006fc26f44eec52e856e413593940630f
   0x0000002aaaaaa5fe <+10>:    sd      a1,-32(s0)
   0x0000002aaaaaa602 <+14>:    sw      a5,-20(s0)
   0x0000002aaaaaa606 <+18>:    jal     ra,0x2aaaaaa5e4 <test0>
=> 0x0000002aaaaaa60a <+22>:    li      a5,0
   0x0000002aaaaaa60c <+24>:    mv      a0,a5
   0x0000002aaaaaa60e <+26>:    ld      ra,24(sp)
   0x0000002aaaaaa610 <+28>:    ld      s0,16(sp)
   0x0000002aaaaaa612 <+30>:    addi    sp,sp,32
   0x0000002aaaaaa614 <+32>:    ret
(gdb) n
Sending packet: $m3ff7fed012,2#c3...Packet received: 8280
Sending packet: $X3ff7fed012,2:\002\220#7a...Packet received: OK
Sending packet: $m2aaaaaa606,2#df...Packet received: eff0
Sending packet: $m2aaaaaa608,2#e1...Packet received: fffd
Sending packet: $m2aaaaaa606,2#df...Packet received: eff0
Sending packet: $m2aaaaaa608,2#e1...Packet received: fffd
Sending packet: $m2aaaaaa5c0,40#3d...Packet received: 83b7c7a791c7172500000335a5a38297eff0bff885472300f400a26002644101828069bf411122e4000881473e85226441018280011106ec22e80010aa872330
Sending packet: $m2aaaaaa5e4,2#11...Packet received: 4111
Sending packet: $m2aaaaaa5e4,2#11...Packet received: 4111
Sending packet: $X2aaaaaa5e4,2:\002\220#c8...Packet received: OK
Sending packet: $vCont;c:p206.-1#76...Packet received: T05swbreak:;02:60fbffff3f000000;20:e4a5aaaa2a000000;thread:p206.206;core:0;
Sending packet: $X2aaaaaa5e4,2:A\021#88...Packet received: OK
Sending packet: $m2aaaaaa5c0,40#3d...Packet received: 83b7c7a791c7172500000335a5a38297eff0bff885472300f400a26002644101828069bf411122e4000881473e85226441018280011106ec22e80010aa872330
Sending packet: $m2aaaaaa5e4,2#11...Packet received: 4111
Sending packet: $m2aaaaaa5e4,4#13...Packet received: 411122e4
Sending packet: $m2aaaaaa5e0,4#0f...Packet received: 828069bf
Sending packet: $g#67...Packet received: 00000000000000000aa6aaaa2a00000060fbffff3f00000000c8aaaa2a000000f0c2fdf73f0000001072edf73f000000863aeff73f000000f0c4aaaa2a00000080fbffff3f00000000000000000000000100000000000000f8fcffff3f00000008fdffff3f0000000000000000000000a8fbffff3f0000000100000000000000a828fdf73f0000002f7c676a636312007048baaa2a00000000000000000000008067baaa2a000000b0d2fff73f0000007048baaa2a000000000000000000000000000000000000000865b9aa2a00000068abb7aa2a0000006300000000000000863a0200000000001c66fff73f00000003000000000000004000000000000000[552 bytes omitted]
Sending packet: $m2aaaaaa60a,4#0c...Packet received: 81473e85
Sending packet: $m2aaaaaa606,4#e1...Packet received: eff0fffd
Sending packet: $m3ffffffb40,40#5a...Packet received: 0100000000000000b0d2fff73f0000008067baaa2a000000c067baaa2a000000f8fcffff3f000000000000000100000016a6aaaa2a0000000c3beff73f000000
Sending packet: $m2aaaaaa60a,2#0a...Packet received: 8147
Sending packet: $m2aaaaaa60a,2#0a...Packet received: 8147
Sending packet: $X2aaaaaa60a,2:\002\220#c1...Packet received: OK
Sending packet: $vCont;c:p206.-1#76...Packet received: T05swbreak:;02:60fbffff3f000000;20:0aa6aaaa2a000000;thread:p206.206;core:0;
Sending packet: $m2aaaaaa60a,4#0c...Packet received: 02903e85
Sending packet: $m2aaaaaa606,4#e1...Packet received: eff0fffd
Sending packet: $g#67...Packet received: 00000000000000000aa6aaaa2a00000060fbffff3f00000000c8aaaa2a000000f0c2fdf73f0000001072edf73f000000863aeff73f000000f0c4aaaa2a00000080fbffff3f00000000000000000000000000000000000000f8fcffff3f00000008fdffff3f0000000000000000000000a8fbffff3f0000000000000000000000a828fdf73f0000002f7c676a636312007048baaa2a00000000000000000000008067baaa2a000000b0d2fff73f0000007048baaa2a000000000000000000000000000000000000000865b9aa2a00000068abb7aa2a0000006300000000000000863a0200000000001c66fff73f00000003000000000000004000000000000000[552 bytes omitted]
Sending packet: $m3ffffffb40,40#5a...Packet received: 0100000000000000b0d2fff73f0000008067baaa2a00000080fbffff3f000000f8fcffff3f000000000000000100000016a6aaaa2a0000000c3beff73f000000
Sending packet: $X2aaaaaa60a,2:\201G#f7...Packet received: OK
Sending packet: $qXfer:threads:read::0,1000#92...Packet received: l<threads>\n<thread id="p206.206" core="0" name="test"/>\n</threads>\n
Sending packet: $X3ff7fed012,2:\202\200#ea...Packet received: OK
Sending packet: $m2aaaaaa60a,4#0c...Packet received: 81473e85
Sending packet: $m2aaaaaa606,4#e1...Packet received: eff0fffd
10          return 0;
(gdb)

Thanks,
Lei
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.