- if (s->flags & SEC_LOAD) /* only deal with loadable sections */
- {
- bintotal += s->_raw_size;
- final = (s->vma + s->_raw_size);
-
- printf_filtered ("%s\t: 0x%4x .. 0x%4x ", s->name, s->vma,
- s->vma + s->_raw_size);
- gdb_flush (gdb_stdout);
-
- /* Output the starting address */
- sprintf(buffer,"/A");
- reclen = pmon_makeb64(s->vma,&buffer[2],36,&csum);
- buffer[2 + reclen] = '\015';
- buffer[3 + reclen] = '\0';
- reclen += 3; /* for the initial escape code and carriage return */
- SERIAL_WRITE (mips_desc, buffer, reclen);
-#if defined(DOETXACK)
- finished = pmon_check_ack();
-#endif /* DOETXACK */
-
- if (!finished)
- {
- int binamount;
- unsigned int zerofill = 0;
- char *bp = buffer;
- int i;
-
- reclen = 0;
-
- for (i = 0; ((i < s->_raw_size) && !finished); i += binamount) {
- int binptr = 0;
-
- binamount = min (BINCHUNK, s->_raw_size - i);
-
- bfd_get_section_contents (abfd, s, binbuf, i, binamount);
-
- /* This keeps a rolling checksum, until we decide to output
- the line: */
- for (; ((binamount - binptr) > 0);) {
- pmon_make_fastrec (&bp, binbuf, &binptr, binamount, &reclen, &csum, &zerofill);
- if (reclen >= (MAXRECSIZE - CHECKSIZE)) {
- reclen = pmon_checkset (reclen, &bp, &csum);
- SERIAL_WRITE (mips_desc, buffer, reclen);
-#if defined(DOETXACK)
- finished = pmon_check_ack();
- if (finished) {
- zerofill = 0; /* do not transmit pending zerofills */
- break;
- }
-#endif /* DOETXACK */
-
- if (hashmark) {
- putchar_unfiltered ('#');
- gdb_flush (gdb_stdout);
- }
-
- bp = buffer;
- reclen = 0; /* buffer processed */
- }
- }
- }
-
- /* Ensure no out-standing zerofill requests: */
- if (zerofill != 0)
- reclen = pmon_zeroset (reclen, &bp, &zerofill, &csum);
-
- /* and then flush the line: */
- if (reclen > 0) {
- reclen = pmon_checkset (reclen, &bp, &csum);
- /* Currently pmon_checkset outputs the line terminator by
- default, so we write out the buffer so far: */
- SERIAL_WRITE (mips_desc, buffer, reclen);
-#if defined(DOETXACK)
- finished = pmon_check_ack();
-#endif /* DOETXACK */
- }
- }
-
- if (hashmark)
- putchar_unfiltered ('\n');
- }
+ if (s->flags & SEC_LOAD) /* only deal with loadable sections */
+ {
+ bintotal += s->_raw_size;
+ final = (s->vma + s->_raw_size);
+
+ printf_filtered ("%s\t: 0x%4x .. 0x%4x ", s->name, (unsigned int) s->vma,
+ (unsigned int) (s->vma + s->_raw_size));
+ gdb_flush (gdb_stdout);
+
+ /* Output the starting address */
+ sprintf (buffer, "/A");
+ reclen = pmon_makeb64 (s->vma, &buffer[2], 36, &csum);
+ buffer[2 + reclen] = '\n';
+ buffer[3 + reclen] = '\0';
+ reclen += 3; /* for the initial escape code and carriage return */
+ pmon_download (buffer, reclen);
+ finished = pmon_check_ack ("/A");
+
+ if (!finished)
+ {
+ unsigned int binamount;
+ unsigned int zerofill = 0;
+ char *bp = buffer;
+ unsigned int i;
+
+ reclen = 0;
+
+ for (i = 0; ((i < s->_raw_size) && !finished); i += binamount)
+ {
+ int binptr = 0;
+
+ binamount = min (BINCHUNK, s->_raw_size - i);
+
+ bfd_get_section_contents (abfd, s, binbuf, i, binamount);
+
+ /* This keeps a rolling checksum, until we decide to output
+ the line: */
+ for (; ((binamount - binptr) > 0);)
+ {
+ pmon_make_fastrec (&bp, binbuf, &binptr, binamount, &reclen, &csum, &zerofill);
+ if (reclen >= (MAXRECSIZE - CHECKSIZE))
+ {
+ reclen = pmon_checkset (reclen, &bp, &csum);
+ pmon_download (buffer, reclen);
+ finished = pmon_check_ack ("data record");
+ if (finished)
+ {
+ zerofill = 0; /* do not transmit pending zerofills */
+ break;
+ }
+
+ if (ui_load_progress_hook)
+ ui_load_progress_hook (s->name, i);
+
+ if (hashmark)
+ {
+ putchar_unfiltered ('#');
+ gdb_flush (gdb_stdout);
+ }
+
+ bp = buffer;
+ reclen = 0; /* buffer processed */
+ }
+ }
+ }
+
+ /* Ensure no out-standing zerofill requests: */
+ if (zerofill != 0)
+ reclen = pmon_zeroset (reclen, &bp, &zerofill, &csum);
+
+ /* and then flush the line: */
+ if (reclen > 0)
+ {
+ reclen = pmon_checkset (reclen, &bp, &csum);
+ /* Currently pmon_checkset outputs the line terminator by
+ default, so we write out the buffer so far: */
+ pmon_download (buffer, reclen);
+ finished = pmon_check_ack ("record remnant");
+ }
+ }
+
+ putchar_unfiltered ('\n');
+ }