Skip to content

Commit

Permalink
Fix Issue 14313 - [ld.gold] gdb: wrong value of shared variables
Browse files Browse the repository at this point in the history
  • Loading branch information
tramker committed Mar 21, 2015
1 parent 02ea3c5 commit 9bd7c7c
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
3 changes: 1 addition & 2 deletions src/backend/dwarf.c
Expand Up @@ -1455,8 +1455,7 @@ void cv_outsym(symbol *s)
#endif
{
infobuf->writeByte(DW_OP_addr);
dwarf_addrel(infoseg,infobuf->size(),s->Sseg);
append_addr(infobuf, s->Soffset); // address of global
dwarf_appreladdr(infoseg, infobuf, s->Sseg, s->Soffset); // address of global
}

infobuf->buf[soffset] = infobuf->size() - soffset - 1;
Expand Down
22 changes: 22 additions & 0 deletions test/runnable/gdb14313.d
@@ -0,0 +1,22 @@
/*
REQUIRED_ARGS: -g
PERMUTE_ARGS:
GDB_SCRIPT:
---
b 21
r
echo RESULT=
p 'gdb.x' + 'gdb.y'
---
GDB_MATCH: RESULT=.*4000065002
*/
module gdb;

__gshared uint x = 4_000_000_000;
__gshared ushort y = 65000;

void main()
{
++x; ++y;
// BP
}

0 comments on commit 9bd7c7c

Please sign in to comment.