This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: RFA: Rename remote protocol's CRC function


Jim Blandy wrote:
> 
> The documentation for the remote protocol probably ought to specify
> which CRC is to be used for the qCRC packet; at the moment, the only
> way to find out is to go read remote.c.  The function's comment should
> also describe it.  Unfortunately, I don't understand CRC's well enough
> to dope this stuff out myself.

This is OK with me.  I think I assumed that since the function was
static to remote.c, its name didn't really matter that much.

> 
> 2002-12-17  Jim Blandy  <jimb@redhat.com>
> 
>         * remote.c (gdb_remote_crc32): Function renamed from 'crc32';
>         CRC's are actually a family of functions, and different members of
>         the family are used in different places, so the function's name
>         should reflect the specific use.
> 
> Index: gdb/remote.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/remote.c,v
> retrieving revision 1.94
> diff -u -r1.94 remote.c
> --- gdb/remote.c        14 Nov 2002 00:25:03 -0000      1.94
> +++ gdb/remote.c        17 Dec 2002 17:02:37 -0000
> @@ -174,7 +174,7 @@
> 
>  static void print_packet (char *);
> 
> -static unsigned long crc32 (unsigned char *, int, unsigned int);
> +static unsigned long gdb_remote_crc32 (unsigned char *, int, unsigned int);
> 
>  static void compare_sections_command (char *, int);
> 
> @@ -4979,13 +4979,15 @@
>    remote_open (name, from_tty);
>  }
> 
> -/* Table used by the crc32 function to calcuate the checksum. */
> +/* Table used by the gdb_remote_crc32 function to calcuate the checksum. */
> 
>  static unsigned long crc32_table[256] =
>  {0, 0};
> 
> +/* The 32-bit CRC function used for the remote protocol's qCRC
> +   packet.  */
>  static unsigned long
> -crc32 (unsigned char *buf, int len, unsigned int crc)
> +gdb_remote_crc32 (unsigned char *buf, int len, unsigned int crc)
>  {
>    if (!crc32_table[1])
>      {
> @@ -5067,7 +5069,8 @@
>        sectdata = xmalloc (size);
>        old_chain = make_cleanup (xfree, sectdata);
>        bfd_get_section_contents (exec_bfd, s, sectdata, 0, size);
> -      host_crc = crc32 ((unsigned char *) sectdata, size, 0xffffffff);
> +      host_crc = gdb_remote_crc32 ((unsigned char *) sectdata, size,
> +                                   0xffffffff);
> 
>        getpkt (buf, (rs->remote_packet_size), 0);
>        if (buf[0] == 'E')


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]