Skip to content

Commit

Permalink
* addr2line.c (uleb128): cast the value to unsigned long.
Browse files Browse the repository at this point in the history
* addr2line.c (fill_lines): print error when lseek fails.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31010 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information
nurse committed Mar 2, 2011
1 parent 613861d commit 6a288de
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
6 changes: 6 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
Thu Mar 3 00:46:51 2011 NARUSE, Yui <naruse@ruby-lang.org>

* addr2line.c (uleb128): cast the value to unsigned long.

* addr2line.c (fill_lines): print error when lseek fails.

Thu Mar 3 00:36:29 2011 NARUSE, Yui <naruse@ruby-lang.org>

* lib/rexml/encoding.rb (REXML::Encoding#encoding=): store @encoding
Expand Down
8 changes: 7 additions & 1 deletion addr2line.c
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ uleb128(char **p) {
for (;;) {
unsigned char b = *(unsigned char *)(*p)++;
if (b < 0x80) {
r += b << s;
r += (unsigned long)b << s;
break;
}
r += (b & 0x7f) << s;
Expand Down Expand Up @@ -442,6 +442,12 @@ fill_lines(int num_traces, void **traces, char **syms, int check_debuglink,
return;
}
filesize = lseek(fd, 0, SEEK_END);
if (filesize < 0) {
int e = errno;
close(fd);
fprintf(stderr, "lseek: %s\n", strerror(e));
return;
}
lseek(fd, 0, SEEK_SET);
/* async-signal unsafe */
file = (char *)mmap(NULL, filesize, PROT_READ, MAP_SHARED, fd, 0);
Expand Down

0 comments on commit 6a288de

Please sign in to comment.